A while back I tested NDS 7.0 with libdb43 while investigating some performance issues, below are the minor changes I made to make it work plus a note about them: BTW, some changes were necessary to run with db4.3 and maybe they will apply when you upgrade to db4.4 too. The changes implement some of the API updates in libdb4.3 documented here. http://www.sleepycat.com/docs/ref/upgrade.4.3/intro.html Note: The verbose logging fix is just to get it to compile, verbose checkpointing will be broken. Index: plugins/replication/cl5_api.c =================================================================== RCS file: /repository/source/ldap/ns/netsite/ldap/servers/plugins/replication/cl5_api.c,v retrieving revision 1.1.1.5 diff -u -4 -r1.1.1.5 cl5_api.c --- cl5_api.c 2005/03/17 22:13:22 1.1.1.5 +++ cl5_api.c 2005/07/05 20:55:15 @@ -321,9 +321,9 @@ static int _cl5UpdateRUV (Object *obj, CSN *csn, PRBool newReplica, PRBool purge); static int _cl5GetRUV2Purge2 (Object *fileObj, RUV **ruv); /* db error processing */ -static void _cl5DBLogPrint(const char* prefix, char *buffer); +static void _cl5DBLogPrint(const DB_ENV *dbenv, const char* prefix, const char *buffer); /* bakup/recovery, import/export */ static PRBool _cl5IsLogFile (const char *name); static int _cl5Recover (int open_flags, DB_ENV *dbEnv); @@ -341,9 +341,9 @@ static Object* _cl5GetReplica (const slapi_operation_parameters *op, const char* replGen); static int _cl5FileEndsWith(const char *filename, const char *ext); /* Callback function for libdb to spit error info into our log */ -static void dblayer_log_print(const char* prefix, char *buffer) +static void dblayer_log_print(const DB_ENV *dbenv, const char* prefix, const char *buffer) { /* 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); } @@ -3697,9 +3697,8 @@ if (s_cl5Desc.dbConfig.verbose) { int on = 1; - dbEnv->set_verbose(dbEnv, DB_VERB_CHKPOINT, on); dbEnv->set_verbose(dbEnv, DB_VERB_DEADLOCK, on); dbEnv->set_verbose(dbEnv, DB_VERB_RECOVERY, on); dbEnv->set_verbose(dbEnv, DB_VERB_WAITSFOR, on); } @@ -3711,9 +3710,9 @@ dbEnv->set_alloc(dbEnv, malloc, realloc, free); #endif } -static void _cl5DBLogPrint(const char* prefix, char *buffer) +static void _cl5DBLogPrint(const DB_ENV *dbenv, const char* prefix, const char *buffer) { /* 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); } @@ -4451,9 +4450,9 @@ return CL5_SUCCESS; case DB_NOTFOUND: file->entryCount = 0; #if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 3300 - rc = file->db->stat(file->db, (void*)&stats, 0); + rc = file->db->stat(file->db, NULL, (void*)&stats, 0); #else rc = file->db->stat(file->db, (void*)&stats, malloc, 0); #endif if (rc != 0) Index: slapd/back-ldbm/dblayer.c =================================================================== RCS file: /repository/source/ldap/ns/netsite/ldap/servers/slapd/back-ldbm/dblayer.c,v retrieving revision 1.1.1.8 diff -u -4 -r1.1.1.8 dblayer.c --- dblayer.c 2005/03/17 22:14:08 1.1.1.8 +++ dblayer.c 2005/07/05 20:44:13 @@ -284,9 +284,9 @@ pEnv->remove(pEnv, home_dir, DB_FORCE); } /* Callback function for libdb to spit error info into our log */ -static void dblayer_log_print(const char* prefix, char *buffer) +static void dblayer_log_print(const DB_ENV *dbenv, const char* prefix, const char *buffer) { /* We ignore the prefix since we know who we are anyway */ LDAPDebug(LDAP_DEBUG_ANY,"libdb: %s\n", buffer, 0, 0); } @@ -359,8 +359,18 @@ 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; * long st_blksize; @@ -423,9 +433,9 @@ db_env_set_func_open((int (*)(const char *, int, ...))dblayer_open_large); #endif /* !irix */ db_env_set_func_ioinfo(dblayer_ioinfo_large); db_env_set_func_exists((int (*)())dblayer_exists_large); - db_env_set_func_seek((int (*)())dblayer_seek24_large); + db_env_set_func_seek((int (*)())dblayer_seek43_large); LDAPDebug(LDAP_DEBUG_TRACE, "Enabled 64-bit files\n", 0, 0, 0); #endif /* DB_USE_64LFS */ return 0; @@ -611,9 +621,8 @@ pEnv->set_lk_max_locks(pEnv, priv->dblayer_lock_config); pEnv->set_lk_max_objects(pEnv, priv->dblayer_lock_config); pEnv->set_lk_max_lockers(pEnv, priv->dblayer_lock_config); if (priv->dblayer_verbose) { - pEnv->set_verbose(pEnv, DB_VERB_CHKPOINT, 1); /* 1 means on */ 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 */ } info:
Exposing this bug to the wider FDS audience. We are going to try to get this into Fedora soon. New URL due to Oracle acquisition: http://www.oracle.com/technology/documentation/berkeley-db/db/ref/upgrade.4.3/toc.html We'll also have to change the code so that the changes are isolated by version e.g. #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 Because we will need to be able to support building our code against multiple bdb versions.
Created attachment 141287 [details] diffs
Created attachment 141288 [details] diffs
Comment on attachment 141287 [details] diffs whoops
Created attachment 141291 [details] cvs commit log Reviewed by: nkinder (Thanks!) Files: see diff Branch: HEAD 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
Just mark as verified upstream