Commit a1329eca authored by Rich Prohaska's avatar Rich Prohaska

fix the nightly regressions. port the 838 test to BDB. addresses #838

git-svn-id: file:///svn/tokudb@4514 c7de825b-a66e-492c-adef-691d508d4ae1
parent 5d1b6f98
...@@ -331,6 +331,9 @@ void test_838_defer_delete_commit(int n) { ...@@ -331,6 +331,9 @@ void test_838_defer_delete_commit(int n) {
assert(r == 0); assert(r == 0);
} }
int expectr = 0;
// walk // walk
{ {
DB_TXN *txn; DB_TXN *txn;
...@@ -343,7 +346,14 @@ void test_838_defer_delete_commit(int n) { ...@@ -343,7 +346,14 @@ void test_838_defer_delete_commit(int n) {
gettimeofday(&tstart, 0); gettimeofday(&tstart, 0);
DBT key, val; DBT key, val;
r = cursor->c_get(cursor, dbt_init_malloc(&key), dbt_init_malloc(&val), DB_FIRST); r = cursor->c_get(cursor, dbt_init_malloc(&key), dbt_init_malloc(&val), DB_FIRST);
#if USE_TDB
assert(r == DB_LOCK_NOTGRANTED); assert(r == DB_LOCK_NOTGRANTED);
#elif USE_BDB
assert(r == DB_RUNRECOVERY);
expectr = r;
#else
#error
#endif
gettimeofday(&tnow, 0); gettimeofday(&tnow, 0);
unsigned long long t = tnow.tv_sec * 1000000ULL + tnow.tv_usec; unsigned long long t = tnow.tv_sec * 1000000ULL + tnow.tv_usec;
t -= tstart.tv_sec * 1000000ULL + tstart.tv_usec; t -= tstart.tv_sec * 1000000ULL + tstart.tv_usec;
...@@ -355,18 +365,18 @@ void test_838_defer_delete_commit(int n) { ...@@ -355,18 +365,18 @@ void test_838_defer_delete_commit(int n) {
testresult = 1; testresult = 1;
} }
r = cursor->c_close(cursor); assert(r == 0); r = cursor->c_close(cursor); assert(r == 0);
r = txn->commit(txn, 0); assert(r == 0); r = txn->commit(txn, 0); assert(r == expectr);
} }
// delete commit // delete commit
r = txn_delete->commit(txn_delete, 0); assert(r == 0); r = txn_delete->commit(txn_delete, 0); assert(r == expectr);
r = txn_master_delete->commit(txn_master_delete, 0); assert(r == 0); r = txn_master_delete->commit(txn_master_delete, 0); assert(r == expectr);
// close db // close db
r = db->close(db, 0); assert(r == 0); r = db->close(db, 0); assert(r == expectr);
// reopen and walk // reopen and walk
{ if (expectr == 0) {
DB_TXN *txn = 0; DB_TXN *txn = 0;
r = env->txn_begin(env, 0, &txn, 0); assert(r == 0); r = env->txn_begin(env, 0, &txn, 0); assert(r == 0);
...@@ -375,7 +385,7 @@ void test_838_defer_delete_commit(int n) { ...@@ -375,7 +385,7 @@ void test_838_defer_delete_commit(int n) {
r = txn->commit(txn, 0); assert(r == 0); r = txn->commit(txn, 0); assert(r == 0);
} }
{ if (expectr == 0) {
DB_TXN *txn; DB_TXN *txn;
r = env->txn_begin(env, 0, &txn, 0); assert(r == 0); r = env->txn_begin(env, 0, &txn, 0); assert(r == 0);
DBC *cursor; DBC *cursor;
...@@ -402,7 +412,7 @@ void test_838_defer_delete_commit(int n) { ...@@ -402,7 +412,7 @@ void test_838_defer_delete_commit(int n) {
} }
// close env // close env
r = env->close(env, 0); assert(r == 0); r = env->close(env, 0); assert(r == expectr);
} }
int main(int argc, const char *argv[]) { int main(int argc, const char *argv[]) {
......
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