Commit 2d030dd5 authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul Committed by Yoni Fogel

Make {{{test_set_lk_max_locks}}} run again. Refs #2952. [t:2952]

git-svn-id: file:///svn/toku/tokudb@24988 c7de825b-a66e-492c-adef-691d508d4ae1
parent 0184f80a
...@@ -15,6 +15,12 @@ ...@@ -15,6 +15,12 @@
// ENVDIR is defined in the Makefile // ENVDIR is defined in the Makefile
#ifdef TOKUDB
#define EXTRA_LOCK_NEEDED 2
#else
#define EXTRA_LOCK_NEEDED 0
#endif
static void make_db (int n_locks) { static void make_db (int n_locks) {
DB_ENV *env; DB_ENV *env;
DB *db; DB *db;
...@@ -26,10 +32,12 @@ static void make_db (int n_locks) { ...@@ -26,10 +32,12 @@ static void make_db (int n_locks) {
CKERR(r); CKERR(r);
r=toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0); r=toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0);
r=db_env_create(&env, 0); assert(r==0); r=db_env_create(&env, 0); assert(r==0);
#ifdef TOKUDB
r = env->set_redzone(env, 0); assert(r == 0); r = env->set_redzone(env, 0); assert(r == 0);
#endif
env->set_errfile(env, 0); env->set_errfile(env, 0);
if (n_locks>0) { if (n_locks>0) {
r=env->set_lk_max_locks(env, n_locks+2); CKERR(r); r=env->set_lk_max_locks(env, n_locks+EXTRA_LOCK_NEEDED); CKERR(r);
/* test the get_lk_max_locks method */ /* test the get_lk_max_locks method */
u_int32_t set_locks; u_int32_t set_locks;
#ifdef TOKUDB #ifdef TOKUDB
...@@ -38,7 +46,7 @@ static void make_db (int n_locks) { ...@@ -38,7 +46,7 @@ static void make_db (int n_locks) {
assert(r == EINVAL); assert(r == EINVAL);
#endif #endif
r=env->get_lk_max_locks(env, &set_locks); r=env->get_lk_max_locks(env, &set_locks);
assert(r == 0 && set_locks == (u_int32_t)n_locks+2); assert(r == 0 && set_locks == (u_int32_t)n_locks+EXTRA_LOCK_NEEDED);
} }
r=env->open(env, ENVDIR, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r=env->open(env, ENVDIR, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r=db_create(&db, env, 0); CKERR(r); r=db_create(&db, env, 0); CKERR(r);
...@@ -53,7 +61,7 @@ static void make_db (int n_locks) { ...@@ -53,7 +61,7 @@ static void make_db (int n_locks) {
#else #else
u_int32_t datasize = 1; u_int32_t datasize = 1;
#endif #endif
int effective_n_locks = (n_locks<0) ? 998 : n_locks; int effective_n_locks = (n_locks<0) ? 1000-EXTRA_LOCK_NEEDED : n_locks;
// create even numbered keys 0 2 4 ... (effective_n_locks*32-2) // create even numbered keys 0 2 4 ... (effective_n_locks*32-2)
r=env->txn_begin(env, 0, &tid, 0); CKERR(r); r=env->txn_begin(env, 0, &tid, 0); CKERR(r);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment