From 6bb98b947d22d0baac6b10372cb68385bf0b12b3 Mon Sep 17 00:00:00 2001 From: Leif Walsh Date: Wed, 17 Apr 2013 00:00:03 -0400 Subject: [PATCH] [t:4356] fixed truncate part of test git-svn-id: file:///svn/toku/tokudb@38576 c7de825b-a66e-492c-adef-691d508d4ae1 --- src/tests/test4356.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/tests/test4356.c b/src/tests/test4356.c index 166d926605e..0ee36957978 100644 --- a/src/tests/test4356.c +++ b/src/tests/test4356.c @@ -57,9 +57,9 @@ setup(void) r = db->put(db, txn, &key, &val, 0); CKERR(r); } - r = txn->commit(txn, 0); - CKERR(r); } + r = txn->commit(txn, 0); + CKERR(r); } } @@ -90,19 +90,30 @@ progress_4356(void *extra, float progress) struct progress_extra_4356 *e = extra; if (!e->ran_operation && progress > 0.5) { if (e->op == REMOVE_4356) { + DB_TXN *txn; + r = env->txn_begin(env, 0, &txn, 0); + CKERR(r); if (verbose) { printf("Running remove.\n"); } - r = db->remove(db, __FILE__".db", 0, 0); - assert(r != 0); // cannot remove a db with an open handle + r = env->dbremove(env, txn, __FILE__".db", NULL, 0); + CKERR2(r, DB_LOCK_NOTGRANTED); // cannot remove a db with an open handle if (verbose) { printf("Completed remove.\n"); } + r = txn->commit(txn, 0); + CKERR(r); } else if (e->op == TRUNCATE_4356) { + DB_TXN *txn; + r = env->txn_begin(env, 0, &txn, 0); + CKERR(r); u_int32_t row_count = 0; if (verbose) { printf("Running truncate.\n"); } - r = db->truncate(db, 0, &row_count, 0); - CKERR(r); + r = db->truncate(db, txn, &row_count, 0); + CKERR2(r, DB_LOCK_NOTGRANTED); if (verbose) { printf("Completed truncate.\n"); } + r = txn->abort(txn); + CKERR(r); } else { assert(false); } + e->ran_operation = true; } return r; }