Commit 5b7546ff authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

#4434 must use DB_THREAD in multi-thread BDB apps refs[t:4434]

git-svn-id: file:///svn/toku/tokudb@39168 c7de825b-a66e-492c-adef-691d508d4ae1
parent c2433901
...@@ -197,13 +197,10 @@ int test_main(int argc, char * const argv[]) { ...@@ -197,13 +197,10 @@ int test_main(int argc, char * const argv[]) {
// create the db // create the db
DB *db = NULL; DB *db = NULL;
r = db_create(&db, db_env, 0); assert(r == 0); r = db_create(&db, db_env, 0); assert(r == 0);
DB_TXN *create_txn = NULL;
r = db_env->txn_begin(db_env, NULL, &create_txn, 0); assert(r == 0);
if (pagesize) { if (pagesize) {
r = db->set_pagesize(db, pagesize); assert(r == 0); r = db->set_pagesize(db, pagesize); assert(r == 0);
} }
r = db->open(db, create_txn, db_filename, NULL, DB_BTREE, DB_CREATE, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0); r = db->open(db, NULL, db_filename, NULL, DB_BTREE, DB_CREATE|DB_AUTO_COMMIT|DB_THREAD, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
r = create_txn->commit(create_txn, 0); assert(r == 0);
// populate the db // populate the db
populate(db_env, db, nrows); populate(db_env, db, nrows);
......
...@@ -195,13 +195,10 @@ int test_main(int argc, char * const argv[]) { ...@@ -195,13 +195,10 @@ int test_main(int argc, char * const argv[]) {
// create the db // create the db
DB *db = NULL; DB *db = NULL;
r = db_create(&db, db_env, 0); assert(r == 0); r = db_create(&db, db_env, 0); assert(r == 0);
DB_TXN *create_txn = NULL;
r = db_env->txn_begin(db_env, NULL, &create_txn, 0); assert(r == 0);
if (pagesize) { if (pagesize) {
r = db->set_pagesize(db, pagesize); assert(r == 0); r = db->set_pagesize(db, pagesize); assert(r == 0);
} }
r = db->open(db, create_txn, db_filename, NULL, DB_BTREE, DB_CREATE, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0); r = db->open(db, NULL, db_filename, NULL, DB_BTREE, DB_CREATE|DB_AUTO_COMMIT|DB_THREAD, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
r = create_txn->commit(create_txn, 0); assert(r == 0);
// populate the db // populate the db
populate(db_env, db, nrows); populate(db_env, db, nrows);
......
...@@ -149,13 +149,10 @@ int test_main(int argc, char * const argv[]) { ...@@ -149,13 +149,10 @@ int test_main(int argc, char * const argv[]) {
// create the db // create the db
DB *db = NULL; DB *db = NULL;
r = db_create(&db, db_env, 0); assert(r == 0); r = db_create(&db, db_env, 0); assert(r == 0);
DB_TXN *create_txn = NULL;
r = db_env->txn_begin(db_env, NULL, &create_txn, 0); assert(r == 0);
if (pagesize) { if (pagesize) {
r = db->set_pagesize(db, pagesize); assert(r == 0); r = db->set_pagesize(db, pagesize); assert(r == 0);
} }
r = db->open(db, create_txn, db_filename, NULL, DB_BTREE, DB_CREATE, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0); r = db->open(db, NULL, db_filename, NULL, DB_BTREE, DB_CREATE|DB_AUTO_COMMIT|DB_THREAD, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
r = create_txn->commit(create_txn, 0); assert(r == 0);
run_test(db_env, db, nthreads, nrows, sleeptime); run_test(db_env, db, nthreads, nrows, sleeptime);
......
...@@ -166,13 +166,10 @@ int test_main(int argc, char * const argv[]) { ...@@ -166,13 +166,10 @@ int test_main(int argc, char * const argv[]) {
// create the db // create the db
DB *db = NULL; DB *db = NULL;
r = db_create(&db, db_env, 0); assert(r == 0); r = db_create(&db, db_env, 0); assert(r == 0);
DB_TXN *create_txn = NULL;
r = db_env->txn_begin(db_env, NULL, &create_txn, 0); assert(r == 0);
if (pagesize) { if (pagesize) {
r = db->set_pagesize(db, pagesize); assert(r == 0); r = db->set_pagesize(db, pagesize); assert(r == 0);
} }
r = db->open(db, create_txn, db_filename, NULL, DB_BTREE, DB_CREATE, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0); r = db->open(db, NULL, db_filename, NULL, DB_BTREE, DB_CREATE|DB_AUTO_COMMIT|DB_THREAD, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
r = create_txn->commit(create_txn, 0); assert(r == 0);
// populate the db // populate the db
populate(db_env, db, nrows); populate(db_env, db, nrows);
......
...@@ -166,13 +166,10 @@ int test_main(int argc, char * const argv[]) { ...@@ -166,13 +166,10 @@ int test_main(int argc, char * const argv[]) {
// create the db // create the db
DB *db = NULL; DB *db = NULL;
r = db_create(&db, db_env, 0); assert(r == 0); r = db_create(&db, db_env, 0); assert(r == 0);
DB_TXN *create_txn = NULL;
r = db_env->txn_begin(db_env, NULL, &create_txn, 0); assert(r == 0);
if (pagesize) { if (pagesize) {
r = db->set_pagesize(db, pagesize); assert(r == 0); r = db->set_pagesize(db, pagesize); assert(r == 0);
} }
r = db->open(db, create_txn, db_filename, NULL, DB_BTREE, DB_CREATE, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0); r = db->open(db, NULL, db_filename, NULL, DB_BTREE, DB_CREATE|DB_AUTO_COMMIT|DB_THREAD, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
r = create_txn->commit(create_txn, 0); assert(r == 0);
// populate the db // populate the db
populate(db_env, db, nrows); populate(db_env, db, nrows);
......
...@@ -237,13 +237,10 @@ int test_main(int argc, char * const argv[]) { ...@@ -237,13 +237,10 @@ int test_main(int argc, char * const argv[]) {
// create the db // create the db
DB *db = NULL; DB *db = NULL;
r = db_create(&db, db_env, 0); assert(r == 0); r = db_create(&db, db_env, 0); assert(r == 0);
DB_TXN *create_txn = NULL;
r = db_env->txn_begin(db_env, NULL, &create_txn, 0); assert(r == 0);
if (pagesize) { if (pagesize) {
r = db->set_pagesize(db, pagesize); assert(r == 0); r = db->set_pagesize(db, pagesize); assert(r == 0);
} }
r = db->open(db, create_txn, db_filename, NULL, DB_BTREE, DB_CREATE, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0); r = db->open(db, NULL, db_filename, NULL, DB_BTREE, DB_CREATE|DB_AUTO_COMMIT|DB_THREAD, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
r = create_txn->commit(create_txn, 0); assert(r == 0);
// populate the db // populate the db
populate(db_env, db, nrows); populate(db_env, db, nrows);
......
...@@ -231,13 +231,10 @@ int test_main(int argc, char * const argv[]) { ...@@ -231,13 +231,10 @@ int test_main(int argc, char * const argv[]) {
// create the db // create the db
DB *db = NULL; DB *db = NULL;
r = db_create(&db, db_env, 0); assert(r == 0); r = db_create(&db, db_env, 0); assert(r == 0);
DB_TXN *create_txn = NULL;
r = db_env->txn_begin(db_env, NULL, &create_txn, 0); assert(r == 0);
if (pagesize) { if (pagesize) {
r = db->set_pagesize(db, pagesize); assert(r == 0); r = db->set_pagesize(db, pagesize); assert(r == 0);
} }
r = db->open(db, create_txn, db_filename, NULL, DB_BTREE, DB_CREATE, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0); r = db->open(db, NULL, db_filename, NULL, DB_BTREE, DB_CREATE|DB_AUTO_COMMIT|DB_THREAD, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
r = create_txn->commit(create_txn, 0); assert(r == 0);
// populate the db // populate the db
populate(db_env, db, nrows); populate(db_env, db, nrows);
......
...@@ -104,13 +104,10 @@ int test_main(int argc, char * const argv[]) { ...@@ -104,13 +104,10 @@ int test_main(int argc, char * const argv[]) {
// create the db // create the db
DB *db = NULL; DB *db = NULL;
r = db_create(&db, db_env, 0); assert(r == 0); r = db_create(&db, db_env, 0); assert(r == 0);
DB_TXN *create_txn = NULL;
r = db_env->txn_begin(db_env, NULL, &create_txn, 0); assert(r == 0);
if (pagesize) { if (pagesize) {
r = db->set_pagesize(db, pagesize); assert(r == 0); r = db->set_pagesize(db, pagesize); assert(r == 0);
} }
r = db->open(db, create_txn, db_filename, NULL, DB_BTREE, DB_CREATE, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0); r = db->open(db, NULL, db_filename, NULL, DB_BTREE, DB_CREATE|DB_AUTO_COMMIT|DB_THREAD, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
r = create_txn->commit(create_txn, 0); assert(r == 0);
toku_pthread_t tids[nthreads]; toku_pthread_t tids[nthreads];
for (int i = 0; i < nthreads-1; i++) { for (int i = 0; i < nthreads-1; i++) {
......
...@@ -159,13 +159,10 @@ int test_main(int argc, char * const argv[]) { ...@@ -159,13 +159,10 @@ int test_main(int argc, char * const argv[]) {
// create the db // create the db
DB *db = NULL; DB *db = NULL;
r = db_create(&db, db_env, 0); assert(r == 0); r = db_create(&db, db_env, 0); assert(r == 0);
DB_TXN *create_txn = NULL;
r = db_env->txn_begin(db_env, NULL, &create_txn, 0); assert(r == 0);
if (pagesize) { if (pagesize) {
r = db->set_pagesize(db, pagesize); assert(r == 0); r = db->set_pagesize(db, pagesize); assert(r == 0);
} }
r = db->open(db, create_txn, db_filename, NULL, DB_BTREE, DB_CREATE, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0); r = db->open(db, NULL, db_filename, NULL, DB_BTREE, DB_CREATE|DB_AUTO_COMMIT|DB_THREAD, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
r = create_txn->commit(create_txn, 0); assert(r == 0);
// run test // run test
struct test_seq seq; test_seq_init(&seq); struct test_seq seq; test_seq_init(&seq);
......
...@@ -135,13 +135,10 @@ int test_main(int argc, char * const argv[]) { ...@@ -135,13 +135,10 @@ int test_main(int argc, char * const argv[]) {
// create the db // create the db
DB *db = NULL; DB *db = NULL;
r = db_create(&db, db_env, 0); assert(r == 0); r = db_create(&db, db_env, 0); assert(r == 0);
DB_TXN *create_txn = NULL;
r = db_env->txn_begin(db_env, NULL, &create_txn, 0); assert(r == 0);
if (pagesize) { if (pagesize) {
r = db->set_pagesize(db, pagesize); assert(r == 0); r = db->set_pagesize(db, pagesize); assert(r == 0);
} }
r = db->open(db, create_txn, db_filename, NULL, DB_BTREE, DB_CREATE, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0); r = db->open(db, NULL, db_filename, NULL, DB_BTREE, DB_CREATE|DB_AUTO_COMMIT|DB_THREAD, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
r = create_txn->commit(create_txn, 0); assert(r == 0);
// run test // run test
struct test_seq seq; test_seq_init(&seq); struct test_seq seq; test_seq_init(&seq);
......
...@@ -103,13 +103,10 @@ int test_main(int argc, char * const argv[]) { ...@@ -103,13 +103,10 @@ int test_main(int argc, char * const argv[]) {
// create the db // create the db
DB *db = NULL; DB *db = NULL;
r = db_create(&db, db_env, 0); assert(r == 0); r = db_create(&db, db_env, 0); assert(r == 0);
DB_TXN *create_txn = NULL;
r = db_env->txn_begin(db_env, NULL, &create_txn, 0); assert(r == 0);
if (pagesize) { if (pagesize) {
r = db->set_pagesize(db, pagesize); assert(r == 0); r = db->set_pagesize(db, pagesize); assert(r == 0);
} }
r = db->open(db, create_txn, db_filename, NULL, DB_BTREE, DB_CREATE, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0); r = db->open(db, NULL, db_filename, NULL, DB_BTREE, DB_CREATE|DB_AUTO_COMMIT|DB_THREAD, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
r = create_txn->commit(create_txn, 0); assert(r == 0);
toku_pthread_t tids[nthreads]; toku_pthread_t tids[nthreads];
for (int i = 0; i < nthreads-1; i++) { for (int i = 0; i < nthreads-1; i++) {
......
...@@ -176,13 +176,10 @@ int test_main(int argc, char * const argv[]) { ...@@ -176,13 +176,10 @@ int test_main(int argc, char * const argv[]) {
// create the db // create the db
DB *db = NULL; DB *db = NULL;
r = db_create(&db, db_env, 0); assert(r == 0); r = db_create(&db, db_env, 0); assert(r == 0);
DB_TXN *create_txn = NULL;
r = db_env->txn_begin(db_env, NULL, &create_txn, 0); assert(r == 0);
if (pagesize) { if (pagesize) {
r = db->set_pagesize(db, pagesize); assert(r == 0); r = db->set_pagesize(db, pagesize); assert(r == 0);
} }
r = db->open(db, create_txn, db_filename, NULL, DB_BTREE, DB_CREATE, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0); r = db->open(db, NULL, db_filename, NULL, DB_BTREE, DB_CREATE|DB_AUTO_COMMIT|DB_THREAD, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
r = create_txn->commit(create_txn, 0); assert(r == 0);
// populate the db // populate the db
populate(db_env, db, nrows); populate(db_env, db, nrows);
......
...@@ -171,13 +171,10 @@ int test_main(int argc, char * const argv[]) { ...@@ -171,13 +171,10 @@ int test_main(int argc, char * const argv[]) {
// create the db // create the db
DB *db = NULL; DB *db = NULL;
r = db_create(&db, db_env, 0); assert(r == 0); r = db_create(&db, db_env, 0); assert(r == 0);
DB_TXN *create_txn = NULL;
r = db_env->txn_begin(db_env, NULL, &create_txn, 0); assert(r == 0);
if (pagesize) { if (pagesize) {
r = db->set_pagesize(db, pagesize); assert(r == 0); r = db->set_pagesize(db, pagesize); assert(r == 0);
} }
r = db->open(db, create_txn, db_filename, NULL, DB_BTREE, DB_CREATE, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0); r = db->open(db, NULL, db_filename, NULL, DB_BTREE, DB_CREATE|DB_AUTO_COMMIT|DB_THREAD, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
r = create_txn->commit(create_txn, 0); assert(r == 0);
// populate the db // populate the db
populate(db_env, db, nrows); populate(db_env, db, nrows);
......
...@@ -174,13 +174,10 @@ int test_main(int argc, char * const argv[]) { ...@@ -174,13 +174,10 @@ int test_main(int argc, char * const argv[]) {
// create the db // create the db
DB *db = NULL; DB *db = NULL;
r = db_create(&db, db_env, 0); assert(r == 0); r = db_create(&db, db_env, 0); assert(r == 0);
DB_TXN *create_txn = NULL;
r = db_env->txn_begin(db_env, NULL, &create_txn, 0); assert(r == 0);
if (pagesize) { if (pagesize) {
r = db->set_pagesize(db, pagesize); assert(r == 0); r = db->set_pagesize(db, pagesize); assert(r == 0);
} }
r = db->open(db, create_txn, db_filename, NULL, DB_BTREE, DB_CREATE, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0); r = db->open(db, NULL, db_filename, NULL, DB_BTREE, DB_CREATE|DB_AUTO_COMMIT|DB_THREAD, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
r = create_txn->commit(create_txn, 0); assert(r == 0);
// populate the db // populate the db
populate(db_env, db, nrows); populate(db_env, db, nrows);
......
...@@ -148,13 +148,10 @@ int test_main(int argc, char * const argv[]) { ...@@ -148,13 +148,10 @@ int test_main(int argc, char * const argv[]) {
// create the db // create the db
DB *db = NULL; DB *db = NULL;
r = db_create(&db, db_env, 0); assert(r == 0); r = db_create(&db, db_env, 0); assert(r == 0);
DB_TXN *create_txn = NULL;
r = db_env->txn_begin(db_env, NULL, &create_txn, 0); assert(r == 0);
if (pagesize) { if (pagesize) {
r = db->set_pagesize(db, pagesize); assert(r == 0); r = db->set_pagesize(db, pagesize); assert(r == 0);
} }
r = db->open(db, create_txn, db_filename, NULL, DB_BTREE, DB_CREATE, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0); r = db->open(db, NULL, db_filename, NULL, DB_BTREE, DB_CREATE|DB_AUTO_COMMIT|DB_THREAD, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
r = create_txn->commit(create_txn, 0); assert(r == 0);
// populate the db // populate the db
populate(db_env, db, nrows); populate(db_env, db, nrows);
......
...@@ -97,13 +97,10 @@ int test_main(int argc, char * const argv[]) { ...@@ -97,13 +97,10 @@ int test_main(int argc, char * const argv[]) {
// create the db // create the db
DB *db = NULL; DB *db = NULL;
r = db_create(&db, db_env, 0); assert(r == 0); r = db_create(&db, db_env, 0); assert(r == 0);
DB_TXN *create_txn = NULL;
r = db_env->txn_begin(db_env, NULL, &create_txn, 0); assert(r == 0);
if (pagesize) { if (pagesize) {
r = db->set_pagesize(db, pagesize); assert(r == 0); r = db->set_pagesize(db, pagesize); assert(r == 0);
} }
r = db->open(db, create_txn, db_filename, NULL, DB_BTREE, DB_CREATE, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0); r = db->open(db, NULL, db_filename, NULL, DB_BTREE, DB_CREATE|DB_AUTO_COMMIT|DB_THREAD, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
r = create_txn->commit(create_txn, 0); assert(r == 0);
toku_pthread_t tids[nthreads]; toku_pthread_t tids[nthreads];
for (int i = 0; i < nthreads-1; i++) { for (int i = 0; i < nthreads-1; i++) {
......
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