The number of db4 objects iin use is related to the maximum number of
keys we return at once. Configure the locking subsystem accordingly
and limit the number of returned keys to maxkeys.
Significantly improves the reliability of the db4 backend on a large
busy server.
int i = 0;
u_int32_t flags = 0;
struct stat statbuf;
int i = 0;
u_int32_t flags = 0;
struct stat statbuf;
snprintf(buf, sizeof(buf) - 1, "%s/%s", config.db_dir,
DB4_UPGRADE_FILE);
snprintf(buf, sizeof(buf) - 1, "%s/%s", config.db_dir,
DB4_UPGRADE_FILE);
+ /*
+ * Up the number of locks we're allowed at once. We base this on
+ * the maximum number of keys we're going to return.
+ */
+ maxlocks = config.maxkeys * 16;
+ if (maxlocks < 1000) {
+ maxlocks = 1000;
+ }
+ dbenv->set_lk_max_locks(dbenv, maxlocks);
+ dbenv->set_lk_max_objects(dbenv, maxlocks);
+
/*
* Enable deadlock detection so that we don't block indefinitely on
* anything. What we really want is simple 2 state locks, but I'm not
/*
* Enable deadlock detection so that we don't block indefinitely on
* anything. What we really want is simple 2 state locks, but I'm not
}
llfree(wordlist, NULL);
wordlist = NULL;
}
llfree(wordlist, NULL);
wordlist = NULL;
+
+ if (keylist.count > config.maxkeys) {
+ keylist.count = config.maxkeys;
+ }
db4_starttrans();
for (i = 0; i < keylist.count; i++) {
db4_starttrans();
for (i = 0; i < keylist.count; i++) {