This is an automated email from the git hooks/post-receive script.
mreynolds pushed a commit to branch 389-ds-base-1.3.10
in repository 389-ds-base.
The following commit(s) were added to refs/heads/389-ds-base-1.3.10 by this push:
new 73928c4 Issue 50599 - Remove db region files prior to db recovery
73928c4 is described below
commit 73928c4bea7e0151180c3e9b86066b1473def577
Author: Mark Reynolds <mreynolds(a)redhat.com>
AuthorDate: Tue Jan 14 14:25:25 2020 -0500
Issue 50599 - Remove db region files prior to db recovery
Bug Description: If the server crashes then the region files can become
corrupted and this prevents the server from starting.
Fix Description: If we encounter a disorderly shutdown, then remove
the region files so there is a clean slate to start
with.
relates:
https://pagure.io/389-ds-base/issue/50599
Reviewed by: firstyear & lkrispen (Thanks!!)
---
ldap/servers/slapd/back-ldbm/dblayer.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c
b/ldap/servers/slapd/back-ldbm/dblayer.c
index 64a4e9e..f679bb1 100644
--- a/ldap/servers/slapd/back-ldbm/dblayer.c
+++ b/ldap/servers/slapd/back-ldbm/dblayer.c
@@ -66,6 +66,7 @@
#include <prclist.h>
#include <sys/types.h>
#include <sys/statvfs.h>
+#include <glob.h>
#define DB_OPEN(oflags, db, txnid, file, database, type, flags, mode, rval)
\
{
\
@@ -1362,9 +1363,20 @@ dblayer_start(struct ldbminfo *li, int dbmode)
slapi_log_err(SLAPI_LOG_NOTICE, "dblayer_start", "Clean up
db environment and start "
"from
archive.\n");
} else {
+ glob_t globbuf;
+ char file_pattern[MAXPATHLEN];
slapi_log_err(SLAPI_LOG_NOTICE, "dblayer_start", "Detected
Disorderly Shutdown last "
"time Directory
Server was running, recovering database.\n");
slapi_disordely_shutdown(PR_TRUE);
+
+ /* Better wipe out the region files to help ensure a clean start */
+ PR_snprintf(file_pattern, MAXPATHLEN, "%s/%s", region_dir,
"__db.*");
+ if (glob(file_pattern, GLOB_DOOFFS, NULL, &globbuf) == 0) {
+ for (size_t i = 0; i < globbuf.gl_pathc; i++) {
+ remove(globbuf.gl_pathv[i]);
+ }
+ globfree(&globbuf);
+ }
}
}
switch (dbmode & DBLAYER_RESTORE_MASK) {
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.