This is an automated email from the git hooks/post-receive script.
firstyear pushed a commit to branch master
in repository 389-ds-base.
commit c4b896dc992c89022b6752006edc7604cf0fcee2
Author: Adam Tkac <vonsch(a)gmail.com>
Date: Wed Apr 26 14:24:32 2017 +0200
Ticket 49237: Drop support for libdb older than 4.7
Bug Description:
389-ds currently supports many libdb versions which are already burried
for long time on cemetery for old code. Practically we can assume that
noone uses libdb older than 4.7 (which is present in RHEL 6). This change
makes various libdb related code more readable and understandable.
Remove unused parameter from back-ldbm/dblayer.c
https://pagure.io/389-ds-base/issue/49237
Author: Adam Tkac <vonsch(a)gmail.com>
Review by: wibrown, mreynolds (Thanks for the patch!)
---
ldap/servers/plugins/replication/cl5_api.c | 145 +-------------
ldap/servers/slapd/back-ldbm/back-ldbm.h | 7 +-
ldap/servers/slapd/back-ldbm/dbhelp.c | 5 -
ldap/servers/slapd/back-ldbm/dblayer.c | 242 ++++--------------------
ldap/servers/slapd/back-ldbm/dblayer.h | 4 -
ldap/servers/slapd/back-ldbm/idl_new.c | 151 +--------------
ldap/servers/slapd/back-ldbm/import.c | 6 -
ldap/servers/slapd/back-ldbm/monitor.c | 16 +-
ldap/servers/slapd/back-ldbm/perfctrs.c | 22 ---
ldap/servers/slapd/back-ldbm/proto-back-ldbm.h | 2 -
ldap/servers/slapd/test-plugins/testdbinterop.c | 5 -
m4/db.m4 | 8 +
12 files changed, 57 insertions(+), 556 deletions(-)
diff --git a/ldap/servers/plugins/replication/cl5_api.c
b/ldap/servers/plugins/replication/cl5_api.c
index 58d13b3..f11e903 100644
--- a/ldap/servers/plugins/replication/cl5_api.c
+++ b/ldap/servers/plugins/replication/cl5_api.c
@@ -67,18 +67,7 @@
#define HASH_BACKETS_COUNT 16 /* number of buckets in a hash table */
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 4100
-#define USE_DB_TXN 1 /* use transactions */
#define DEFAULT_DB_ENV_OP_FLAGS DB_AUTO_COMMIT
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR <= 4300
-/* we are enabling transactions everywhere - since we are opening databases
- with DB_AUTO_COMMIT we must either open and pass a valid txn handle to
- all operations that modify the database (put, del) or we must pass the
- DB_AUTO_COMMIT flag to those operations */
-#define DEFAULT_DB_OP_FLAGS(txn) (txn ? 0 : DB_AUTO_COMMIT)
-#else
-#define DEFAULT_DB_OP_FLAGS(txn) 0
-#endif
#define DB_OPEN(oflags, db, txnid, file, database, type, flags, mode, rval) \
{ \
if (((oflags) & DB_INIT_TXN) && ((oflags) & DB_INIT_LOG))
\
@@ -90,45 +79,12 @@
(rval) = (db)->open((db), (txnid), (file), (database), (type), (flags), (mode)); \
} \
}
-#else /* older then db 41 */
-#define DEFAULT_DB_OP_FLAGS(txn) 0
-#define DB_OPEN(oflags, db, txnid, file, database, type, flags, mode, rval) \
- (rval) = (db)->open((db), (file), (database), (type), (flags), (mode))
-#endif
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 4000
-#define DB_ENV_SET_REGION_INIT(env) (env)->set_flags((env), DB_REGION_INIT, 1)
#define TXN_BEGIN(env, parent_txn, tid, flags) \
(env)->txn_begin((env), (parent_txn), (tid), (flags))
-#define TXN_COMMIT(txn, flags) (txn)->commit((txn), (flags))
+#define TXN_COMMIT(txn) (txn)->commit((txn), 0)
#define TXN_ABORT(txn) (txn)->abort(txn)
-#define MEMP_STAT(env, gsp, fsp, flags, malloc) \
- (env)->memp_stat((env), (gsp), (fsp), (flags))
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 4400 /* db4.4 or later */
-#define DB_ENV_SET_TAS_SPINS(env, tas_spins) \
- (env)->mutex_set_tas_spins((env), (tas_spins))
-#else
-#define DB_ENV_SET_TAS_SPINS(env, tas_spins) \
- (env)->set_tas_spins((env), (tas_spins))
-#endif
-
-#else /* older than db 4.0 */
-#define DB_ENV_SET_REGION_INIT(env) db_env_set_region_init(1)
-#define DB_ENV_SET_TAS_SPINS(env, tas_spins) \
- db_env_set_tas_spins((tas_spins))
-#define TXN_BEGIN(env, parent_txn, tid, flags) \
- txn_begin((env), (parent_txn), (tid), (flags))
-#define TXN_COMMIT(txn, flags) txn_commit((txn), (flags))
-#define TXN_ABORT(txn) txn_abort((txn))
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 3300
-#define MEMP_STAT(env, gsp, fsp, flags, malloc) memp_stat((env), (gsp), (fsp))
-
-#else /* older than db 3.3 */
-#define MEMP_STAT(env, gsp, fsp, flags, malloc) \
- memp_stat((env), (gsp), (fsp), (malloc))
-#endif
-#endif
/*
* The defult thread stacksize for nspr21 is 64k. For OSF, we require
* a larger stacksize as actual storage allocation is higher i.e
@@ -3551,7 +3507,6 @@ static void _cl5DoPurging (cleanruv_purge_data *purge_data)
static void
_cl5CompactDBs(void)
{
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 4400
int rc;
Object *fileObj = NULL;
CL5DBFile *dbFile = NULL;
@@ -3599,7 +3554,7 @@ bail:
rc, db_strerror(rc));
}
} else {
- rc = TXN_COMMIT (txnid, 0);
+ rc = TXN_COMMIT (txnid);
if (rc) {
slapi_log_err(SLAPI_LOG_ERR, repl_plugin_name_cl,
"_cl5CompactDBs - Failed to commit transaction; db error - %d %s\n",
@@ -3608,7 +3563,6 @@ bail:
}
PR_Unlock (s_cl5Desc.dbTrim.lock);
-#endif
return;
}
@@ -3911,7 +3865,7 @@ _cl5PurgeRID(Object *obj, ReplicaId cleaned_rid)
* Commit or abort the txn
*/
if (rc == CL5_SUCCESS || rc == CL5_NOTFOUND){
- rc = TXN_COMMIT (txnid, 0);
+ rc = TXN_COMMIT (txnid);
if (rc != 0){
slapi_log_err(SLAPI_LOG_ERR, repl_plugin_name_cl,
"_cl5PurgeRID - Failed to commit transaction; db error - %d %s. "
@@ -4095,7 +4049,7 @@ static void _cl5TrimFile (Object *obj, long *numToTrim)
}
else
{
- rc = TXN_COMMIT (txnid, 0);
+ rc = TXN_COMMIT (txnid);
if (rc != 0)
{
finished = 1;
@@ -4197,7 +4151,7 @@ static int _cl5ReadRUV (const char *replGen, Object *obj, PRBool
purge)
/* delete the entry; it is re-added when file
is successfully closed */
- file->db->del (file->db, NULL, &key, DEFAULT_DB_OP_FLAGS(NULL));
+ file->db->del (file->db, NULL, &key, 0);
rc = CL5_SUCCESS;
goto done;
@@ -4258,31 +4212,11 @@ static int _cl5WriteRUV (CL5DBFile *file, PRBool purge)
return rc;
}
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR < 4100
- rc = txn_begin(s_cl5Desc.dbEnv, NULL, &txnid, 0);
- if (rc != 0)
- {
- slapi_log_err(SLAPI_LOG_ERR, repl_plugin_name_cl,
- "_cl5WriteRUV - Failed to begin transaction; db error - %d %s\n",
- rc, db_strerror(rc));
- return CL5_DB_ERROR;
- }
-#endif
- rc = file->db->put(file->db, txnid, &key, &data,
DEFAULT_DB_OP_FLAGS(txnid));
+ rc = file->db->put(file->db, txnid, &key, &data, 0);
slapi_ch_free (&(data.data));
if ( rc == 0 )
{
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR < 4100
- rc = txn_commit (txnid, 0);
- if (rc != 0)
- {
- slapi_log_err(SLAPI_LOG_ERR, repl_plugin_name_cl,
- "_cl5WriteRUV - Failed to commit transaction; db error - %d %s\n",
- rc, db_strerror(rc));
- return CL5_DB_ERROR;
- }
-#endif
return CL5_SUCCESS;
}
else
@@ -4296,15 +4230,6 @@ static int _cl5WriteRUV (CL5DBFile *file, PRBool purge)
cl5_set_diskfull();
return CL5_DB_ERROR;
}
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR < 4100
- rc = txn_abort (txnid);
- if (rc != 0)
- {
- slapi_log_err(SLAPI_LOG_ERR, repl_plugin_name_cl,
- "_cl5WriteRUV - Failed to abort transaction; db error - %d %s\n",
- rc, db_strerror(rc));
- }
-#endif
return CL5_DB_ERROR;
}
}
@@ -4593,7 +4518,7 @@ static int _cl5GetEntryCount (CL5DBFile *file)
/* delete the entry. the entry is re-added when file
is successfully closed */
- file->db->del (file->db, NULL, &key, DEFAULT_DB_OP_FLAGS(NULL));
+ file->db->del (file->db, NULL, &key, 0);
slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name_cl,
"_cl5GetEntryCount - %d changes for replica %s\n",
file->entryCount, file->replName);
@@ -4601,13 +4526,7 @@ static int _cl5GetEntryCount (CL5DBFile *file)
case DB_NOTFOUND: file->entryCount = 0;
-#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,
(void *)slapi_ch_malloc, 0);
-#endif
if (rc != 0)
{
slapi_log_err(SLAPI_LOG_ERR, repl_plugin_name_cl,
@@ -4647,29 +4566,9 @@ static int _cl5WriteEntryCount (CL5DBFile *file)
data.data = (void*)&file->entryCount;
data.size = sizeof (file->entryCount);
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR < 4100
- rc = txn_begin(s_cl5Desc.dbEnv, NULL, &txnid, 0);
- if (rc != 0)
- {
- slapi_log_err(SLAPI_LOG_ERR, repl_plugin_name_cl,
- "_cl5WriteEntryCount - Failed to begin transaction; db error - %d %s\n",
- rc, db_strerror(rc));
- return CL5_DB_ERROR;
- }
-#endif
- rc = file->db->put(file->db, txnid, &key, &data,
DEFAULT_DB_OP_FLAGS(txnid));
+ rc = file->db->put(file->db, txnid, &key, &data, 0);
if (rc == 0)
{
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR < 4100
- rc = txn_commit (txnid, 0);
- if (rc != 0)
- {
- slapi_log_err(SLAPI_LOG_ERR, repl_plugin_name_cl,
- "_cl5WriteEntryCount - Failed to commit transaction; db error - %d %s\n",
- rc, db_strerror(rc));
- return CL5_DB_ERROR;
- }
-#endif
return CL5_SUCCESS;
}
else
@@ -4683,15 +4582,6 @@ static int _cl5WriteEntryCount (CL5DBFile *file)
cl5_set_diskfull();
return CL5_DB_ERROR;
}
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR < 4100
- rc = txn_abort (txnid);
- if (rc != 0)
- {
- slapi_log_err(SLAPI_LOG_ERR, repl_plugin_name_cl,
- "_cl5WriteEntryCount - Failed to abort transaction; db error - %d
%s\n",
- rc, db_strerror(rc));
- }
-#endif
return CL5_DB_ERROR;
}
}
@@ -5130,7 +5020,6 @@ static int _cl5WriteOperationTxn(const char *replName, const char
*replGen,
{
if (cnt != 0)
{
-#if USE_DB_TXN
/* abort previous transaction */
rc = TXN_ABORT (txnid);
if (rc != 0)
@@ -5141,12 +5030,10 @@ static int _cl5WriteOperationTxn(const char *replName, const char
*replGen,
rc = CL5_DB_ERROR;
goto done;
}
-#endif
/* back off */
interval = PR_MillisecondsToInterval(slapi_rand() % 100);
DS_Sleep(interval);
}
-#if USE_DB_TXN
/* begin transaction */
rc = TXN_BEGIN(s_cl5Desc.dbEnv, parent_txnid, &txnid, 0);
if (rc != 0)
@@ -5157,13 +5044,12 @@ static int _cl5WriteOperationTxn(const char *replName, const char
*replGen,
rc = CL5_DB_ERROR;
goto done;
}
-#endif
if ( file->sema )
{
PR_WaitSemaphore(file->sema);
}
- rc = file->db->put(file->db, txnid, &key, data,
DEFAULT_DB_OP_FLAGS(txnid));
+ rc = file->db->put(file->db, txnid, &key, data, 0);
if ( file->sema )
{
PR_PostSemaphore(file->sema);
@@ -5196,9 +5082,7 @@ static int _cl5WriteOperationTxn(const char *replName, const char
*replGen,
if (rc == 0) /* we successfully added entry */
{
-#if USE_DB_TXN
- rc = TXN_COMMIT (txnid, 0);
-#endif
+ rc = TXN_COMMIT (txnid);
}
else
{
@@ -5207,7 +5091,6 @@ static int _cl5WriteOperationTxn(const char *replName, const char
*replGen,
"_cl5WriteOperationTxn - Failed to write entry with csn (%s); "
"db error - %d %s\n", csn_as_string(op->csn,PR_FALSE,s),
rc, db_strerror(rc));
-#if USE_DB_TXN
rc = TXN_ABORT (txnid);
if (rc != 0)
{
@@ -5215,7 +5098,6 @@ static int _cl5WriteOperationTxn(const char *replName, const char
*replGen,
"_cl5WriteOperationTxn - Failed to abort transaction; db error - %d
%s\n",
rc, db_strerror(rc));
}
-#endif
rc = CL5_DB_ERROR;
goto done;
}
@@ -6247,13 +6129,6 @@ static int _cl5NewDBFile (const char *replName, const char
*replGen, CL5DBFile**
goto out;
}
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR < 3300
- rc = db->set_malloc(db, (void *)slapi_ch_malloc);
- if (0 != rc) {
- goto out;
- }
-#endif
-
DB_OPEN(s_cl5Desc.dbEnvOpenFlags,
db, NULL /* txnid */, name, subname, DB_BTREE,
DB_CREATE | DB_THREAD, s_cl5Desc.dbConfig.fileMode, rc);
diff --git a/ldap/servers/slapd/back-ldbm/back-ldbm.h
b/ldap/servers/slapd/back-ldbm/back-ldbm.h
index 0bb15e3..88a91ed 100644
--- a/ldap/servers/slapd/back-ldbm/back-ldbm.h
+++ b/ldap/servers/slapd/back-ldbm/back-ldbm.h
@@ -73,12 +73,9 @@ typedef unsigned short u_int16_t;
#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 5000
#define LDBM_SUFFIX_OLD ".db4"
#define LDBM_SUFFIX ".db"
-#elif 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 4000
+#else
#define LDBM_SUFFIX_OLD ".db3"
#define LDBM_SUFFIX ".db4"
-#else /* not supported anymore, though */
-#define LDBM_SUFFIX_OLD ".db2"
-#define LDBM_SUFFIX ".db3"
#endif
#define MEGABYTE (1024 * 1024)
@@ -409,9 +406,7 @@ typedef struct attrcrypt_private attrcrypt_private;
#define INDEX_SUBSTREND 2
typedef int (*dup_compare_fn_type)(
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 3200
DB *db,
-#endif
const DBT *,const DBT *);
struct index_idlistsizeinfo {
diff --git a/ldap/servers/slapd/back-ldbm/dbhelp.c
b/ldap/servers/slapd/back-ldbm/dbhelp.c
index 9892185..bee7bf6 100644
--- a/ldap/servers/slapd/back-ldbm/dbhelp.c
+++ b/ldap/servers/slapd/back-ldbm/dbhelp.c
@@ -270,11 +270,6 @@ 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 979323a..f69c80e 100644
--- a/ldap/servers/slapd/back-ldbm/dblayer.c
+++ b/ldap/servers/slapd/back-ldbm/dblayer.c
@@ -55,8 +55,6 @@
dblayer_release_id2entry()
dblayer_release_index_file()
-
-
*/
#ifdef HAVE_CONFIG_H
@@ -69,7 +67,6 @@
#include <sys/types.h>
#include <sys/statvfs.h>
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 4100
#define DB_OPEN(oflags, db, txnid, file, database, type, flags, mode, rval) \
{ \
if (((oflags) & DB_INIT_TXN) && ((oflags) & DB_INIT_LOG))
\
@@ -81,19 +78,7 @@
(rval) = ((db)->open)((db), (txnid), (file), (database), (type), (flags),
(mode)); \
} \
}
-/* 608145: db4.1 and newer does not require exclusive lock for checkpointing
- * and transactions */
-#define DB_CHECKPOINT_LOCK(use_lock, lock) ;
-#define DB_CHECKPOINT_UNLOCK(use_lock, lock) ;
-#else /* older then db 41 */
-#define DB_OPEN(oflags, db, txnid, file, database, type, flags, mode, rval) \
- (rval) = (db)->open((db), (file), (database), (type), (flags), (mode))
-#define DB_CHECKPOINT_LOCK(use_lock, lock) if(use_lock) slapi_rwlock_wrlock(lock);
-#define DB_CHECKPOINT_UNLOCK(use_lock, lock) if(use_lock) slapi_rwlock_unlock(lock);
-#endif
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 4000
-#define DB_ENV_SET_REGION_INIT(env) (env)->set_flags((env), DB_REGION_INIT, 1)
#define TXN_BEGIN(env, parent_txn, tid, flags) \
(env)->txn_begin((env), (parent_txn), (tid), (flags))
#define TXN_COMMIT(txn, flags) (txn)->commit((txn), (flags))
@@ -107,42 +92,6 @@
#define LOG_ARCHIVE(env, listp, flags, malloc) \
(env)->log_archive((env), (listp), (flags))
#define LOG_FLUSH(env, lsn) (env)->log_flush((env), (lsn))
-#define LOCK_DETECT(env, flags, atype, aborted) \
- (env)->lock_detect((env), (flags), (atype), (aborted))
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 4400 /* db4.4 or later */
-#define DB_ENV_SET_TAS_SPINS(env, tas_spins) \
- (env)->mutex_set_tas_spins((env), (tas_spins))
-#else /* < 4.4 */
-#define DB_ENV_SET_TAS_SPINS(env, tas_spins) \
- (env)->set_tas_spins((env), (tas_spins))
-#endif /* 4.4 or later */
-#else /* older than db 4.0 */
-#define DB_ENV_SET_REGION_INIT(env) db_env_set_region_init(1)
-#define DB_ENV_SET_TAS_SPINS(env, tas_spins) \
- db_env_set_tas_spins((tas_spins))
-#define TXN_BEGIN(env, parent_txn, tid, flags) \
- txn_begin((env), (parent_txn), (tid), (flags))
-#define TXN_COMMIT(txn, flags) txn_commit((txn), (flags))
-#define TXN_ABORT(txn) txn_abort((txn))
-#define TXN_CHECKPOINT(env, kbyte, min, flags) \
- txn_checkpoint((env), (kbyte), (min), (flags))
-#define MEMP_TRICKLE(env, pct, nwrotep) memp_trickle((env), (pct), (nwrotep))
-#define LOG_FLUSH(env, lsn) log_flush((env), (lsn))
-#define LOCK_DETECT(env, flags, atype, aborted) \
- lock_detect((env), (flags), (atype), (aborted))
-
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 3300
-#define MEMP_STAT(env, gsp, fsp, flags, malloc) memp_stat((env), (gsp), (fsp))
-#define LOG_ARCHIVE(env, listp, flags, malloc) \
- log_archive((env), (listp), (flags))
-
-#else /* older than db 3.3 */
-#define MEMP_STAT(env, gsp, fsp, flags, malloc) \
- memp_stat((env), (gsp), (fsp), (malloc))
-#define LOG_ARCHIVE(env, listp, flags, malloc) \
- log_archive((env), (listp), (flags), (malloc))
-#endif
-#endif
/* Use these macros to incr/decrement the thread count for the
database housekeeping threads. This ensures that the
@@ -424,16 +373,14 @@ dblayer_get_batch_txn_max_sleep(void *arg __attribute__((unused)))
{
static int
dblayer_txn_checkpoint(struct ldbminfo *li, struct dblayer_private_env *env,
- PRBool use_lock __attribute__((unused)), PRBool busy_skip, PRBool
db_force)
+ PRBool busy_skip, PRBool db_force)
{
int ret = 0;
if (busy_skip && is_anyinstance_busy(li))
{
return ret;
}
- DB_CHECKPOINT_LOCK(use_lock, env->dblayer_env_lock);
ret = TXN_CHECKPOINT(env->dblayer_DB_ENV, db_force?DB_FORCE:0,0,0);
- DB_CHECKPOINT_UNLOCK(use_lock, env->dblayer_env_lock);
return ret;
}
@@ -503,12 +450,7 @@ 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 __attribute__((unused)), const char* prefix
__attribute__((unused)),
- const char *buffer)
-#else
-void dblayer_log_print(const char* prefix __attribute__((unused)), char *buffer)
-#endif
+void dblayer_log_print(const DB_ENV *dbenv __attribute__((unused)), const char* prefix
__attribute__((unused)), const char *buffer)
{
/* We ignore the prefix since we know who we are anyway */
slapi_log_err(SLAPI_LOG_ERR,"libdb","%s\n", (char *)buffer);
@@ -569,8 +511,6 @@ int dblayer_open_huge_file(const char *path, int oflag, int mode)
return dblayer_open_large(path, oflag, (mode_t)mode);
}
-
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 4300
/* Helper function for large seeks, db4.3 */
static int dblayer_seek43_large(int fd, off64_t offset, int whence)
{
@@ -580,20 +520,6 @@ static int dblayer_seek43_large(int fd, off64_t offset, int whence)
return (ret < 0) ? errno : 0;
}
-#else
-/* Helper function for large seeks, db2.4 */
-static int dblayer_seek24_large(int fd, size_t pgsize, db_pgno_t pageno,
- u_long relative, int isrewind, int whence)
-{
- off64_t offset = 0, ret;
-
- offset = (off64_t)pgsize * pageno + relative;
- if (isrewind) offset = -offset;
- ret = lseek64(fd, offset, whence);
-
- return (ret < 0) ? errno : 0;
-}
-#endif
/* helper function for large fstat -- this depends on 'struct stat64' having
* the following members:
@@ -659,11 +585,7 @@ static int dblayer_override_libdb_functions(DB_ENV *pEnv
__attribute__((unused))
#endif /* !irix */
db_env_set_func_ioinfo(dblayer_ioinfo_large);
db_env_set_func_exists(dblayer_exists_large);
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 4300
db_env_set_func_seek((int (*)(int, off_t, int))dblayer_seek43_large);
-#else
- db_env_set_func_seek((int (*)(int, off_t, int))dblayer_seek24_large);
-#endif
slapi_log_err(SLAPI_LOG_TRACE, "dblayer_override_libdb_function",
"Enabled 64-bit files\n");
#endif /* DB_USE_64LFS */
@@ -860,7 +782,6 @@ static void dblayer_init_dbenv(DB_ENV *pEnv, dblayer_private *priv)
/* increase max number of active transactions */
pEnv->set_tx_max(pEnv, priv->dblayer_tx_max);
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 3300
pEnv->set_alloc(pEnv, (void *)slapi_ch_malloc, (void *)slapi_ch_realloc,
dblayer_free);
/*
@@ -868,7 +789,6 @@ static void dblayer_init_dbenv(DB_ENV *pEnv, dblayer_private *priv)
* increased in size from the default for a large number of files.
*/
pEnv->set_lg_regionmax(pEnv, 1 * 1048576); /* 1 MB */
-#endif
}
@@ -1068,7 +988,7 @@ dblayer_make_env(struct dblayer_private_env **env, struct ldbminfo
*li)
ret);
}
- DB_ENV_SET_REGION_INIT(pEnv->dblayer_DB_ENV);
+ pEnv->dblayer_DB_ENV->set_flags(pEnv->dblayer_DB_ENV, DB_REGION_INIT, 1);
/* Here we overide various system functions called by libdb */
ret = dblayer_override_libdb_functions(pEnv->dblayer_DB_ENV, priv);
@@ -1077,7 +997,8 @@ dblayer_make_env(struct dblayer_private_env **env, struct ldbminfo
*li)
}
if (priv->dblayer_spin_count != 0) {
- DB_ENV_SET_TAS_SPINS(pEnv->dblayer_DB_ENV, priv->dblayer_spin_count);
+ pEnv->dblayer_DB_ENV->mutex_set_tas_spins(pEnv->dblayer_DB_ENV,
+ priv->dblayer_spin_count);
}
dblayer_dump_config_tracing(priv);
@@ -1606,15 +1527,7 @@ dblayer_start(struct ldbminfo *li, int dbmode)
if ((!priv->dblayer_durable_transactions) ||
((priv->dblayer_enable_transactions) && (trans_batch_limit > 0))){
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 3200
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 4100 /* db4.1 and newer */
pEnv->dblayer_DB_ENV->set_flags(pEnv->dblayer_DB_ENV, DB_TXN_WRITE_NOSYNC,
1);
-#else /* db3.3 */
- pEnv->dblayer_DB_ENV->set_flags(pEnv->dblayer_DB_ENV, DB_TXN_NOSYNC, 1);
-#endif
-#else /* older */
- open_flags |= DB_TXN_NOSYNC;
-#endif
}
/* ldbm2index uses transactions but sets the transaction flag to off - we
need to dblayer_init_pvt_txn in that case */
@@ -2045,15 +1958,6 @@ int dblayer_instance_start(backend *be, int mode)
goto out;
}
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR < 3300
- return_value = dbp->set_malloc(dbp, (void *)slapi_ch_malloc);
- if (0 != return_value) {
- slapi_log_err(SLAPI_LOG_ERR, "dblayer_instance_start",
"dbp->set_malloc failed %d\n",
- return_value);
-
- goto out;
- }
-#endif
if ((charray_get_index(priv->dblayer_data_directories,
inst->inst_parent_dir_name) != 0) &&
!dblayer_inst_exists(inst, NULL))
@@ -2083,15 +1987,6 @@ int dblayer_instance_start(backend *be, int mode)
goto out;
}
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR < 3300
- return_value = dbp->set_malloc(dbp, (void *)slapi_ch_malloc);
- if (0 != return_value) {
- slapi_log_err(SLAPI_LOG_ERR, "dblayer_instance_start",
"dbp->set_malloc failed %d\n",
- return_value);
-
- goto out;
- }
-#endif
slapi_ch_free_string(&abs_id2entry_file);
}
DB_OPEN(mypEnv->dblayer_openflags,
@@ -2123,16 +2018,6 @@ int dblayer_instance_start(backend *be, int mode)
goto out;
}
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR == 4100
- /* lower the buffer cache priority to avoid sleep in memp_alloc */
- /* W/ DB_PRIORITY_LOW, the db buffer page priority is calculated as:
- * priority = lru_count + pages / (-1)
- * (by default, priority = lru_count)
- * When upgraded to db4.2, this setting may not needed, hopefully.
- * ask sleepycat [#8301]; blackflag #619964
- */
- dbp->set_cache_priority(dbp, DB_PRIORITY_LOW);
-#endif
out:
slapi_ch_free_string(&id2entry_file);
}
@@ -2792,11 +2677,6 @@ _dblayer_set_db_callbacks(dblayer_private *priv, DB *dbp, struct
attrinfo *ai)
if (rc)
return rc;
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR < 3300
- rc = dbp->set_malloc(dbp, (void *)slapi_ch_malloc);
- if (rc)
- return rc;
-#endif
/*
* If using the "new" idl, set the flags and the compare function.
* If using the "old" idl, we still need to set the index DB flags
@@ -2967,16 +2847,6 @@ dblayer_open_file(backend *be, char* indexname, int open_flag,
DB_OPEN(pENV->dblayer_openflags,
dbp, NULL, /* txnid */ rel_path, subname, DB_BTREE,
open_flags, priv->dblayer_file_mode, return_value);
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR == 4100
- /* lower the buffer cache priority to avoid sleep in memp_alloc */
- /* W/ DB_PRIORITY_LOW, the db buffer page priority is calculated as:
- * priority = lru_count + pages / (-1)
- * (by default, priority = lru_count)
- * When upgraded to db4.2, this setting may not needed, hopefully.
- * ask sleepycat [#8301]; blackflag #619964
- */
- dbp->set_cache_priority(dbp, DB_PRIORITY_LOW);
-#endif
out:
slapi_ch_free((void**)&file_name);
slapi_ch_free((void**)&rel_path);
@@ -4262,7 +4132,8 @@ static int deadlock_threadmain(void *param)
if (dblayer_db_uses_locking(db_env) && (deadlock_policy >
DB_LOCK_NORUN)) {
int rejected = 0;
- if ((rval = LOCK_DETECT(db_env, flags, deadlock_policy, &rejected))
!= 0) {
+ rval = db_env->lock_detect(db_env, flags, deadlock_policy,
&rejected);
+ if (rval != 0) {
slapi_log_err(SLAPI_LOG_CRIT,
"deadlock_threadmain", "Serious
Error---Failed in deadlock detect (aborted at 0x%x), err=%d (%s)\n",
rejected, rval, dblayer_strerror(rval));
@@ -4443,9 +4314,7 @@ static int checkpoint_threadmain(void *param)
char **list = NULL;
char **listp = NULL;
struct dblayer_private_env *penv = NULL;
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 4400
time_t time_of_last_comapctdb_completion = current_time(); /* seconds since epoch
*/
-#endif
int compactdb_interval = 0;
back_txn txn;
@@ -4501,62 +4370,42 @@ static int checkpoint_threadmain(void *param)
checkpoint_debug_message(debug_checkpointing,
"checkpoint_threadmain - Starting
checkpoint\n");
rval = dblayer_txn_checkpoint(li, priv->dblayer_env,
- PR_TRUE, PR_TRUE, PR_FALSE);
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR < 4100
- if (DB_INCOMPLETE == rval)
- {
- checkpoint_debug_message(debug_checkpointing,
- "checkpoint_threadmain - Retrying
checkpoint\n");
- } else
-#endif
- {
- checkpoint_debug_message(debug_checkpointing,
- "checkpoint_threadmain - Checkpoint
Done\n");
- if (rval != 0) {
- /* bad error */
- slapi_log_err(SLAPI_LOG_CRIT,
- "checkpoint_threadmain", "Serious Error---Failed to
checkpoint database, "
- "err=%d (%s)\n", rval, dblayer_strerror(rval));
- if (LDBM_OS_ERR_IS_DISKFULL(rval)) {
- operation_out_of_disk_space();
- goto error_return;
- }
- } else {
- time_of_last_checkpoint_completion = current_time();
+ PR_TRUE, PR_FALSE);
+ checkpoint_debug_message(debug_checkpointing,
+ "checkpoint_threadmain - Checkpoint Done\n");
+ if (rval != 0) {
+ /* bad error */
+ slapi_log_err(SLAPI_LOG_CRIT,
+ "checkpoint_threadmain", "Serious Error---Failed to
checkpoint database, "
+ "err=%d (%s)\n", rval, dblayer_strerror(rval));
+ if (LDBM_OS_ERR_IS_DISKFULL(rval)) {
+ operation_out_of_disk_space();
+ goto error_return;
}
+ } else {
+ time_of_last_checkpoint_completion = current_time();
}
checkpoint_debug_message(debug_checkpointing,
"checkpoint_threadmain - Starting
checkpoint\n");
rval = dblayer_txn_checkpoint(li, priv->dblayer_env,
- PR_TRUE, PR_TRUE, PR_FALSE);
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR < 4100
- if (DB_INCOMPLETE == rval)
- {
- checkpoint_debug_message(debug_checkpointing,
- "checkpoint_threadmain - Retrying
checkpoint\n");
- } else
-#endif
- {
- checkpoint_debug_message(debug_checkpointing,
- "checkpoint_threadmain - Checkpoint
Done\n");
- if (rval != 0) {
- /* bad error */
- slapi_log_err(SLAPI_LOG_CRIT,
- "checkpoint_threadmain", "Serious Error---Failed to
checkpoint database, "
- "err=%d (%s)\n", rval, dblayer_strerror(rval));
- if (LDBM_OS_ERR_IS_DISKFULL(rval)) {
- operation_out_of_disk_space();
- goto error_return;
- }
- } else {
- time_of_last_checkpoint_completion = current_time();
+ PR_TRUE, PR_FALSE);
+ checkpoint_debug_message(debug_checkpointing,
+ "checkpoint_threadmain - Checkpoint Done\n");
+ if (rval != 0) {
+ /* bad error */
+ slapi_log_err(SLAPI_LOG_CRIT,
+ "checkpoint_threadmain", "Serious Error---Failed to
checkpoint database, "
+ "err=%d (%s)\n", rval, dblayer_strerror(rval));
+ if (LDBM_OS_ERR_IS_DISKFULL(rval)) {
+ operation_out_of_disk_space();
+ goto error_return;
}
+ } else {
+ time_of_last_checkpoint_completion = current_time();
}
/* find out which log files don't contain active txns */
- DB_CHECKPOINT_LOCK(PR_TRUE, penv->dblayer_env_lock);
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 4400
/* Compacting DB borrowing the timing of the log flush */
if ((compactdb_interval > 0) &&
(current_time() - time_of_last_comapctdb_completion > compactdb_interval))
{
@@ -4607,11 +4456,9 @@ static int checkpoint_threadmain(void *param)
time_of_last_comapctdb_completion = current_time(); /* seconds since epoch
*/
compactdb_interval = priv->dblayer_compactdb_interval;
}
-#endif
rval = LOG_ARCHIVE(penv->dblayer_DB_ENV, &list,
DB_ARCH_ABS, (void *)slapi_ch_malloc);
- DB_CHECKPOINT_UNLOCK(PR_TRUE, penv->dblayer_env_lock);
if (rval) {
slapi_log_err(SLAPI_LOG_ERR, "checkpoint_threadmain",
"log archive failed - %s (%d)\n",
@@ -5133,31 +4980,12 @@ static int dblayer_force_checkpoint(struct ldbminfo *li)
*/
for (i = 0; i < 2; i++) {
- ret = dblayer_txn_checkpoint(li, pEnv, PR_TRUE, PR_FALSE, PR_TRUE);
- if (ret == 0) continue;
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR < 4100
- if (ret != DB_INCOMPLETE)
-#endif
- {
+ ret = dblayer_txn_checkpoint(li, pEnv, PR_FALSE, PR_TRUE);
+ if (ret != 0) {
slapi_log_err(SLAPI_LOG_ERR, "dblayer_force_checkpoint",
"Checkpoint FAILED, error %s (%d)\n",
dblayer_strerror(ret), ret);
break;
}
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR < 4100
-
- slapi_log_err(SLAPI_LOG_NOTICE, "dblayer_force_checkpoint", "Busy:
retrying checkpoint\n");
-
- /* teletubbies: "again! again!" */
- ret = dblayer_txn_checkpoint(li, pEnv, PR_TRUE, PR_FALSE, PR_TRUE);
- if (ret == DB_INCOMPLETE) {
- slapi_log_err(SLAPI_LOG_NOTICE, "dblayer_force_checkpoint", "Busy:
giving up on checkpoint\n");
- break;
- } else if (ret != 0) {
- slapi_log_err(SLAPI_LOG_ERR, "Cdblayer_force_checkpoint",
"Checkpoint FAILED, error %s (%d)\n",
- dblayer_strerror(ret), ret);
- break;
- }
-#endif
}
}
diff --git a/ldap/servers/slapd/back-ldbm/dblayer.h
b/ldap/servers/slapd/back-ldbm/dblayer.h
index 77b04fa..fe0689a 100644
--- a/ldap/servers/slapd/back-ldbm/dblayer.h
+++ b/ldap/servers/slapd/back-ldbm/dblayer.h
@@ -151,12 +151,8 @@ struct dblayer_private
int dblayer_compactdb_interval; /* interval to execute compact id2entry dbs */
};
-#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[]);
diff --git a/ldap/servers/slapd/back-ldbm/idl_new.c
b/ldap/servers/slapd/back-ldbm/idl_new.c
index 94bc7c6..1ffdc03 100644
--- a/ldap/servers/slapd/back-ldbm/idl_new.c
+++ b/ldap/servers/slapd/back-ldbm/idl_new.c
@@ -16,7 +16,7 @@
/* Note to future editors:
This file is now full of redundant code
- (the DB_ALLIDS_ON_WRITE==true and DB_USE_BULK_FETCH==false code).
+ (the DB_ALLIDS_ON_WRITE==true).
It should be stripped out at the beginning of a
major release cycle.
*/
@@ -25,13 +25,8 @@
static char* filename = "idl_new.c";
-/* Bulk fetch feature first in DB 3.3 */
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 3300
#define DB_USE_BULK_FETCH 1
#define BULK_FETCH_BUFFER_SIZE (8*1024)
-#else
-#undef DB_USE_BULK_FETCH
-#endif
/* We used to implement allids for inserts, but that's a bad idea.
Why ? Because:
@@ -44,13 +39,6 @@ static char* filename = "idl_new.c";
/* We still enforce allids threshold on reads, to save time and space fetching vast id
lists */
#define DB_ALLIDS_ON_READ 1
-#if !defined(DB_NEXT_DUP)
-#define DB_NEXT_DUP 0
-#endif
-#if !defined(DB_GET_BOTH)
-#define DB_GET_BOTH 0
-#endif
-
/* Structure used to hide private idl-specific data in the attrinfo object */
struct idl_private {
size_t idl_allidslimit;
@@ -145,12 +133,10 @@ idl_new_fetch(
DBT data;
ID id = 0;
size_t count = 0;
-#ifdef DB_USE_BULK_FETCH
/* beware that a large buffer on the stack might cause a stack overflow on some
platforms */
char buffer[BULK_FETCH_BUFFER_SIZE];
void *ptr;
DBT dataret;
-#endif
back_txn s_txn;
struct ldbminfo *li = (struct ldbminfo *)be->be_database->plg_private;
@@ -173,18 +159,11 @@ idl_new_fetch(
goto error;
}
memset(&data, 0, sizeof(data));
-#ifdef DB_USE_BULK_FETCH
data.ulen = sizeof(buffer);
data.size = sizeof(buffer);
data.data = buffer;
data.flags = DB_DBT_USERMEM;
memset(&dataret, 0, sizeof(dataret));
-#else
- data.ulen = sizeof(id);
- data.size = sizeof(id);
- data.data = &id;
- data.flags = DB_DBT_USERMEM;
-#endif
/*
* We're not expecting the key to change in value
@@ -198,28 +177,21 @@ idl_new_fetch(
key.flags = DB_DBT_USERMEM;
/* Position cursor at the first matching key */
-#ifdef DB_USE_BULK_FETCH
ret = cursor->c_get(cursor,&key,&data,DB_SET|DB_MULTIPLE);
-#else
- ret = cursor->c_get(cursor,&key,&data,DB_SET);
-#endif
if (0 != ret) {
if (DB_NOTFOUND != ret) {
-#ifdef DB_USE_BULK_FETCH
if (ret == DB_BUFFER_SMALL) {
slapi_log_err(SLAPI_LOG_ERR, "idl_new_fetch", "Database
index is corrupt; "
"data item for key %s is too large for our buffer "
"(need=%d actual=%d)\n",
(char *)key.data, data.size, data.ulen);
}
-#endif
ldbm_nasty("idl_new_fetch",filename,2,ret);
}
goto error; /* Not found is OK, return NULL IDL */
}
/* Iterate over the duplicates, amassing them into an IDL */
-#ifdef DB_USE_BULK_FETCH
for (;;) {
ID lastid = 0;
@@ -281,33 +253,7 @@ idl_new_fetch(
if (0 != ret) {
break;
}
- }
-#else
- for (;;) {
- ret = cursor->c_get(cursor,&key,&data,DB_NEXT_DUP);
- count++;
- if (0 != ret) {
- break;
- }
- /* we got another ID, add it to our IDL */
- idl_rc = idl_append_extend(&idl, id);
- if (idl_rc) {
- slapi_log_err(SLAPI_LOG_ERR,
- "idl_new_fetch", "Unable to extend id list
(err=%d)\n", idl_rc);
- idl_free(&idl);
- goto error;
- }
-#if defined(DB_ALLIDS_ON_READ)
- /* enforce the allids read limit */
- if (idl && idl_new_exceeds_allidslimit(count, a, allidslimit)) {
- idl->b_nids = 1;
- idl->b_ids[0] = ALLID;
- ret = DB_NOTFOUND; /* fool the code below into thinking that we finished the
dups */
- break;
- }
-#endif
- }
-#endif
+ }
if (ret != DB_NOTFOUND) {
idl_free(&idl);
@@ -392,12 +338,10 @@ idl_new_range_fetch(
DBT data = {0};
ID id = 0;
size_t count = 0;
-#ifdef DB_USE_BULK_FETCH
/* beware that a large buffer on the stack might cause a stack overflow on some
platforms */
char buffer[BULK_FETCH_BUFFER_SIZE];
void *ptr;
DBT dataret;
-#endif
back_txn s_txn;
struct ldbminfo *li = (struct ldbminfo *)be->be_database->plg_private;
time_t curtime;
@@ -430,18 +374,11 @@ idl_new_range_fetch(
goto error;
}
memset(&data, 0, sizeof(data));
-#ifdef DB_USE_BULK_FETCH
data.ulen = sizeof(buffer);
data.size = sizeof(buffer);
data.data = buffer;
data.flags = DB_DBT_USERMEM;
memset(&dataret, 0, sizeof(dataret));
-#else
- data.ulen = sizeof(id);
- data.size = sizeof(id);
- data.data = &id;
- data.flags = DB_DBT_USERMEM;
-#endif
/*
* We're not expecting the key to change in value
@@ -456,27 +393,20 @@ idl_new_range_fetch(
cur_key.flags = DB_DBT_MALLOC;
/* Position cursor at the first matching key */
-#ifdef DB_USE_BULK_FETCH
ret = cursor->c_get(cursor, &cur_key, &data, DB_SET|DB_MULTIPLE);
-#else
- ret = cursor->c_get(cursor, &cur_key, &data, DB_SET);
-#endif
if (0 != ret) {
if (DB_NOTFOUND != ret) {
-#ifdef DB_USE_BULK_FETCH
if (ret == DB_BUFFER_SMALL) {
slapi_log_err(SLAPI_LOG_ERR, "idl_new_range_fetch",
"Database index is corrupt; "
"data item for key %s is too large for our buffer (need=%d
actual=%d)\n",
(char *)cur_key.data, data.size, data.ulen);
}
-#endif
ldbm_nasty("idl_new_range_fetch",filename,2,ret);
}
goto error; /* Not found is OK, return NULL IDL */
}
/* Iterate over the duplicates, amassing them into an IDL */
-#ifdef DB_USE_BULK_FETCH
while (cur_key.data &&
(upperkey && upperkey->data ?
((coreop == SLAPI_OP_LESS) ?
@@ -622,81 +552,6 @@ idl_new_range_fetch(
}
}
}
-#else
- while (upperkey && upperkey->data ?
- ((coreop == SLAPI_OP_LESS) ?
- DBTcmp(&cur_key, upperkey, ai->ai_key_cmp_fn) < 0 :
- DBTcmp(&cur_key, upperkey, ai->ai_key_cmp_fn) <= 0) :
- PR_TRUE /* e.g., (x > a) */) {
- /* lookthrough limit & sizelimit check */
- if (idl) {
- if ((lookthrough_limit != -1) &&
- (idl->b_nids > (ID)lookthrough_limit)) {
- idl_free(&idl);
- idl = idl_allids( be );
- slapi_log_err(SLAPI_LOG_TRACE,
- "idl_new_range_fetch", "lookthrough_limit
exceeded\n");
- *flag_err = LDAP_ADMINLIMIT_EXCEEDED;
- goto error;
- }
- if ((sizelimit > 0) && (idl->b_nids > (ID)sizelimit)) {
- slapi_log_err(SLAPI_LOG_TRACE,
- "idl_new_range_fetch", "sizelimit
exceeded\n");
- *flag_err = LDAP_SIZELIMIT_EXCEEDED;
- goto error;
- }
- }
- /* timelimit check */
- if (stoptime > 0) { /* timelimit is set */
- curtime = current_time();
- if (curtime >= stoptime) {
- slapi_log_err(SLAPI_LOG_TRACE,
- "idl_new_range_fetch", "timelimit
exceeded\n");
- *flag_err = LDAP_TIMELIMIT_EXCEEDED;
- goto error;
- }
- }
- ret = cursor->c_get(cursor,&cur_key,&data,DB_NEXT_DUP);
- if (saved_key != cur_key.data) {
- /* key was allocated in c_get */
- slapi_ch_free(&saved_key);
- saved_key = cur_key.data;
- }
- count++;
- if (ret) {
- if (upperkey && upperkey->data && DBT_EQ(&cur_key,
upperkey)) {
- /* this is the last key */
- break;
- }
- ret = cursor->c_get(cursor, &cur_key, &data, DB_NEXT_NODUP);
- if (saved_key != cur_key.data) {
- /* key was allocated in c_get */
- slapi_ch_free(&saved_key);
- saved_key = cur_key.data;
- }
- if (ret) {
- break;
- }
- }
- /* we got another ID, add it to our IDL */
- idl_rc = idl_append_extend(&idl, id);
- if (idl_rc) {
- slapi_log_err(SLAPI_LOG_ERR, "idl_new_range_fetch",
- "Unable to extend id list (err=%d)\n", idl_rc);
- idl_free(&idl);
- goto error;
- }
-#if defined(DB_ALLIDS_ON_READ)
- /* enforce the allids read limit */
- if (idl && idl_new_exceeds_allidslimit(count, ai, allidslimit)) {
- idl->b_nids = 1;
- idl->b_ids[0] = ALLID;
- ret = DB_NOTFOUND; /* fool the code below into thinking that we finished the
dups */
- break;
- }
-#endif
- }
-#endif
if (ret) {
if (ret == DB_NOTFOUND) {
@@ -1111,9 +966,7 @@ error:
/* idl_new_compare_dups: comparing ID, pass to libdb for callback */
int idl_new_compare_dups(
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 3200
DB *db __attribute__((unused)),
-#endif
const DBT *a,
const DBT *b
)
diff --git a/ldap/servers/slapd/back-ldbm/import.c
b/ldap/servers/slapd/back-ldbm/import.c
index 8b07939..3839337 100644
--- a/ldap/servers/slapd/back-ldbm/import.c
+++ b/ldap/servers/slapd/back-ldbm/import.c
@@ -590,12 +590,6 @@ out:
if (mpstat)
slapi_ch_free((void **)&mpstat);
if (mpfstat) {
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR + DB_VERSION_PATCH <= 3204
- /* In DB 3.2.4 and earlier, we need to free each element */
- DB_MPOOL_FSTAT **tfsp;
- for (tfsp = mpfstat; *tfsp; tfsp++)
- slapi_ch_free((void **)tfsp);
-#endif
slapi_ch_free((void **)&mpfstat);
}
return cache_hit_ratio;
diff --git a/ldap/servers/slapd/back-ldbm/monitor.c
b/ldap/servers/slapd/back-ldbm/monitor.c
index 678e45a..726ea91 100644
--- a/ldap/servers/slapd/back-ldbm/monitor.c
+++ b/ldap/servers/slapd/back-ldbm/monitor.c
@@ -206,12 +206,6 @@ int ldbm_back_monitor_instance_search(Slapi_PBlock *pb
__attribute__((unused)),
}
slapi_ch_free_string(&absolute_pathname);
-
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR + DB_VERSION_PATCH <= 3204
- /* In DB 3.2.4 and earlier, we need to free each element */
- for (i = 0; mpfstat[i]; i++)
- slapi_ch_free((void **)&mpfstat[i]);
-#endif
slapi_ch_free((void **)&mpfstat);
*returncode = LDAP_SUCCESS;
@@ -269,16 +263,8 @@ int ldbm_back_monitor_search(Slapi_PBlock *pb, Slapi_Entry *e,
slapi_ch_free((void **)&mpstat);
- if (mpfstat) {
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR + DB_VERSION_PATCH <= 3204
- /* In DB 3.2.4 and earlier, we need to free each element */
- int i;
- for (i = 0; mpfstat[i]; i++) {
- slapi_ch_free((void **)&mpfstat[i]);
- }
-#endif
+ if (mpfstat)
slapi_ch_free((void **)&mpfstat);
- }
*returncode = LDAP_SUCCESS;
return SLAPI_DSE_CALLBACK_OK;
diff --git a/ldap/servers/slapd/back-ldbm/perfctrs.c
b/ldap/servers/slapd/back-ldbm/perfctrs.c
index a52021d..d77ce63 100644
--- a/ldap/servers/slapd/back-ldbm/perfctrs.c
+++ b/ldap/servers/slapd/back-ldbm/perfctrs.c
@@ -16,7 +16,6 @@
#include "perfctrs.h"
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 4000
#define TXN_STAT(env, statp, flags, malloc) \
(env)->txn_stat((env), (statp), (flags))
#define MEMP_STAT(env, gsp, fsp, flags, malloc) \
@@ -24,28 +23,7 @@
#define LOG_STAT(env, spp, flags, malloc) (env)->log_stat((env), (spp), (flags))
#define LOCK_STAT(env, statp, flags, malloc) \
(env)->lock_stat((env), (statp), (flags))
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 4400 /* db4.4 or later */
#define GET_N_LOCK_WAITS(lockstat) lockstat->st_lock_wait
-#else
-#define GET_N_LOCK_WAITS(lockstat) lockstat->st_nconflicts
-#endif
-
-#else /* older than db 4.0 */
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 3300
-#define TXN_STAT(env, statp, flags, malloc) txn_stat((env), (statp))
-#define MEMP_STAT(env, gsp, fsp, flags, malloc) memp_stat((env), (gsp), (fsp))
-#define LOG_STAT(env, spp, flags, malloc) log_stat((env), (spp))
-#define LOCK_STAT(env, statp, flags, malloc) lock_stat((env), (statp))
-#define GET_N_LOCK_WAITS(lockstat) lockstat->st_nconflicts
-#else /* older than db 3.3 */
-#define TXN_STAT(env, statp, flags, malloc) txn_stat((env), (statp), (malloc))
-#define MEMP_STAT(env, gsp, fsp, flags, malloc)
- memp_stat((env), (gsp), (fsp), (malloc))
-#define LOG_STAT(env, spp, flags, malloc) log_stat((env), (spp), (malloc))
-#define LOCK_STAT(env, statp, flags, malloc) lock_stat((env), (statp), (malloc))
-#define GET_N_LOCK_WAITS(lockstat) lockstat->st_nconflicts
-#endif
-#endif
static void perfctrs_update(perfctrs_private *priv, DB_ENV *db_env);
static void perfctr_add_to_entry( Slapi_Entry *e, char *type,
diff --git a/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
b/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
index 86ef5cb..ca2ff7b 100644
--- a/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
+++ b/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
@@ -272,9 +272,7 @@ int idl_get_tune(void);
size_t idl_get_allidslimit(struct attrinfo *a, int allidslimit);
int idl_get_idl_new(void);
int idl_new_compare_dups(
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 3200
DB *db,
-#endif
const DBT *a,
const DBT *b
);
diff --git a/ldap/servers/slapd/test-plugins/testdbinterop.c
b/ldap/servers/slapd/test-plugins/testdbinterop.c
index 04b0b9d..2729bd9 100644
--- a/ldap/servers/slapd/test-plugins/testdbinterop.c
+++ b/ldap/servers/slapd/test-plugins/testdbinterop.c
@@ -26,13 +26,8 @@ static PRLock *db_lock=NULL;
static int number_of_keys=100;
static int key_buffer_size = 8000;
-#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 4100
#define DB_OPEN(db, txnid, file, database, type, flags, mode) \
(db)->open((db), (txnid), (file), (database), (type), (flags), (mode))
-#else
- (db)->open((db), (file), (database), (type), (flags), (mode))
-#endif
-
DB *dbp=NULL;
diff --git a/m4/db.m4 b/m4/db.m4
index d1f3bde..c916c2b 100644
--- a/m4/db.m4
+++ b/m4/db.m4
@@ -99,6 +99,14 @@ dnl figure out which version of db we're using from the header
file
db_ver_maj=`grep DB_VERSION_MAJOR $db_incdir/db.h | awk '{print $3}'`
db_ver_min=`grep DB_VERSION_MINOR $db_incdir/db.h | awk '{print $3}'`
db_ver_pat=`grep DB_VERSION_PATCH $db_incdir/db.h | awk '{print $3}'`
+
+dnl Ensure that we have libdb at least 4.7, older versions aren't supported
+if test ${db_ver_maj} -lt 4; then
+ AC_MSG_ERROR([Found db ${db_ver_maj}.${db_ver_min} is too old, update to version 4.7 at
least])
+elif test ${db_ver_maj} -eq 4 -a ${db_ver_min} -lt 7; then
+ AC_MSG_ERROR([Found db ${db_ver_maj}.${db_ver_min} is too old, update to version 4.7 at
least])
+fi
+
dnl libname is libdb-maj.min e.g. libdb-4.2
db_libver=${db_ver_maj}.${db_ver_min}
dnl make sure the lib is available
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.