Commit 689ce075 authored by Rich Prohaska's avatar Rich Prohaska

test_txn_cursor_last.bdb blocks the main thread. lets not run it

git-svn-id: file:///svn/tokudb@2895 c7de825b-a66e-492c-adef-691d508d4ae1
parent 0bd3a4e6
...@@ -47,7 +47,7 @@ void test_txn_cursor_last_1(int nrows) { ...@@ -47,7 +47,7 @@ void test_txn_cursor_last_1(int nrows) {
/* create the dup database file */ /* create the dup database file */
r = db_env_create(&env, 0); assert(r == 0); r = db_env_create(&env, 0); assert(r == 0);
env->set_errfile(env, stderr); env->set_errfile(env, stderr);
r = env->open(env, ENVDIR, DB_CREATE|DB_INIT_MPOOL|DB_INIT_TXN|DB_INIT_LOCK|DB_INIT_LOG|DB_THREAD|DB_PRIVATE, 0777); CKERR(r); r = env->open(env, ENVDIR, DB_CREATE|DB_INIT_MPOOL|DB_INIT_TXN|DB_INIT_LOCK|DB_INIT_LOG |DB_THREAD |DB_PRIVATE, 0777); CKERR(r);
r = db_create(&db, env, 0); assert(r == 0); r = db_create(&db, env, 0); assert(r == 0);
db->set_errfile(db,stderr); // Turn off those annoying errors db->set_errfile(db,stderr); // Turn off those annoying errors
r = db->open(db, null_txn, fname, "main", DB_BTREE, DB_CREATE+DB_AUTO_COMMIT, 0666); assert(r == 0); r = db->open(db, null_txn, fname, "main", DB_BTREE, DB_CREATE+DB_AUTO_COMMIT, 0666); assert(r == 0);
...@@ -62,14 +62,14 @@ void test_txn_cursor_last_1(int nrows) { ...@@ -62,14 +62,14 @@ void test_txn_cursor_last_1(int nrows) {
DB_TXN *t1; DB_TXN *t1;
r = env->txn_begin(env, null_txn, &t1, 0); assert(r == 0); r = env->txn_begin(env, null_txn, &t1, 0); assert(r == 0);
printf("t1:begin\n"); if (verbose) printf("t1:begin\n");
DBC *c1; DBC *c1;
r = db->cursor(db, t1, &c1, 0); assert(r == 0); r = db->cursor(db, t1, &c1, 0); assert(r == 0);
DB_TXN *t2; DB_TXN *t2;
r = env->txn_begin(env, null_txn, &t2, 0); assert(r == 0); r = env->txn_begin(env, null_txn, &t2, 0); assert(r == 0);
printf("t2:begin\n"); if (verbose) printf("t2:begin\n");
DBC *c2; DBC *c2;
r = db->cursor(db, t2, &c2, 0); assert(r == 0); r = db->cursor(db, t2, &c2, 0); assert(r == 0);
...@@ -77,37 +77,37 @@ void test_txn_cursor_last_1(int nrows) { ...@@ -77,37 +77,37 @@ void test_txn_cursor_last_1(int nrows) {
DBT k1; memset(&k1, 0, sizeof k1); DBT k1; memset(&k1, 0, sizeof k1);
DBT v1; memset(&v1, 0, sizeof v1); DBT v1; memset(&v1, 0, sizeof v1);
r = c1->c_get(c1, &k1, &v1, DB_LAST); r = c1->c_get(c1, &k1, &v1, DB_LAST);
printf("c1:last:%s\n", db_error(r)); if (verbose) printf("c1:last:%s\n", db_error(r));
r = c1->c_close(c1); assert(r == 0); r = c1->c_close(c1); assert(r == 0);
DBT k2; memset(&k2, 0, sizeof k2); DBT k2; memset(&k2, 0, sizeof k2);
DBT v2; memset(&v2, 0, sizeof v2); DBT v2; memset(&v2, 0, sizeof v2);
r = c2->c_get(c2, &k2, &v2, DB_LAST); r = c2->c_get(c2, &k2, &v2, DB_LAST);
printf("c2:last:%s\n", db_error(r)); if (verbose) printf("c2:last:%s\n", db_error(r));
r = c2->c_close(c2); assert(r == 0); r = c2->c_close(c2); assert(r == 0);
int r1 = db_put(db, t1, htonl(nrows), htonl(nrows)); int r1 = db_put(db, t1, htonl(nrows), htonl(nrows));
printf("t1:put:%s\n", db_error(r1)); if (verbose) printf("t1:put:%s\n", db_error(r1));
int r2 = db_put(db, t2, htonl(nrows), htonl(nrows)); int r2 = db_put(db, t2, htonl(nrows), htonl(nrows));
printf("t2:put:%s\n", db_error(r2)); if (verbose) printf("t2:put:%s\n", db_error(r2));
if (r1 == 0) { if (r1 == 0) {
r = t1->commit(t1, 0); r = t1->commit(t1, 0);
printf("t1:commit:%s\n", db_error(r)); if (verbose) printf("t1:commit:%s\n", db_error(r));
} else { } else {
r = t1->abort(t1); r = t1->abort(t1);
printf("t1:abort:%s\n", db_error(r)); if (verbose) printf("t1:abort:%s\n", db_error(r));
} }
if (r2 == 0) { if (r2 == 0) {
r = t2->commit(t2, 0); r = t2->commit(t2, 0);
printf("t2:commit:%s\n", db_error(r)); if (verbose) printf("t2:commit:%s\n", db_error(r));
} else { } else {
r = t2->abort(t2); r = t2->abort(t2);
printf("t2:abort:%s\n", db_error(r)); if (verbose) printf("t2:abort:%s\n", db_error(r));
} }
r = db->close(db, 0); assert(r == 0); r = db->close(db, 0); assert(r == 0);
...@@ -145,14 +145,14 @@ void test_txn_cursor_last_2(int nrows) { ...@@ -145,14 +145,14 @@ void test_txn_cursor_last_2(int nrows) {
DB_TXN *t1; DB_TXN *t1;
r = env->txn_begin(env, null_txn, &t1, 0); assert(r == 0); r = env->txn_begin(env, null_txn, &t1, 0); assert(r == 0);
printf("t1:begin\n"); if (verbose) printf("t1:begin\n");
DBC *c1; DBC *c1;
r = db->cursor(db, t1, &c1, 0); assert(r == 0); r = db->cursor(db, t1, &c1, 0); assert(r == 0);
DB_TXN *t2; DB_TXN *t2;
r = env->txn_begin(env, null_txn, &t2, 0); assert(r == 0); r = env->txn_begin(env, null_txn, &t2, 0); assert(r == 0);
printf("t2:begin\n"); if (verbose) printf("t2:begin\n");
DBC *c2; DBC *c2;
r = db->cursor(db, t2, &c2, 0); assert(r == 0); r = db->cursor(db, t2, &c2, 0); assert(r == 0);
...@@ -160,37 +160,37 @@ void test_txn_cursor_last_2(int nrows) { ...@@ -160,37 +160,37 @@ void test_txn_cursor_last_2(int nrows) {
DBT k1; memset(&k1, 0, sizeof k1); DBT k1; memset(&k1, 0, sizeof k1);
DBT v1; memset(&v1, 0, sizeof v1); DBT v1; memset(&v1, 0, sizeof v1);
r = c1->c_get(c1, &k1, &v1, DB_LAST); r = c1->c_get(c1, &k1, &v1, DB_LAST);
printf("c1:last:%s\n", db_error(r)); if (verbose) printf("c1:last:%s\n", db_error(r));
r = c1->c_close(c1); assert(r == 0); r = c1->c_close(c1); assert(r == 0);
int r1 = db_put(db, t1, htonl(nrows), htonl(nrows)); int r1 = db_put(db, t1, htonl(nrows), htonl(nrows));
printf("t1:put:%s\n", db_error(r1)); if (verbose) printf("t1:put:%s\n", db_error(r1));
DBT k2; memset(&k2, 0, sizeof k2); DBT k2; memset(&k2, 0, sizeof k2);
DBT v2; memset(&v2, 0, sizeof v2); DBT v2; memset(&v2, 0, sizeof v2);
r = c2->c_get(c2, &k2, &v2, DB_LAST); r = c2->c_get(c2, &k2, &v2, DB_LAST);
printf("c2:last:%s\n", db_error(r)); if (verbose) printf("c2:last:%s\n", db_error(r));
r = c2->c_close(c2); assert(r == 0); r = c2->c_close(c2); assert(r == 0);
if (r1 == 0) { if (r1 == 0) {
r = t1->commit(t1, 0); r = t1->commit(t1, 0);
printf("t1:commit:%s\n", db_error(r)); if (verbose) printf("t1:commit:%s\n", db_error(r));
} else { } else {
r = t1->abort(t1); r = t1->abort(t1);
printf("t1:abort:%s\n", db_error(r)); if (verbose) printf("t1:abort:%s\n", db_error(r));
} }
int r2 = db_put(db, t2, htonl(nrows), htonl(nrows)); int r2 = db_put(db, t2, htonl(nrows), htonl(nrows));
printf("t2:put:%s\n", db_error(r2)); if (verbose) printf("t2:put:%s\n", db_error(r2));
if (r2 == 0) { if (r2 == 0) {
r = t2->commit(t2, 0); r = t2->commit(t2, 0);
printf("t2:commit:%s\n", db_error(r)); if (verbose) printf("t2:commit:%s\n", db_error(r));
} else { } else {
r = t2->abort(t2); r = t2->abort(t2);
printf("t2:abort:%s\n", db_error(r)); if (verbose) printf("t2:abort:%s\n", db_error(r));
} }
r = db->close(db, 0); assert(r == 0); r = db->close(db, 0); assert(r == 0);
...@@ -201,10 +201,12 @@ int main(int argc, const char *argv[]) { ...@@ -201,10 +201,12 @@ int main(int argc, const char *argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
#if USE_TDB
test_txn_cursor_last_1(0); test_txn_cursor_last_1(0);
test_txn_cursor_last_1(1); test_txn_cursor_last_1(1);
test_txn_cursor_last_2(0); test_txn_cursor_last_2(0);
test_txn_cursor_last_2(1); test_txn_cursor_last_2(1);
#endif
return 0; return 0;
} }
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