Commit 848d97ad authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

Expand the test for #687.

git-svn-id: file:///svn/tokudb@3403 c7de825b-a66e-492c-adef-691d508d4ae1
parent 46ffef18
...@@ -35,7 +35,11 @@ static void delete (int i) { ...@@ -35,7 +35,11 @@ static void delete (int i) {
int r = db->del(db, txn, int r = db->del(db, txn,
dbt_init(&key, hello, strlen(hello)+1), dbt_init(&key, hello, strlen(hello)+1),
DB_DELETE_ANY); DB_DELETE_ANY);
#ifdef TOKUDB
assert(r==0); assert(r==0);
#else
assert(r==DB_NOTFOUND || r==0);
#endif
} }
static void lookup (int i, int expect, int expectj) { static void lookup (int i, int expect, int expectj) {
...@@ -92,6 +96,63 @@ void test_abort3 (void) { ...@@ -92,6 +96,63 @@ void test_abort3 (void) {
lookup(2, 0, 5); lookup(2, 0, 5);
r=txn->commit(txn, 0); CKERR(r); r=txn->commit(txn, 0); CKERR(r);
r=env->txn_begin(env, 0, &txn, 0); CKERR(r);
insert(3, 0);
r=txn->commit(txn, 0); CKERR(r);
r=env->txn_begin(env, 0, &txn, 0); CKERR(r);
insert(3, 1);
lookup(3, 0, 1);
r=txn->abort(txn); CKERR(r);
r=env->txn_begin(env, 0, &txn, 0); CKERR(r);
lookup(3, 0, 0);
r=txn->commit(txn, 0); CKERR(r);
r=env->txn_begin(env, 0, &txn, 0); CKERR(r);
insert(4, 0);
r=txn->commit(txn, 0); CKERR(r);
r=env->txn_begin(env, 0, &txn, 0); CKERR(r);
delete(4);
lookup(4, DB_NOTFOUND, -1);
r=txn->abort(txn); CKERR(r);
r=env->txn_begin(env, 0, &txn, 0); CKERR(r);
lookup(4, 0, 0);
r=txn->commit(txn, 0); CKERR(r);
r=env->txn_begin(env, 0, &txn, 0); CKERR(r);
insert(5, 0);
r=txn->commit(txn, 0); CKERR(r);
r=env->txn_begin(env, 0, &txn, 0); CKERR(r);
insert(5, 1);
lookup(5, 0, 1);
delete(5);
lookup(5, DB_NOTFOUND, -1);
r=txn->abort(txn); CKERR(r);
r=env->txn_begin(env, 0, &txn, 0); CKERR(r);
lookup(5, 0, 0);
r=txn->commit(txn, 0); CKERR(r);
r=env->txn_begin(env, 0, &txn, 0); CKERR(r);
r=txn->commit(txn, 0); CKERR(r);
r=env->txn_begin(env, 0, &txn, 0); CKERR(r);
insert(6, 0);
lookup(6, 0, 0);
delete(6);
lookup(6, DB_NOTFOUND, -1);
r=txn->abort(txn); CKERR(r);
r=env->txn_begin(env, 0, &txn, 0); CKERR(r);
lookup(6, DB_NOTFOUND, -1);
r=txn->commit(txn, 0); CKERR(r);
r=db->close(db, 0); CKERR(r); r=db->close(db, 0); CKERR(r);
r=env->close(env, 0); CKERR(r); r=env->close(env, 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