summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoriko Hosoi <nhosoi@redhat.com>2010-06-03 11:48:23 -0700
committerNoriko Hosoi <nhosoi@redhat.com>2010-06-03 12:37:55 -0700
commit1d5859fdf332594b37c6ab072e2657435e1958d1 (patch)
tree6d0ac1912adf13bd400bad776a5c0b6e22b50a70
parentdf777e3de911e3b5428938a7f1c91b76678fb0e2 (diff)
downloadds-1d5859fdf332594b37c6ab072e2657435e1958d1.tar.gz
ds-1d5859fdf332594b37c6ab072e2657435e1958d1.tar.xz
ds-1d5859fdf332594b37c6ab072e2657435e1958d1.zip
597375 - Deleting LDBM database causes backup/restore problemDirectory_Server_8_2_Candidate_20100607
https://bugzilla.redhat.com/show_bug.cgi?id=597375 Fix Description: 1) When a backend was removed, the db instance directory was removed as well (See also 463774 - index files for database should be deleted when db is deleted). In case DB_RECOVER_FATAL is set in the DB open after the removal (e.g., in restore), the logs in the transaction logs are replayed and compared with the contents of the DB files. At that time, if the db instance directory does not exist, libdb returns FATAL error. To prevent the problem, we have to leave the empty directory. 2) When removing index files, we don't have to open index files with CREAT flag. Note: In the bug 463774, the server was fixed so that once a db backend is removed, the db instance directory is removed. With this fix (597375), the backend removal leaves the empty db instance directory. Plus, if backup is restored, even if the backup was made after the backend is deleted, the restore could create empty DB files in the deleted db instance directory if the transaction log files still contain the history of the deleted backend.
-rw-r--r--ldap/servers/slapd/back-ldbm/dblayer.c5
-rw-r--r--ldap/servers/slapd/back-ldbm/ldbm_instance_config.c13
2 files changed, 15 insertions, 3 deletions
diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c
index 1254b372..27a4f6f4 100644
--- a/ldap/servers/slapd/back-ldbm/dblayer.c
+++ b/ldap/servers/slapd/back-ldbm/dblayer.c
@@ -3128,7 +3128,7 @@ int dblayer_erase_index_file_ex(backend *be, struct attrinfo *a,
int rc = 0;
DB *db = 0;
- if (NULL == pEnv) /* index file does not exist */
+ if (NULL == pEnv) /* db does not exist */
return rc;
/* Added for bug 600401. Somehow the checkpoint thread deadlocked on
@@ -3139,7 +3139,8 @@ int dblayer_erase_index_file_ex(backend *be, struct attrinfo *a,
dblayer_force_checkpoint(li);
}
- if (dblayer_get_index_file(be, a, &db, DBOPEN_CREATE) == 0) {
+ if (0 == dblayer_get_index_file(be, a, &db, 0 /* Don't create an index file
+ if it does not exist. */)) {
/* first, remove the file handle for this index, if we have it open */
PR_Lock(inst->inst_handle_list_mutex);
if (a->ai_dblayer) {
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
index a826e3c6..dc71f8c9 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
@@ -1084,7 +1084,18 @@ ldbm_instance_post_delete_instance_entry_callback(Slapi_PBlock *pb, Slapi_Entry*
}
PR_CloseDir(dirhandle);
}
- PR_RmDir(inst_dirp);
+ /*
+ * When a backend was removed, the db instance directory
+ * was removed as well (See also bz463774).
+ * In case DB_RECOVER_FATAL is set in the DB open after
+ * the removal (e.g., in restore), the logs in the transaction
+ * logs are replayed and compared with the contents of the DB
+ * files. At that time, if the db instance directory does not
+ * exist, libdb returns FATAL error. To prevent the problem,
+ * we have to leave the empty directory. (bz597375)
+ *
+ * PR_RmDir(inst_dirp);
+ */
} /* non-null dirhandle */
if (inst_dirp != inst_dir) {
slapi_ch_free_string(&inst_dirp);