Author: nkinder
Update of /cvs/dirsec/ldapserver/ldap/servers/plugins/replication
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv18707
Modified Files:
cl5_api.c repl5_replica_config.c
Log Message:
Resolves: 238630
Summary: Remove changelog db file when replica config is removed.
Index: cl5_api.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/replication/cl5_api.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- cl5_api.c 24 Sep 2007 23:39:22 -0000 1.16
+++ cl5_api.c 12 Oct 2007 17:22:54 -0000 1.17
@@ -6391,20 +6391,24 @@
_cl5WriteRUV (file, PR_FALSE);
}
- /* close file */
+ /* close the db */
if (file->db)
file->db->close(file->db, 0);
if (file->flags & DB_FILE_DELETED)
- {
- PR_snprintf(fullpathname, MAXPATHLEN, "%s/%s", s_cl5Desc.dbDir,
file->name);
- if (PR_Delete(fullpathname) != PR_SUCCESS)
+ {
+ int rc = 0;
+ /* We need to use the libdb API to delete the files, otherwise we'll
+ * run into problems when we try to checkpoint transactions later. */
+ PR_snprintf(fullpathname, MAXPATHLEN, "%s/%s", s_cl5Desc.dbDir,
file->name);
+ rc = s_cl5Desc.dbEnv->dbremove(s_cl5Desc.dbEnv, 0, fullpathname, 0, 0);
+ if (rc != 0)
{
- slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name_cl, "_cl5DBCloseFile: "
- "failed to remove (%s) file; NSPR error - %d\n",
file->name, PR_GetError ());
-
- }
- }
+ slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name_cl,
"_cl5DBCloseFile: "
+ "failed to remove (%s) file; libdb error - %d (%s)\n",
file->name,
+ rc, dblayer_strerror(rc));
+ }
+ }
/* slapi_ch_free accepts NULL pointer */
slapi_ch_free ((void**)&file->name);
Index: repl5_replica_config.c
===================================================================
RCS file:
/cvs/dirsec/ldapserver/ldap/servers/plugins/replication/repl5_replica_config.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- repl5_replica_config.c 10 Nov 2006 23:45:17 -0000 1.7
+++ repl5_replica_config.c 12 Oct 2007 17:22:54 -0000 1.8
@@ -460,9 +460,17 @@
if (mtnode_ext->replica)
{
+ char ebuf[BUFSIZ];
+
/* remove object from the hash */
r = (Replica*)object_get_data (mtnode_ext->replica);
PR_ASSERT (r);
+ /* The changelog for this replica is no longer valid, so we should remove it. */
+ slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "replica_config_delete:
"
+ "Warning: The changelog for replica %s is no longer valid
since "
+ "the replica config is being deleted. Removing the
changelog.\n",
+ escape_string(slapi_sdn_get_dn(replica_get_root(r)),ebuf));
+ cl5DeleteDBSync(mtnode_ext->replica);
replica_delete_by_name (replica_get_name (r));
object_release (mtnode_ext->replica);
mtnode_ext->replica = NULL;
Show replies by date