Commit 8f327ffe authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

build with bdb refs[t:2058]

git-svn-id: file:///svn/toku/tokudb@15065 c7de825b-a66e-492c-adef-691d508d4ae1
parent 6cd0d57e
...@@ -7,12 +7,16 @@ const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG ...@@ -7,12 +7,16 @@ const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG
char *namea="a.db"; char *namea="a.db";
char *nameb="b.db"; char *nameb="b.db";
#if USE_TDB
static int my_compare(DB *UU(db), const DBT *a, const DBT *b) { static int my_compare(DB *UU(db), const DBT *a, const DBT *b) {
assert(db); assert(db);
assert(a->size == b->size); assert(a->size == b->size);
return memcmp(a->data, b->data, a->size); return memcmp(a->data, b->data, a->size);
} }
#endif
static void static void
do_x1_shutdown (BOOL do_commit, BOOL do_abort) { do_x1_shutdown (BOOL do_commit, BOOL do_abort) {
int r; int r;
...@@ -21,7 +25,9 @@ do_x1_shutdown (BOOL do_commit, BOOL do_abort) { ...@@ -21,7 +25,9 @@ do_x1_shutdown (BOOL do_commit, BOOL do_abort) {
DB_ENV *env; DB_ENV *env;
DB *dba, *dbb; DB *dba, *dbb;
r = db_env_create(&env, 0); CKERR(r); r = db_env_create(&env, 0); CKERR(r);
#if USE_TDB
r = env->set_default_bt_compare(env, my_compare); CKERR(r); r = env->set_default_bt_compare(env, my_compare); CKERR(r);
#endif
r = env->open(env, ENVDIR, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r = env->open(env, ENVDIR, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = db_create(&dba, env, 0); CKERR(r); r = db_create(&dba, env, 0); CKERR(r);
r = dba->open(dba, NULL, namea, NULL, DB_BTREE, DB_AUTO_COMMIT|DB_CREATE, 0666); CKERR(r); r = dba->open(dba, NULL, namea, NULL, DB_BTREE, DB_AUTO_COMMIT|DB_CREATE, 0666); CKERR(r);
...@@ -57,7 +63,9 @@ do_x1_recover (BOOL did_commit) { ...@@ -57,7 +63,9 @@ do_x1_recover (BOOL did_commit) {
DB *dba, *dbb; DB *dba, *dbb;
int r; int r;
r = db_env_create(&env, 0); CKERR(r); r = db_env_create(&env, 0); CKERR(r);
#if USE_TDB
r = env->set_default_bt_compare(env, my_compare); CKERR(r); r = env->set_default_bt_compare(env, my_compare); CKERR(r);
#endif
r = env->open(env, ENVDIR, envflags|DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r = env->open(env, ENVDIR, envflags|DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = db_create(&dba, env, 0); CKERR(r); r = db_create(&dba, env, 0); CKERR(r);
r = dba->open(dba, NULL, namea, NULL, DB_BTREE, DB_AUTO_COMMIT|DB_CREATE, 0666); CKERR(r); r = dba->open(dba, NULL, namea, NULL, DB_BTREE, DB_AUTO_COMMIT|DB_CREATE, 0666); 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