summaryrefslogtreecommitdiffstats
path: root/ldap/servers
diff options
context:
space:
mode:
authorRich Megginson <rmeggins@redhat.com>2006-11-15 17:47:58 +0000
committerRich Megginson <rmeggins@redhat.com>2006-11-15 17:47:58 +0000
commitb40456f95274ec1bb4d6a36f3dbf407a7dac71fd (patch)
tree59b0efe8c9d150a57472a3fcf949ca544312e9dd /ldap/servers
parenta269b9cabbf0e5fc8a5ff8f8d9becba784879ba0 (diff)
downloadds-b40456f95274ec1bb4d6a36f3dbf407a7dac71fd.tar.gz
ds-b40456f95274ec1bb4d6a36f3dbf407a7dac71fd.tar.xz
ds-b40456f95274ec1bb4d6a36f3dbf407a7dac71fd.zip
Resolves: bug 214851
Bug Description: integrating db43 into ds70 Reviewed by: nkinder (Thanks!) Fix Description: I took the original diffs posted by Ulf and merged them in with our code which has changed slightly since the diffs were originally generated. I also put #if directives like the following: #if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 4300 ... db43 features ... #else ... db42 features ... #endif so that we can use both db42 and db43. Platforms tested: RHEL4/FC5 Flag Day: no Doc impact: no
Diffstat (limited to 'ldap/servers')
-rw-r--r--ldap/servers/plugins/replication/cl5_api.c23
-rw-r--r--ldap/servers/slapd/back-ldbm/dbhelp.c4
-rw-r--r--ldap/servers/slapd/back-ldbm/dblayer.c19
-rw-r--r--ldap/servers/slapd/back-ldbm/dblayer.h5
4 files changed, 50 insertions, 1 deletions
diff --git a/ldap/servers/plugins/replication/cl5_api.c b/ldap/servers/plugins/replication/cl5_api.c
index 6be30db3..f163dcfa 100644
--- a/ldap/servers/plugins/replication/cl5_api.c
+++ b/ldap/servers/plugins/replication/cl5_api.c
@@ -364,7 +364,11 @@ static int _cl5UpdateRUV (Object *obj, CSN *csn, PRBool newReplica, PRBool purg
static int _cl5GetRUV2Purge2 (Object *fileObj, RUV **ruv);
/* db error processing */
+#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 4300
+static void _cl5DBLogPrint(const DB_ENV *dbenv, const char* prefix, const char *buffer);
+#else /* assume 42 */
static void _cl5DBLogPrint(const char* prefix, char *buffer);
+#endif
/* bakup/recovery, import/export */
static PRBool _cl5IsLogFile (const char *name);
@@ -384,7 +388,12 @@ static Object* _cl5GetReplica (const slapi_operation_parameters *op, const char*
static int _cl5FileEndsWith(const char *filename, const char *ext);
/* Callback function for libdb to spit error info into our log */
+#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 4300
+static void dblayer_log_print(const DB_ENV *dbenv, const char* prefix,
+ const char *buffer)
+#else
static void dblayer_log_print(const char* prefix, char *buffer)
+#endif
{
/* We ignore the prefix since we know who we are anyway */
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name_cl, "libdb: %s\n", buffer);
@@ -3796,7 +3805,11 @@ static void _cl5InitDBEnv(DB_ENV *dbEnv)
if (s_cl5Desc.dbConfig.verbose)
{
int on = 1;
+#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 4300
+ /* DB_VERB_CHKPOINT removed in 43 */
+#else
dbEnv->set_verbose(dbEnv, DB_VERB_CHKPOINT, on);
+#endif
dbEnv->set_verbose(dbEnv, DB_VERB_DEADLOCK, on);
dbEnv->set_verbose(dbEnv, DB_VERB_RECOVERY, on);
dbEnv->set_verbose(dbEnv, DB_VERB_WAITSFOR, on);
@@ -3810,7 +3823,12 @@ static void _cl5InitDBEnv(DB_ENV *dbEnv)
#endif
}
+#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 4300
+static void _cl5DBLogPrint(const DB_ENV *dbenv, const char* prefix,
+ const char *buffer)
+#else
static void _cl5DBLogPrint(const char* prefix, char *buffer)
+#endif
{
/* We ignore the prefix since we know who we are anyway */
slapi_log_error (SLAPI_LOG_FATAL, repl_plugin_name_cl, "cl5: %s\n", buffer);
@@ -4549,7 +4567,10 @@ static int _cl5GetEntryCount (CL5DBFile *file)
return CL5_SUCCESS;
case DB_NOTFOUND: file->entryCount = 0;
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 3300
+
+#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 4300
+ rc = file->db->stat(file->db, NULL, (void*)&stats, 0);
+#elif 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 3300
rc = file->db->stat(file->db, (void*)&stats, 0);
#else
rc = file->db->stat(file->db, (void*)&stats, malloc, 0);
diff --git a/ldap/servers/slapd/back-ldbm/dbhelp.c b/ldap/servers/slapd/back-ldbm/dbhelp.c
index 9efd7642..ca69f164 100644
--- a/ldap/servers/slapd/back-ldbm/dbhelp.c
+++ b/ldap/servers/slapd/back-ldbm/dbhelp.c
@@ -225,7 +225,11 @@ void dblayer_set_env_debugging(DB_ENV *pEnv, dblayer_private *priv)
{
pEnv->set_errpfx(pEnv, "ns-slapd");
if (priv->dblayer_verbose) {
+#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 4300
+ /* DB_VERB_CHKPOINT removed in 43 */
+#else
pEnv->set_verbose(pEnv, DB_VERB_CHKPOINT, 1); /* 1 means on */
+#endif
pEnv->set_verbose(pEnv, DB_VERB_DEADLOCK, 1); /* 1 means on */
pEnv->set_verbose(pEnv, DB_VERB_RECOVERY, 1); /* 1 means on */
pEnv->set_verbose(pEnv, DB_VERB_WAITSFOR, 1); /* 1 means on */
diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c
index ed871791..9b5a3ba1 100644
--- a/ldap/servers/slapd/back-ldbm/dblayer.c
+++ b/ldap/servers/slapd/back-ldbm/dblayer.c
@@ -325,7 +325,12 @@ static void dblayer_reset_env(struct ldbminfo *li)
}
/* Callback function for libdb to spit error info into our log */
+#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 4300
+void dblayer_log_print(const DB_ENV *dbenv, const char* prefix,
+ const char *buffer)
+#else
void dblayer_log_print(const char* prefix, char *buffer)
+#endif
{
/* We ignore the prefix since we know who we are anyway */
LDAPDebug(LDAP_DEBUG_ANY,"libdb: %s\n", buffer, 0, 0);
@@ -400,6 +405,16 @@ static int dblayer_seek24_large(int fd, size_t pgsize, db_pgno_t pageno,
return (ret < 0) ? errno : 0;
}
+/* Helper function for large seeks, db4.3 */
+static int dblayer_seek43_large(int fd, off64_t offset, int whence)
+{
+ int ret = 0;
+
+ ret = lseek64(fd, offset, whence);
+
+ return (ret < 0) ? errno : 0;
+}
+
/* helper function for large fstat -- this depends on 'struct stat64' having
* the following members:
* off64_t st_size;
@@ -464,7 +479,11 @@ static int dblayer_override_libdb_functions(DB_ENV *pEnv, dblayer_private *priv)
#endif /* !irix */
db_env_set_func_ioinfo(dblayer_ioinfo_large);
db_env_set_func_exists((int (*)())dblayer_exists_large);
+#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 4300
+ db_env_set_func_seek((int (*)())dblayer_seek43_large);
+#else
db_env_set_func_seek((int (*)())dblayer_seek24_large);
+#endif
LDAPDebug(LDAP_DEBUG_TRACE, "Enabled 64-bit files\n", 0, 0, 0);
#endif /* DB_USE_64LFS */
diff --git a/ldap/servers/slapd/back-ldbm/dblayer.h b/ldap/servers/slapd/back-ldbm/dblayer.h
index 9b774b6a..5c94f746 100644
--- a/ldap/servers/slapd/back-ldbm/dblayer.h
+++ b/ldap/servers/slapd/back-ldbm/dblayer.h
@@ -170,7 +170,12 @@ struct dblayer_private
int dblayer_lock_config;
};
+#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 4300
+void dblayer_log_print(const DB_ENV *dbenv, const char* prefix,
+ const char *buffer);
+#else
void dblayer_log_print(const char* prefix, char *buffer);
+#endif
int dblayer_db_remove(dblayer_private_env * env, char const path[], char const dbName[]);