Commit 455c35c0 authored by Yoni Fogel's avatar Yoni Fogel

Addresses #1381

Fix test (use transaction for cursor)

git-svn-id: file:///svn/toku/tokudb@9265 c7de825b-a66e-492c-adef-691d508d4ae1
parent af7a69f0
...@@ -20,12 +20,11 @@ DB_ENV *env; ...@@ -20,12 +20,11 @@ DB_ENV *env;
DB *db; DB *db;
DB_TXN *null_txn = NULL; DB_TXN *null_txn = NULL;
DB_TXN *txn; DB_TXN *txn;
int find_num; u_int32_t find_num;
static void static void
init(u_int32_t dup_flags) { init(u_int32_t dup_flags) {
int r; int r;
struct stat buf;
system("rm -rf " ENVDIR); system("rm -rf " ENVDIR);
r=toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r=toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r=db_env_create(&env, 0); CKERR(r); r=db_env_create(&env, 0); CKERR(r);
...@@ -121,13 +120,15 @@ verify_and_tear_down(int close_first) { ...@@ -121,13 +120,15 @@ verify_and_tear_down(int close_first) {
CKERR(r); CKERR(r);
} }
DBC *cursor; DBC *cursor;
r = db->cursor(db, 0, &cursor, 0); CKERR(r); r=env->txn_begin(env, 0, &txn, 0); CKERR(r);
int found = 0; r = db->cursor(db, txn, &cursor, 0); CKERR(r);
u_int32_t found = 0;
do { do {
r = cursor->c_getf_next(cursor, 0, do_nothing, NULL); r = cursor->c_getf_next(cursor, 0, do_nothing, NULL);
if (r==0) found++; if (r==0) found++;
} while (r==0); } while (r==0);
CKERR2(r, DB_NOTFOUND); CKERR2(r, DB_NOTFOUND);
txn->commit(txn, 0);
assert(found==find_num); assert(found==find_num);
tear_down(); tear_down();
} }
......
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