From a69c4b293553561c927a2e85b99e48628b79a12a Mon Sep 17 00:00:00 2001 From: Yoni Fogel Date: Mon, 18 Aug 2008 20:16:48 +0000 Subject: [PATCH] Cleaned up test_txn_nested_abort[23].c git-svn-id: file:///svn/tokudb@5733 c7de825b-a66e-492c-adef-691d508d4ae1 --- src/tests/test_txn_nested_abort3.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/tests/test_txn_nested_abort3.c b/src/tests/test_txn_nested_abort3.c index 1e664e74266..49739b9d20c 100644 --- a/src/tests/test_txn_nested_abort3.c +++ b/src/tests/test_txn_nested_abort3.c @@ -25,11 +25,11 @@ void test_txn_abort() { r = env->open(env, 0, DB_INIT_MPOOL | DB_INIT_LOG | DB_INIT_LOCK | DB_INIT_TXN | DB_PRIVATE | DB_CREATE, 0777); CKERR(r); + DB *db = NULL; { DB_TXN *txn = 0; r = env->txn_begin(env, 0, &txn, 0); CKERR(r); - DB *db; r = db_create(&db, env, 0); CKERR(r); r = db->open(db, txn, "test.db", 0, DB_BTREE, DB_CREATE, 0777); CKERR(r); r = txn->commit(txn, 0); CKERR(r); @@ -60,16 +60,19 @@ void test_txn_abort() { CKERR(r); - /* walk the db, should be empty */ - r = env->txn_begin(env, 0, &txn, 0); CKERR(r); - DBC *cursor; - r = db->cursor(db, txn, &cursor, 0); CKERR(r); - memset(&key, 0, sizeof key); - memset(&val, 0, sizeof val); - r = cursor->c_get(cursor, &key, &val, DB_FIRST); - CKERR2(r, DB_NOTFOUND); - r = cursor->c_close(cursor); CKERR(r); - r = txn->commit(txn, 0); + { + /* walk the db, should be empty */ + DB_TXN *txn = 0; + r = env->txn_begin(env, 0, &txn, 0); CKERR(r); + DBC *cursor; + r = db->cursor(db, txn, &cursor, 0); CKERR(r); + memset(&key, 0, sizeof key); + memset(&val, 0, sizeof val); + r = cursor->c_get(cursor, &key, &val, DB_FIRST); + CKERR2(r, DB_NOTFOUND); + r = cursor->c_close(cursor); CKERR(r); + r = txn->commit(txn, 0); + } r = db->close(db, 0); CKERR(r); r = env->close(env, 0); CKERR(r);