summaryrefslogtreecommitdiff
path: root/storage/tokudb/PerconaFT/src
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2018-02-06 14:50:50 +0100
committerSergei Golubchik <serg@mariadb.org>2018-02-06 14:50:50 +0100
commit4771ae4b22d2bdef0aafc563570c71d4636a2493 (patch)
treed115bd7c68b1e6feab68ff6fcd547e0c86c79296 /storage/tokudb/PerconaFT/src
parent60f51af755ea9d07c20a596ba21de184816fa265 (diff)
parent0c25e58db6b045df92c209d396031cac5b528bbf (diff)
downloadmariadb-git-4771ae4b22d2bdef0aafc563570c71d4636a2493.tar.gz
Merge branch 'github/10.1' into 10.2
Diffstat (limited to 'storage/tokudb/PerconaFT/src')
-rw-r--r--storage/tokudb/PerconaFT/src/indexer-undo-do.cc2
-rw-r--r--storage/tokudb/PerconaFT/src/indexer.cc19
-rw-r--r--storage/tokudb/PerconaFT/src/tests/blocking-first-empty.cc10
-rw-r--r--storage/tokudb/PerconaFT/src/tests/blocking-first.cc10
-rw-r--r--storage/tokudb/PerconaFT/src/tests/blocking-last.cc10
-rw-r--r--storage/tokudb/PerconaFT/src/tests/blocking-next-prev-deadlock.cc10
-rw-r--r--storage/tokudb/PerconaFT/src/tests/blocking-next-prev.cc10
-rw-r--r--storage/tokudb/PerconaFT/src/tests/blocking-prelock-range.cc13
-rw-r--r--storage/tokudb/PerconaFT/src/tests/blocking-put-timeout.cc17
-rw-r--r--storage/tokudb/PerconaFT/src/tests/blocking-put-wakeup.cc17
-rw-r--r--storage/tokudb/PerconaFT/src/tests/blocking-put.cc10
-rw-r--r--storage/tokudb/PerconaFT/src/tests/blocking-set-range-0.cc11
-rw-r--r--storage/tokudb/PerconaFT/src/tests/blocking-set-range-n.cc11
-rw-r--r--storage/tokudb/PerconaFT/src/tests/blocking-set-range-reverse-0.cc11
-rw-r--r--storage/tokudb/PerconaFT/src/tests/blocking-set.cc10
-rw-r--r--storage/tokudb/PerconaFT/src/tests/blocking-table-lock.cc13
-rw-r--r--storage/tokudb/PerconaFT/src/tests/checkpoint_fairness.cc12
-rw-r--r--storage/tokudb/PerconaFT/src/tests/checkpoint_stress.cc37
-rw-r--r--storage/tokudb/PerconaFT/src/tests/db-put-simple-deadlock-threads.cc9
-rw-r--r--storage/tokudb/PerconaFT/src/tests/db-put-simple-lockwait.cc7
-rw-r--r--storage/tokudb/PerconaFT/src/tests/db-put-update-deadlock.cc15
-rw-r--r--storage/tokudb/PerconaFT/src/tests/filesize.cc6
-rw-r--r--storage/tokudb/PerconaFT/src/tests/hotindexer-bw.cc26
-rw-r--r--storage/tokudb/PerconaFT/src/tests/hotindexer-multiclient.cc22
-rw-r--r--storage/tokudb/PerconaFT/src/tests/hotindexer-put-abort.cc9
-rw-r--r--storage/tokudb/PerconaFT/src/tests/hotindexer-put-commit.cc14
-rw-r--r--storage/tokudb/PerconaFT/src/tests/hotindexer-with-queries.cc13
-rw-r--r--storage/tokudb/PerconaFT/src/tests/locktree_escalation_stalls.cc13
-rw-r--r--storage/tokudb/PerconaFT/src/tests/recover-test_crash_in_flusher_thread.h19
-rw-r--r--storage/tokudb/PerconaFT/src/tests/recovery_stress.cc15
-rw-r--r--storage/tokudb/PerconaFT/src/tests/stress_openclose.h11
-rw-r--r--storage/tokudb/PerconaFT/src/tests/test3039.cc44
-rw-r--r--storage/tokudb/PerconaFT/src/tests/test_1672532.cc210
-rw-r--r--storage/tokudb/PerconaFT/src/tests/test_3645.cc46
-rw-r--r--storage/tokudb/PerconaFT/src/tests/test_4015.cc14
-rw-r--r--storage/tokudb/PerconaFT/src/tests/test_abort1.cc20
-rw-r--r--storage/tokudb/PerconaFT/src/tests/test_abort4.cc10
-rw-r--r--storage/tokudb/PerconaFT/src/tests/test_abort5.cc10
-rw-r--r--storage/tokudb/PerconaFT/src/tests/test_forkjoin.cc9
-rw-r--r--storage/tokudb/PerconaFT/src/tests/test_groupcommit_count.cc14
-rw-r--r--storage/tokudb/PerconaFT/src/tests/test_groupcommit_perf.cc14
-rw-r--r--storage/tokudb/PerconaFT/src/tests/test_iterate_pending_lock_requests.cc11
-rw-r--r--storage/tokudb/PerconaFT/src/tests/test_lock_timeout_callback.cc3
-rw-r--r--storage/tokudb/PerconaFT/src/tests/test_log1.cc10
-rw-r--r--storage/tokudb/PerconaFT/src/tests/test_log1_abort.cc12
-rw-r--r--storage/tokudb/PerconaFT/src/tests/test_logmax.cc21
-rw-r--r--storage/tokudb/PerconaFT/src/tests/test_multiple_checkpoints_block_commit.cc15
-rw-r--r--storage/tokudb/PerconaFT/src/tests/test_stress_hot_indexing.cc7
-rw-r--r--storage/tokudb/PerconaFT/src/tests/test_thread_insert.cc9
-rw-r--r--storage/tokudb/PerconaFT/src/tests/test_txn_abort7.cc21
-rw-r--r--storage/tokudb/PerconaFT/src/tests/threaded_stress_test_helpers.h49
-rw-r--r--storage/tokudb/PerconaFT/src/tests/txn_manager_handle_snapshot_atomicity.cc4
-rw-r--r--storage/tokudb/PerconaFT/src/ydb.cc31
-rw-r--r--storage/tokudb/PerconaFT/src/ydb_db.cc105
-rw-r--r--storage/tokudb/PerconaFT/src/ydb_db.h3
-rw-r--r--storage/tokudb/PerconaFT/src/ydb_env_func.cc2
-rw-r--r--storage/tokudb/PerconaFT/src/ydb_txn.cc10
57 files changed, 768 insertions, 348 deletions
diff --git a/storage/tokudb/PerconaFT/src/indexer-undo-do.cc b/storage/tokudb/PerconaFT/src/indexer-undo-do.cc
index 4c7f5336161..cc86402751b 100644
--- a/storage/tokudb/PerconaFT/src/indexer-undo-do.cc
+++ b/storage/tokudb/PerconaFT/src/indexer-undo-do.cc
@@ -571,6 +571,7 @@ indexer_ft_delete_committed(DB_INDEXER *indexer, DB *hotdb, DBT *hotkey, XIDS xi
oldest_referenced_xid_estimate,
true);
toku_ft_send_delete(db_struct_i(hotdb)->ft_handle, hotkey, xids, &gc_info);
+ toku_ft_adjust_logical_row_count(db_struct_i(hotdb)->ft_handle->ft, -1);
}
}
return result;
@@ -616,6 +617,7 @@ indexer_ft_insert_committed(DB_INDEXER *indexer, DB *hotdb, DBT *hotkey, DBT *ho
oldest_referenced_xid_estimate,
true);
toku_ft_send_insert(db_struct_i(hotdb)->ft_handle, hotkey, hotval, xids, FT_INSERT, &gc_info);
+ toku_ft_adjust_logical_row_count(db_struct_i(hotdb)->ft_handle->ft, 1);
}
}
return result;
diff --git a/storage/tokudb/PerconaFT/src/indexer.cc b/storage/tokudb/PerconaFT/src/indexer.cc
index b475b08beb5..044ffac917c 100644
--- a/storage/tokudb/PerconaFT/src/indexer.cc
+++ b/storage/tokudb/PerconaFT/src/indexer.cc
@@ -253,16 +253,21 @@ toku_indexer_create_indexer(DB_ENV *env,
indexer->set_error_callback = toku_indexer_set_error_callback;
indexer->set_poll_function = toku_indexer_set_poll_function;
indexer->build = build_index;
- indexer->close = close_indexer;
- indexer->abort = abort_indexer;
-
- toku_mutex_init(&indexer->i->indexer_lock, NULL);
- toku_mutex_init(&indexer->i->indexer_estimate_lock, NULL);
+ indexer->close = close_indexer;
+ indexer->abort = abort_indexer;
+
+ toku_mutex_init(
+ *indexer_i_indexer_lock_mutex_key, &indexer->i->indexer_lock, nullptr);
+ toku_mutex_init(*indexer_i_indexer_estimate_lock_mutex_key,
+ &indexer->i->indexer_estimate_lock,
+ nullptr);
toku_init_dbt(&indexer->i->position_estimate);
//
- // create and close a dummy loader to get redirection going for the hot indexer
- // This way, if the hot index aborts, but other transactions have references to the
+ // create and close a dummy loader to get redirection going for the hot
+ // indexer
+ // This way, if the hot index aborts, but other transactions have references
+ // to the
// underlying FT, then those transactions can do dummy operations on the FT
// while the DB gets redirected back to an empty dictionary
//
diff --git a/storage/tokudb/PerconaFT/src/tests/blocking-first-empty.cc b/storage/tokudb/PerconaFT/src/tests/blocking-first-empty.cc
index d9d865254f1..3b53911e614 100644
--- a/storage/tokudb/PerconaFT/src/tests/blocking-first-empty.cc
+++ b/storage/tokudb/PerconaFT/src/tests/blocking-first-empty.cc
@@ -99,12 +99,14 @@ static void *blocking_first_thread(void *arg) {
static void run_test(DB_ENV *db_env, DB *db, int nthreads, uint64_t nrows, long sleeptime) {
int r;
toku_pthread_t tids[nthreads];
- struct blocking_first_args a = { db_env, db, nrows, sleeptime };
- for (int i = 0; i < nthreads-1; i++) {
- r = toku_pthread_create(&tids[i], NULL, blocking_first_thread, &a); assert(r == 0);
+ struct blocking_first_args a = {db_env, db, nrows, sleeptime};
+ for (int i = 0; i < nthreads - 1; i++) {
+ r = toku_pthread_create(
+ toku_uninstrumented, &tids[i], nullptr, blocking_first_thread, &a);
+ assert(r == 0);
}
blocking_first(db_env, db, nrows, sleeptime);
- for (int i = 0; i < nthreads-1; i++) {
+ for (int i = 0; i < nthreads - 1; i++) {
void *ret;
r = toku_pthread_join(tids[i], &ret); assert(r == 0);
}
diff --git a/storage/tokudb/PerconaFT/src/tests/blocking-first.cc b/storage/tokudb/PerconaFT/src/tests/blocking-first.cc
index 9f3f8f4eb6a..c104eabd6c3 100644
--- a/storage/tokudb/PerconaFT/src/tests/blocking-first.cc
+++ b/storage/tokudb/PerconaFT/src/tests/blocking-first.cc
@@ -116,12 +116,14 @@ static void *blocking_first_thread(void *arg) {
static void run_test(DB_ENV *db_env, DB *db, int nthreads, uint64_t nrows, long sleeptime) {
int r;
toku_pthread_t tids[nthreads];
- struct blocking_first_args a = { db_env, db, nrows, sleeptime };
- for (int i = 0; i < nthreads-1; i++) {
- r = toku_pthread_create(&tids[i], NULL, blocking_first_thread, &a); assert(r == 0);
+ struct blocking_first_args a = {db_env, db, nrows, sleeptime};
+ for (int i = 0; i < nthreads - 1; i++) {
+ r = toku_pthread_create(
+ toku_uninstrumented, &tids[i], nullptr, blocking_first_thread, &a);
+ assert(r == 0);
}
blocking_first(db_env, db, nrows, sleeptime);
- for (int i = 0; i < nthreads-1; i++) {
+ for (int i = 0; i < nthreads - 1; i++) {
void *ret;
r = toku_pthread_join(tids[i], &ret); assert(r == 0);
}
diff --git a/storage/tokudb/PerconaFT/src/tests/blocking-last.cc b/storage/tokudb/PerconaFT/src/tests/blocking-last.cc
index a62d83eb46f..3a702e3f115 100644
--- a/storage/tokudb/PerconaFT/src/tests/blocking-last.cc
+++ b/storage/tokudb/PerconaFT/src/tests/blocking-last.cc
@@ -116,12 +116,14 @@ static void *blocking_last_thread(void *arg) {
static void run_test(DB_ENV *db_env, DB *db, int nthreads, uint64_t nrows, long sleeptime) {
int r;
toku_pthread_t tids[nthreads];
- struct blocking_last_args a = { db_env, db, nrows, sleeptime };
- for (int i = 0; i < nthreads-1; i++) {
- r = toku_pthread_create(&tids[i], NULL, blocking_last_thread, &a); assert(r == 0);
+ struct blocking_last_args a = {db_env, db, nrows, sleeptime};
+ for (int i = 0; i < nthreads - 1; i++) {
+ r = toku_pthread_create(
+ toku_uninstrumented, &tids[i], nullptr, blocking_last_thread, &a);
+ assert(r == 0);
}
blocking_last(db_env, db, nrows, sleeptime);
- for (int i = 0; i < nthreads-1; i++) {
+ for (int i = 0; i < nthreads - 1; i++) {
void *ret;
r = toku_pthread_join(tids[i], &ret); assert(r == 0);
}
diff --git a/storage/tokudb/PerconaFT/src/tests/blocking-next-prev-deadlock.cc b/storage/tokudb/PerconaFT/src/tests/blocking-next-prev-deadlock.cc
index bd5697ba526..781708cc627 100644
--- a/storage/tokudb/PerconaFT/src/tests/blocking-next-prev-deadlock.cc
+++ b/storage/tokudb/PerconaFT/src/tests/blocking-next-prev-deadlock.cc
@@ -181,12 +181,14 @@ static void *blocking_next_thread(void *arg) {
static void run_test(DB_ENV *db_env, DB *db, int nthreads, uint64_t nrows, long sleeptime) {
int r;
toku_pthread_t tids[nthreads];
- struct blocking_next_args a = { db_env, db, nrows, sleeptime };
- for (int i = 0; i < nthreads-1; i++) {
- r = toku_pthread_create(&tids[i], NULL, blocking_next_thread, &a); assert(r == 0);
+ struct blocking_next_args a = {db_env, db, nrows, sleeptime};
+ for (int i = 0; i < nthreads - 1; i++) {
+ r = toku_pthread_create(
+ toku_uninstrumented, &tids[i], nullptr, blocking_next_thread, &a);
+ assert(r == 0);
}
blocking_prev(db_env, db, nrows, sleeptime);
- for (int i = 0; i < nthreads-1; i++) {
+ for (int i = 0; i < nthreads - 1; i++) {
void *ret;
r = toku_pthread_join(tids[i], &ret); assert(r == 0);
}
diff --git a/storage/tokudb/PerconaFT/src/tests/blocking-next-prev.cc b/storage/tokudb/PerconaFT/src/tests/blocking-next-prev.cc
index 729473bb7cf..aa179e88d76 100644
--- a/storage/tokudb/PerconaFT/src/tests/blocking-next-prev.cc
+++ b/storage/tokudb/PerconaFT/src/tests/blocking-next-prev.cc
@@ -188,12 +188,14 @@ static void *blocking_next_thread(void *arg) {
static void run_test(DB_ENV *db_env, DB *db, int nthreads, uint64_t nrows, long sleeptime) {
int r;
toku_pthread_t tids[nthreads];
- struct blocking_next_args a = { db_env, db, nrows, sleeptime };
- for (int i = 0; i < nthreads-1; i++) {
- r = toku_pthread_create(&tids[i], NULL, blocking_next_thread, &a); assert(r == 0);
+ struct blocking_next_args a = {db_env, db, nrows, sleeptime};
+ for (int i = 0; i < nthreads - 1; i++) {
+ r = toku_pthread_create(
+ toku_uninstrumented, &tids[i], nullptr, blocking_next_thread, &a);
+ assert(r == 0);
}
blocking_prev(db_env, db, nrows, sleeptime);
- for (int i = 0; i < nthreads-1; i++) {
+ for (int i = 0; i < nthreads - 1; i++) {
void *ret;
r = toku_pthread_join(tids[i], &ret); assert(r == 0);
}
diff --git a/storage/tokudb/PerconaFT/src/tests/blocking-prelock-range.cc b/storage/tokudb/PerconaFT/src/tests/blocking-prelock-range.cc
index 8821b39aa8a..38875a2f8ec 100644
--- a/storage/tokudb/PerconaFT/src/tests/blocking-prelock-range.cc
+++ b/storage/tokudb/PerconaFT/src/tests/blocking-prelock-range.cc
@@ -140,12 +140,17 @@ int test_main(int argc, char * const argv[]) {
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);
toku_pthread_t tids[nthreads];
- struct blocking_range_lock_args a = { db_env, db, nrows, sleeptime };
- for (int i = 0; i < nthreads-1; i++) {
- r = toku_pthread_create(&tids[i], NULL, blocking_range_lock_thread, &a); assert(r == 0);
+ struct blocking_range_lock_args a = {db_env, db, nrows, sleeptime};
+ for (int i = 0; i < nthreads - 1; i++) {
+ r = toku_pthread_create(toku_uninstrumented,
+ &tids[i],
+ nullptr,
+ blocking_range_lock_thread,
+ &a);
+ assert(r == 0);
}
blocking_range_lock(db_env, db, nrows, sleeptime);
- for (int i = 0; i < nthreads-1; i++) {
+ for (int i = 0; i < nthreads - 1; i++) {
void *ret;
r = toku_pthread_join(tids[i], &ret); assert(r == 0);
}
diff --git a/storage/tokudb/PerconaFT/src/tests/blocking-put-timeout.cc b/storage/tokudb/PerconaFT/src/tests/blocking-put-timeout.cc
index a31e173fd83..bf4a8a24f47 100644
--- a/storage/tokudb/PerconaFT/src/tests/blocking-put-timeout.cc
+++ b/storage/tokudb/PerconaFT/src/tests/blocking-put-timeout.cc
@@ -57,8 +57,8 @@ struct test_seq {
static void test_seq_init(struct test_seq *seq) {
seq->state = 0;
- toku_mutex_init(&seq->lock, NULL);
- toku_cond_init(&seq->cv, NULL);
+ toku_mutex_init(toku_uninstrumented, &seq->lock, nullptr);
+ toku_cond_init(toku_uninstrumented, &seq->cv, nullptr);
}
static void test_seq_destroy(struct test_seq *seq) {
@@ -172,13 +172,18 @@ int test_main(int argc, char * const argv[]) {
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);
// run test
- struct test_seq seq; ZERO_STRUCT(seq); test_seq_init(&seq);
+ struct test_seq seq;
+ ZERO_STRUCT(seq);
+ test_seq_init(&seq);
toku_pthread_t t_a_id;
- struct t_a_args t_a_args = { db_env, db, &seq };
- r = toku_pthread_create(&t_a_id, NULL, t_a_thread, &t_a_args); assert(r == 0);
+ struct t_a_args t_a_args = {db_env, db, &seq};
+ r = toku_pthread_create(
+ toku_uninstrumented, &t_a_id, nullptr, t_a_thread, &t_a_args);
+ assert(r == 0);
t_b(db_env, db, &seq);
void *ret;
- r = toku_pthread_join(t_a_id, &ret); assert(r == 0);
+ r = toku_pthread_join(t_a_id, &ret);
+ assert(r == 0);
test_seq_destroy(&seq);
// close env
diff --git a/storage/tokudb/PerconaFT/src/tests/blocking-put-wakeup.cc b/storage/tokudb/PerconaFT/src/tests/blocking-put-wakeup.cc
index 615cdb5d17c..dba7962de35 100644
--- a/storage/tokudb/PerconaFT/src/tests/blocking-put-wakeup.cc
+++ b/storage/tokudb/PerconaFT/src/tests/blocking-put-wakeup.cc
@@ -58,8 +58,8 @@ struct test_seq {
static void test_seq_init(struct test_seq *seq) {
seq->state = 0;
- toku_mutex_init(&seq->lock, NULL);
- toku_cond_init(&seq->cv, NULL);
+ toku_mutex_init(toku_uninstrumented, &seq->lock, nullptr);
+ toku_cond_init(toku_uninstrumented, &seq->cv, nullptr);
}
static void test_seq_destroy(struct test_seq *seq) {
@@ -167,13 +167,18 @@ int test_main(int argc, char * const argv[]) {
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);
// run test
- struct test_seq seq; ZERO_STRUCT(seq); test_seq_init(&seq);
+ struct test_seq seq;
+ ZERO_STRUCT(seq);
+ test_seq_init(&seq);
toku_pthread_t t_a_id;
- struct t_a_args t_a_args = { db_env, db, &seq };
- r = toku_pthread_create(&t_a_id, NULL, t_a_thread, &t_a_args); assert(r == 0);
+ struct t_a_args t_a_args = {db_env, db, &seq};
+ r = toku_pthread_create(
+ toku_uninstrumented, &t_a_id, nullptr, t_a_thread, &t_a_args);
+ assert(r == 0);
t_b(db_env, db, &seq);
void *ret;
- r = toku_pthread_join(t_a_id, &ret); assert(r == 0);
+ r = toku_pthread_join(t_a_id, &ret);
+ assert(r == 0);
test_seq_destroy(&seq);
// close env
diff --git a/storage/tokudb/PerconaFT/src/tests/blocking-put.cc b/storage/tokudb/PerconaFT/src/tests/blocking-put.cc
index 0fa56325007..95481062483 100644
--- a/storage/tokudb/PerconaFT/src/tests/blocking-put.cc
+++ b/storage/tokudb/PerconaFT/src/tests/blocking-put.cc
@@ -139,12 +139,14 @@ int test_main(int argc, char * const argv[]) {
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);
toku_pthread_t tids[nthreads];
- struct blocking_put_args a = { db_env, db, nrows, sleeptime };
- for (int i = 0; i < nthreads-1; i++) {
- r = toku_pthread_create(&tids[i], NULL, blocking_put_thread, &a); assert(r == 0);
+ struct blocking_put_args a = {db_env, db, nrows, sleeptime};
+ for (int i = 0; i < nthreads - 1; i++) {
+ r = toku_pthread_create(
+ toku_uninstrumented, &tids[i], nullptr, blocking_put_thread, &a);
+ assert(r == 0);
}
blocking_put(db_env, db, nrows, sleeptime);
- for (int i = 0; i < nthreads-1; i++) {
+ for (int i = 0; i < nthreads - 1; i++) {
void *ret;
r = toku_pthread_join(tids[i], &ret); assert(r == 0);
}
diff --git a/storage/tokudb/PerconaFT/src/tests/blocking-set-range-0.cc b/storage/tokudb/PerconaFT/src/tests/blocking-set-range-0.cc
index a0e03ab3293..7c2e7b0fb26 100644
--- a/storage/tokudb/PerconaFT/src/tests/blocking-set-range-0.cc
+++ b/storage/tokudb/PerconaFT/src/tests/blocking-set-range-0.cc
@@ -126,12 +126,15 @@ static void *blocking_set_range_thread(void *arg) {
static void run_test(DB_ENV *db_env, DB *db, int nthreads, uint64_t nrows, long sleeptime, uint64_t the_key) {
int r;
toku_pthread_t tids[nthreads];
- struct blocking_set_range_args a = { db_env, db, nrows, sleeptime, the_key };
- for (int i = 0; i < nthreads-1; i++) {
- r = toku_pthread_create(&tids[i], NULL, blocking_set_range_thread, &a); assert(r == 0);
+ struct blocking_set_range_args a = {db_env, db, nrows, sleeptime, the_key};
+ for (int i = 0; i < nthreads - 1; i++) {
+ r = toku_pthread_create(
+ toku_uninstrumented, &tids[i], nullptr,
+ blocking_set_range_thread, &a);
+ assert(r == 0);
}
blocking_set_range(db_env, db, nrows, sleeptime, the_key);
- for (int i = 0; i < nthreads-1; i++) {
+ for (int i = 0; i < nthreads - 1; i++) {
void *ret;
r = toku_pthread_join(tids[i], &ret); assert(r == 0);
}
diff --git a/storage/tokudb/PerconaFT/src/tests/blocking-set-range-n.cc b/storage/tokudb/PerconaFT/src/tests/blocking-set-range-n.cc
index 056d74dbdd2..54a5846eb5e 100644
--- a/storage/tokudb/PerconaFT/src/tests/blocking-set-range-n.cc
+++ b/storage/tokudb/PerconaFT/src/tests/blocking-set-range-n.cc
@@ -121,12 +121,15 @@ static void *blocking_set_range_thread(void *arg) {
static void run_test(DB_ENV *db_env, DB *db, int nthreads, uint64_t nrows, long sleeptime, uint64_t the_key) {
int r;
toku_pthread_t tids[nthreads];
- struct blocking_set_range_args a = { db_env, db, nrows, sleeptime, the_key };
- for (int i = 0; i < nthreads-1; i++) {
- r = toku_pthread_create(&tids[i], NULL, blocking_set_range_thread, &a); assert(r == 0);
+ struct blocking_set_range_args a = {db_env, db, nrows, sleeptime, the_key};
+ for (int i = 0; i < nthreads - 1; i++) {
+ r = toku_pthread_create(
+ toku_uninstrumented, &tids[i], nullptr,
+ blocking_set_range_thread, &a);
+ assert(r == 0);
}
blocking_set_range(db_env, db, nrows, sleeptime, the_key);
- for (int i = 0; i < nthreads-1; i++) {
+ for (int i = 0; i < nthreads - 1; i++) {
void *ret;
r = toku_pthread_join(tids[i], &ret); assert(r == 0);
}
diff --git a/storage/tokudb/PerconaFT/src/tests/blocking-set-range-reverse-0.cc b/storage/tokudb/PerconaFT/src/tests/blocking-set-range-reverse-0.cc
index 1e7fca85bff..59e582547bf 100644
--- a/storage/tokudb/PerconaFT/src/tests/blocking-set-range-reverse-0.cc
+++ b/storage/tokudb/PerconaFT/src/tests/blocking-set-range-reverse-0.cc
@@ -126,12 +126,15 @@ static void *blocking_set_range_thread(void *arg) {
static void run_test(DB_ENV *db_env, DB *db, int nthreads, uint64_t nrows, long sleeptime, uint64_t the_key) {
int r;
toku_pthread_t tids[nthreads];
- struct blocking_set_range_args a = { db_env, db, nrows, sleeptime, the_key };
- for (int i = 0; i < nthreads-1; i++) {
- r = toku_pthread_create(&tids[i], NULL, blocking_set_range_thread, &a); assert(r == 0);
+ struct blocking_set_range_args a = {db_env, db, nrows, sleeptime, the_key};
+ for (int i = 0; i < nthreads - 1; i++) {
+ r = toku_pthread_create(
+ toku_uninstrumented, &tids[i], nullptr,
+ blocking_set_range_thread, &a);
+ assert(r == 0);
}
blocking_set_range(db_env, db, nrows, sleeptime, the_key);
- for (int i = 0; i < nthreads-1; i++) {
+ for (int i = 0; i < nthreads - 1; i++) {
void *ret;
r = toku_pthread_join(tids[i], &ret); assert(r == 0);
}
diff --git a/storage/tokudb/PerconaFT/src/tests/blocking-set.cc b/storage/tokudb/PerconaFT/src/tests/blocking-set.cc
index ba64989842a..aa433c87be1 100644
--- a/storage/tokudb/PerconaFT/src/tests/blocking-set.cc
+++ b/storage/tokudb/PerconaFT/src/tests/blocking-set.cc
@@ -182,12 +182,14 @@ int test_main(int argc, char * const argv[]) {
populate(db_env, db, nrows);
toku_pthread_t tids[nthreads];
- struct blocking_set_args a = { db_env, db, nrows, sleeptime };
- for (int i = 0; i < nthreads-1; i++) {
- r = toku_pthread_create(&tids[i], NULL, blocking_set_thread, &a); assert(r == 0);
+ struct blocking_set_args a = {db_env, db, nrows, sleeptime};
+ for (int i = 0; i < nthreads - 1; i++) {
+ r = toku_pthread_create(
+ toku_uninstrumented, &tids[i], nullptr, blocking_set_thread, &a);
+ assert(r == 0);
}
blocking_set(db_env, db, nrows, sleeptime);
- for (int i = 0; i < nthreads-1; i++) {
+ for (int i = 0; i < nthreads - 1; i++) {
void *ret;
r = toku_pthread_join(tids[i], &ret); assert(r == 0);
}
diff --git a/storage/tokudb/PerconaFT/src/tests/blocking-table-lock.cc b/storage/tokudb/PerconaFT/src/tests/blocking-table-lock.cc
index 9ae33c56621..0953a4e80de 100644
--- a/storage/tokudb/PerconaFT/src/tests/blocking-table-lock.cc
+++ b/storage/tokudb/PerconaFT/src/tests/blocking-table-lock.cc
@@ -133,12 +133,17 @@ int test_main(int argc, char * const argv[]) {
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);
toku_pthread_t tids[nthreads];
- struct blocking_table_lock_args a = { db_env, db, nrows, sleeptime };
- for (int i = 0; i < nthreads-1; i++) {
- r = toku_pthread_create(&tids[i], NULL, blocking_table_lock_thread, &a); assert(r == 0);
+ struct blocking_table_lock_args a = {db_env, db, nrows, sleeptime};
+ for (int i = 0; i < nthreads - 1; i++) {
+ r = toku_pthread_create(toku_uninstrumented,
+ &tids[i],
+ nullptr,
+ blocking_table_lock_thread,
+ &a);
+ assert(r == 0);
}
blocking_table_lock(db_env, db, nrows, sleeptime);
- for (int i = 0; i < nthreads-1; i++) {
+ for (int i = 0; i < nthreads - 1; i++) {
void *ret;
r = toku_pthread_join(tids[i], &ret); assert(r == 0);
}
diff --git a/storage/tokudb/PerconaFT/src/tests/checkpoint_fairness.cc b/storage/tokudb/PerconaFT/src/tests/checkpoint_fairness.cc
index be82f8c352f..f62dfbc76d3 100644
--- a/storage/tokudb/PerconaFT/src/tests/checkpoint_fairness.cc
+++ b/storage/tokudb/PerconaFT/src/tests/checkpoint_fairness.cc
@@ -113,10 +113,14 @@ int test_main(int argc, char * const argv[]) {
{ int chk_r = db->open(db, NULL, "db", NULL, DB_BTREE, DB_CREATE|DB_AUTO_COMMIT, 0666); CKERR(chk_r); }
pthread_t thds[n_threads];
- int ids[n_threads];
- for (int i=0; i<n_threads; i++) {
- ids[i]=i;
- { int chk_r = toku_pthread_create(&thds[i], NULL, start_txns, &ids[i]); CKERR(chk_r); }
+ int ids[n_threads];
+ for (int i = 0; i < n_threads; i++) {
+ ids[i] = i;
+ {
+ int chk_r = toku_pthread_create(
+ toku_uninstrumented, &thds[i], nullptr, start_txns, &ids[i]);
+ CKERR(chk_r);
+ }
}
start_checkpoints();
diff --git a/storage/tokudb/PerconaFT/src/tests/checkpoint_stress.cc b/storage/tokudb/PerconaFT/src/tests/checkpoint_stress.cc
index 221471a8045..135a9843ce4 100644
--- a/storage/tokudb/PerconaFT/src/tests/checkpoint_stress.cc
+++ b/storage/tokudb/PerconaFT/src/tests/checkpoint_stress.cc
@@ -271,24 +271,29 @@ run_test (int iter, int die) {
}
// take checkpoint (all dictionaries)
- snapshot(NULL, 1);
+ snapshot(NULL, 1);
if (die) {
- // separate thread will perform random acts on other dictionaries (not 0)
- int r = toku_pthread_create(&thread, 0, random_acts, (void *) dictionaries);
- CKERR(r);
- // this thead will scribble over dictionary 0 before crash to verify that
- // post-checkpoint inserts are not in the database
- DB* db = dictionaries[0].db;
- if (iter & 1)
- scribble(db, iter);
- else
- thin_out(db, iter);
- uint32_t delay = myrandom();
- delay &= 0xFFF; // select lower 12 bits, shifted up 8 for random number ...
- delay = delay << 8; // ... uniformly distributed between 0 and 1M ...
- usleep(delay); // ... to sleep up to one second (1M usec)
- drop_dead();
+ // separate thread will perform random acts on other dictionaries (not
+ // 0)
+ int r = toku_pthread_create(
+ toku_uninstrumented, &thread, nullptr,
+ random_acts, static_cast<void*>(dictionaries));
+ CKERR(r);
+ // this thead will scribble over dictionary 0 before crash to verify
+ // that
+ // post-checkpoint inserts are not in the database
+ DB* db = dictionaries[0].db;
+ if (iter & 1)
+ scribble(db, iter);
+ else
+ thin_out(db, iter);
+ uint32_t delay = myrandom();
+ delay &=
+ 0xFFF; // select lower 12 bits, shifted up 8 for random number ...
+ delay = delay << 8; // ... uniformly distributed between 0 and 1M ...
+ usleep(delay); // ... to sleep up to one second (1M usec)
+ drop_dead();
}
else {
for (i = 0; i < NUM_DICTIONARIES; i++) {
diff --git a/storage/tokudb/PerconaFT/src/tests/db-put-simple-deadlock-threads.cc b/storage/tokudb/PerconaFT/src/tests/db-put-simple-deadlock-threads.cc
index ada46bd7516..e5bcc6af7bb 100644
--- a/storage/tokudb/PerconaFT/src/tests/db-put-simple-deadlock-threads.cc
+++ b/storage/tokudb/PerconaFT/src/tests/db-put-simple-deadlock-threads.cc
@@ -57,8 +57,8 @@ struct test_seq {
static void test_seq_init(struct test_seq *seq) {
seq->state = 0;
- toku_mutex_init(&seq->lock, NULL);
- toku_cond_init(&seq->cv, NULL);
+ toku_mutex_init(toku_uninstrumented, &seq->lock, nullptr);
+ toku_cond_init(toku_uninstrumented, &seq->cv, nullptr);
}
static void test_seq_destroy(struct test_seq *seq) {
@@ -146,8 +146,9 @@ static void simple_deadlock(DB_ENV *db_env, DB *db, int do_txn, int n) {
struct test_seq test_seq; ZERO_STRUCT(test_seq); test_seq_init(&test_seq);
toku_pthread_t tid;
- struct run_txn_b_arg arg = { &test_seq, txn_b, db, n};
- r = toku_pthread_create(&tid, NULL, run_txn_b, &arg);
+ struct run_txn_b_arg arg = {&test_seq, txn_b, db, n};
+ r = toku_pthread_create(
+ toku_uninstrumented, &tid, nullptr, run_txn_b, &arg);
test_seq_sleep(&test_seq, 0);
insert_row(db, txn_a, htonl(0), 0, 0);
diff --git a/storage/tokudb/PerconaFT/src/tests/db-put-simple-lockwait.cc b/storage/tokudb/PerconaFT/src/tests/db-put-simple-lockwait.cc
index 365ea39eced..0fbe851532e 100644
--- a/storage/tokudb/PerconaFT/src/tests/db-put-simple-lockwait.cc
+++ b/storage/tokudb/PerconaFT/src/tests/db-put-simple-lockwait.cc
@@ -95,10 +95,11 @@ static void simple_lockwait(DB_ENV *db_env, DB *db, int do_txn, int nrows, int n
insert_row(db, txns[0], htonl(0), 0, 0);
toku_pthread_t tids[ntxns];
- for (int i = 1 ; i < ntxns; i++) {
+ for (int i = 1; i < ntxns; i++) {
struct insert_one_arg *XMALLOC(arg);
- *arg = (struct insert_one_arg) { txns[i], db};
- r = toku_pthread_create(&tids[i], NULL, insert_one, arg);
+ *arg = (struct insert_one_arg){txns[i], db};
+ r = toku_pthread_create(
+ toku_uninstrumented, &tids[i], nullptr, insert_one, arg);
}
sleep(10);
diff --git a/storage/tokudb/PerconaFT/src/tests/db-put-update-deadlock.cc b/storage/tokudb/PerconaFT/src/tests/db-put-update-deadlock.cc
index 3660f11d1bd..7a968058d7f 100644
--- a/storage/tokudb/PerconaFT/src/tests/db-put-update-deadlock.cc
+++ b/storage/tokudb/PerconaFT/src/tests/db-put-update-deadlock.cc
@@ -128,10 +128,12 @@ static void update_deadlock(DB_ENV *db_env, DB *db, int do_txn, int nrows, int n
// get write locks
toku_pthread_t tids[ntxns];
- for (int i = 0 ; i < ntxns; i++) {
+ for (int i = 0; i < ntxns; i++) {
struct write_one_arg *XMALLOC(arg);
- *arg = (struct write_one_arg) { txns[i], db, (int) htonl((i + 1) % ntxns), 0};
- r = toku_pthread_create(&tids[i], NULL, write_one_f, arg);
+ *arg =
+ (struct write_one_arg){txns[i], db, (int)htonl((i + 1) % ntxns), 0};
+ r = toku_pthread_create(
+ toku_uninstrumented, &tids[i], nullptr, write_one_f, arg);
}
#else
// get read locks
@@ -141,10 +143,11 @@ static void update_deadlock(DB_ENV *db_env, DB *db, int do_txn, int nrows, int n
// get write locks
toku_pthread_t tids[ntxns];
- for (int i = 0 ; i < ntxns; i++) {
+ for (int i = 0; i < ntxns; i++) {
struct write_one_arg *XMALLOC(arg);
- *arg = (struct write_one_arg) { txns[i], db, (int) htonl(0), 0};
- r = toku_pthread_create(&tids[i], NULL, write_one_f, arg);
+ *arg = (struct write_one_arg){txns[i], db, (int)htonl(0), 0};
+ r = toku_pthread_create(
+ toku_uninstrumented, &tids[i], nullptr, write_one_f, arg);
}
#endif
diff --git a/storage/tokudb/PerconaFT/src/tests/filesize.cc b/storage/tokudb/PerconaFT/src/tests/filesize.cc
index 6ab22245e68..9dfeea131c6 100644
--- a/storage/tokudb/PerconaFT/src/tests/filesize.cc
+++ b/storage/tokudb/PerconaFT/src/tests/filesize.cc
@@ -170,11 +170,9 @@ get_file_pathname(void) {
if (verbose) printf("path = %s\n", path);
}
-
-static int
-getsizeM(void) {
+static int getsizeM(void) {
toku_struct_stat buf;
- int r = toku_stat(path, &buf);
+ int r = toku_stat(path, &buf, toku_uninstrumented);
CKERR(r);
int sizeM = (int)buf.st_size >> 20;
check_fragmentation();
diff --git a/storage/tokudb/PerconaFT/src/tests/hotindexer-bw.cc b/storage/tokudb/PerconaFT/src/tests/hotindexer-bw.cc
index 82471f30e45..5336bc3329f 100644
--- a/storage/tokudb/PerconaFT/src/tests/hotindexer-bw.cc
+++ b/storage/tokudb/PerconaFT/src/tests/hotindexer-bw.cc
@@ -302,12 +302,19 @@ static void test_indexer(DB *src, DB **dbs)
CKERR(r);
toku_mutex_unlock(&put_lock);
- // start threads doing additional inserts - no lock issues since indexer already created
- r = toku_pthread_create(&client_threads[0], 0, client, (void *)&client_specs[0]); CKERR(r);
-// r = toku_pthread_create(&client_threads[1], 0, client, (void *)&client_specs[1]); CKERR(r);
+ // start threads doing additional inserts - no lock issues since indexer
+ // already created
+ r = toku_pthread_create(toku_uninstrumented,
+ &client_threads[0],
+ nullptr,
+ client,
+ static_cast<void *>(&client_specs[0]));
+ CKERR(r);
+ // r = toku_pthread_create(toku_uninstrumented, &client_threads[1], 0,
+ // client, (void *)&client_specs[1]); CKERR(r);
struct timeval start, now;
- if ( verbose ) {
+ if (verbose) {
printf("test_indexer build\n");
gettimeofday(&start,0);
}
@@ -342,14 +349,13 @@ static void test_indexer(DB *src, DB **dbs)
if ( verbose ) printf("test_indexer done\n");
}
-
-static void run_test(void)
-{
+static void run_test(void) {
int r;
- toku_mutex_init(&put_lock, NULL);
+ toku_mutex_init(toku_uninstrumented, &put_lock, nullptr);
toku_os_recursive_delete(TOKU_TEST_FILENAME);
- r = toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
- char logname[TOKU_PATH_MAX+1];
+ r = toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU + S_IRWXG + S_IRWXO);
+ CKERR(r);
+ char logname[TOKU_PATH_MAX + 1];
r = toku_os_mkdir(toku_path_join(logname, 2, TOKU_TEST_FILENAME, "log"), S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = db_env_create(&env, 0); CKERR(r);
diff --git a/storage/tokudb/PerconaFT/src/tests/hotindexer-multiclient.cc b/storage/tokudb/PerconaFT/src/tests/hotindexer-multiclient.cc
index eefc621f80a..004a19eccec 100644
--- a/storage/tokudb/PerconaFT/src/tests/hotindexer-multiclient.cc
+++ b/storage/tokudb/PerconaFT/src/tests/hotindexer-multiclient.cc
@@ -303,13 +303,25 @@ static void test_indexer(DB *src, DB **dbs)
r = indexer->set_poll_function(indexer, poll_print, NULL);
CKERR(r);
- // start threads doing additional inserts - no lock issues since indexer already created
- r = toku_pthread_create(&client_threads[0], 0, client, (void *)&client_specs[0]); CKERR(r);
- r = toku_pthread_create(&client_threads[1], 0, client, (void *)&client_specs[1]); CKERR(r);
-// r = toku_pthread_create(&client_threads[2], 0, client, (void *)&client_specs[2]); CKERR(r);
+ // start threads doing additional inserts - no lock issues since indexer
+ // already created
+ r = toku_pthread_create(toku_uninstrumented,
+ &client_threads[0],
+ nullptr,
+ client,
+ static_cast<void *>(&client_specs[0]));
+ CKERR(r);
+ r = toku_pthread_create(toku_uninstrumented,
+ &client_threads[1],
+ nullptr,
+ client,
+ static_cast<void *>(&client_specs[1]));
+ CKERR(r);
+ // r = toku_pthread_create(toku_uninstrumented, &client_threads[2], 0,
+ // client, (void *)&client_specs[2]); CKERR(r);
struct timeval start, now;
- if ( verbose ) {
+ if (verbose) {
printf("test_indexer build\n");
gettimeofday(&start,0);
}
diff --git a/storage/tokudb/PerconaFT/src/tests/hotindexer-put-abort.cc b/storage/tokudb/PerconaFT/src/tests/hotindexer-put-abort.cc
index 27501291b15..f4dd9c53ed5 100644
--- a/storage/tokudb/PerconaFT/src/tests/hotindexer-put-abort.cc
+++ b/storage/tokudb/PerconaFT/src/tests/hotindexer-put-abort.cc
@@ -142,11 +142,14 @@ run_test(void) {
}
// run the indexer
- struct indexer_arg indexer_arg = { env, src_db, 1, &dest_db };
+ struct indexer_arg indexer_arg = {env, src_db, 1, &dest_db};
toku_pthread_t pid;
- r = toku_pthread_create(&pid, NULL, indexer_thread, &indexer_arg); assert_zero(r);
+ r = toku_pthread_create(
+ toku_uninstrumented, &pid, nullptr, indexer_thread, &indexer_arg);
+ assert_zero(r);
- r = txn->abort(txn); assert_zero(r);
+ r = txn->abort(txn);
+ assert_zero(r);
void *ret;
r = toku_pthread_join(pid, &ret); assert_zero(r);
diff --git a/storage/tokudb/PerconaFT/src/tests/hotindexer-put-commit.cc b/storage/tokudb/PerconaFT/src/tests/hotindexer-put-commit.cc
index 59b40037125..99c9bf301cc 100644
--- a/storage/tokudb/PerconaFT/src/tests/hotindexer-put-commit.cc
+++ b/storage/tokudb/PerconaFT/src/tests/hotindexer-put-commit.cc
@@ -166,12 +166,16 @@ run_test(void) {
}
// run the indexer
- struct indexer_arg indexer_arg = { env, src_db, 1, &dest_db };
+ struct indexer_arg indexer_arg = {env, src_db, 1, &dest_db};
toku_pthread_t pid;
- r = toku_pthread_create(&pid, NULL, indexer_thread, &indexer_arg); assert_zero(r);
-
- if (verbose) fprintf(stderr, "commit start\n");
- r = txn->commit(txn, 0); assert_zero(r);
+ r = toku_pthread_create(
+ toku_uninstrumented, &pid, nullptr, indexer_thread, &indexer_arg);
+ assert_zero(r);
+
+ if (verbose)
+ fprintf(stderr, "commit start\n");
+ r = txn->commit(txn, 0);
+ assert_zero(r);
if (verbose) fprintf(stderr, "commit end\n");
void *ret;
diff --git a/storage/tokudb/PerconaFT/src/tests/hotindexer-with-queries.cc b/storage/tokudb/PerconaFT/src/tests/hotindexer-with-queries.cc
index a0be49c1617..2bc60142f3c 100644
--- a/storage/tokudb/PerconaFT/src/tests/hotindexer-with-queries.cc
+++ b/storage/tokudb/PerconaFT/src/tests/hotindexer-with-queries.cc
@@ -114,10 +114,12 @@ static void query_only(DB *src)
client_init();
// start thread doing query
- r = toku_pthread_create(client_thread, 0, client, (void *)src);
+ r = toku_pthread_create(
+ toku_uninstrumented, client_thread, nullptr,
+ client, static_cast<void *>(src));
CKERR(r);
- r = toku_pthread_join(*client_thread, &t0);
+ r = toku_pthread_join(*client_thread, &t0);
CKERR(r);
client_cleanup();
@@ -150,10 +152,13 @@ static void test_indexer(DB *src, DB **dbs)
CKERR(r);
// start thread doing query
- r = toku_pthread_create(client_thread, 0, client, (void *)src); CKERR(r);
+ r = toku_pthread_create(
+ toku_uninstrumented, client_thread, nullptr,
+ client, static_cast<void *>(src));
+ CKERR(r);
struct timeval start, now;
- if ( verbose ) {
+ if (verbose) {
printf("test_indexer build\n");
gettimeofday(&start,0);
}
diff --git a/storage/tokudb/PerconaFT/src/tests/locktree_escalation_stalls.cc b/storage/tokudb/PerconaFT/src/tests/locktree_escalation_stalls.cc
index b4874472bcb..e6c1b18b2b6 100644
--- a/storage/tokudb/PerconaFT/src/tests/locktree_escalation_stalls.cc
+++ b/storage/tokudb/PerconaFT/src/tests/locktree_escalation_stalls.cc
@@ -191,17 +191,22 @@ static void run_test(uint64_t max_i, int n_small) {
env, big_db, max_i, big_test,
};
toku_pthread_t big_id;
- r = toku_pthread_create(&big_id, NULL, test_f, &big_test_args);
+ r = toku_pthread_create(
+ toku_uninstrumented, &big_id, nullptr, test_f, &big_test_args);
assert(r == 0);
struct test_args small_test_args[n_small];
toku_pthread_t small_id[n_small];
for (int i = 0; i < n_small; i++) {
- small_test_args[i] = { env, small_db, max_i, small_test };
- r = toku_pthread_create(&small_id[i], NULL, test_f, &small_test_args[i]);
+ small_test_args[i] = {env, small_db, max_i, small_test};
+ r = toku_pthread_create(toku_uninstrumented,
+ &small_id[i],
+ nullptr,
+ test_f,
+ &small_test_args[i]);
assert(r == 0);
}
-
+
void *big_ret;
r = toku_pthread_join(big_id, &big_ret);
assert(r == 0);
diff --git a/storage/tokudb/PerconaFT/src/tests/recover-test_crash_in_flusher_thread.h b/storage/tokudb/PerconaFT/src/tests/recover-test_crash_in_flusher_thread.h
index 0ed68207ed4..5c10d0cb712 100644
--- a/storage/tokudb/PerconaFT/src/tests/recover-test_crash_in_flusher_thread.h
+++ b/storage/tokudb/PerconaFT/src/tests/recover-test_crash_in_flusher_thread.h
@@ -70,13 +70,18 @@ static void *do_checkpoint_and_crash(void *arg) {
static void flt_callback(int flt_state, void* extra) {
cnt++;
if (verbose) printf("flt_state!! %d\n", flt_state);
- if (cnt > 0 && !starting_a_chkpt && flt_state == state_to_crash) {
- starting_a_chkpt = true;
- if (verbose) printf("flt_state %d\n", flt_state);
- int r = toku_pthread_create(&checkpoint_tid, NULL, do_checkpoint_and_crash, extra);
- assert(r==0);
- usleep(2*1000*1000);
- }
+ if (cnt > 0 && !starting_a_chkpt && flt_state == state_to_crash) {
+ starting_a_chkpt = true;
+ if (verbose)
+ printf("flt_state %d\n", flt_state);
+ int r = toku_pthread_create(toku_uninstrumented,
+ &checkpoint_tid,
+ nullptr,
+ do_checkpoint_and_crash,
+ extra);
+ assert(r == 0);
+ usleep(2 * 1000 * 1000);
+ }
}
diff --git a/storage/tokudb/PerconaFT/src/tests/recovery_stress.cc b/storage/tokudb/PerconaFT/src/tests/recovery_stress.cc
index b1f5f98a90a..1646030cc85 100644
--- a/storage/tokudb/PerconaFT/src/tests/recovery_stress.cc
+++ b/storage/tokudb/PerconaFT/src/tests/recovery_stress.cc
@@ -515,19 +515,8 @@ static void run_test (int iter) {
// if requesting crash, randomly do other non-committed acts, then "drop_dead"
if (iter > 0) {
- if (verbose) printf("dying\n");
-#if 0
- // separate thread will perform random acts on other dictionaries (not 0)
- r = toku_pthread_create(&thread, 0, random_acts, (void *) dictionaries);
- CKERR(r);
- // this thead will scribble over dictionary 0 before crash to verify that
- // post-checkpoint inserts are not in the database
- DB* db = dictionaries[0].db;
- if (iter & 1)
- scribble(db, iter);
- else
- thin_out(db, iter);
-#endif
+ if (verbose)
+ printf("dying\n");
uint32_t delay = myrandom();
delay &= 0xFFF; // select lower 12 bits, shifted up 8 for random number ...
delay = delay << 8; // ... uniformly distributed between 0 and 1M ...
diff --git a/storage/tokudb/PerconaFT/src/tests/stress_openclose.h b/storage/tokudb/PerconaFT/src/tests/stress_openclose.h
index 3f10bfe8aeb..3a55ca4486f 100644
--- a/storage/tokudb/PerconaFT/src/tests/stress_openclose.h
+++ b/storage/tokudb/PerconaFT/src/tests/stress_openclose.h
@@ -245,19 +245,16 @@ stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
// which they can choose a random db to either touch or query
XMALLOC_N(num_buckets, buckets);
for (int i = 0; i < num_buckets; i++) {
- struct db_bucket bucket = {
- .env = env,
- .db = dbp[i],
- .is_open = true
- };
+ struct db_bucket bucket = {.env = env, .db = dbp[i], .is_open = true};
buckets[i] = bucket;
- toku_mutex_init(&buckets[i].mutex, NULL);
+ toku_mutex_init(toku_uninstrumented, &buckets[i].mutex, nullptr);
}
// run all of the query and update workers. they may randomly open
// and close the dbs in each db_bucket to be some random dictionary,
// so when they're done we'll have to clean up the mess so this
// stress test can exit gracefully expecting db[i] = the ith db
- //verbose_printf("stressing %d tables using %d update threads, %d query threads\n",
+ // verbose_printf("stressing %d tables using %d update threads, %d query
+ // threads\n",
// num_buckets, update_threads, query_threads);
verbose_printf("stressing %d tables using %d update threads\n",
num_buckets, update_threads);
diff --git a/storage/tokudb/PerconaFT/src/tests/test3039.cc b/storage/tokudb/PerconaFT/src/tests/test3039.cc
index 54a2b3bf730..6c38fa13592 100644
--- a/storage/tokudb/PerconaFT/src/tests/test3039.cc
+++ b/storage/tokudb/PerconaFT/src/tests/test3039.cc
@@ -184,30 +184,36 @@ void do_threads (unsigned long long N, int do_nonlocal) {
toku_pthread_t ths[2];
struct reader_thread_state rstates[2] = {{.elapsed_time = 0.0,
.n_did_read = 0,
- .n_to_read = (long long signed) N,
- .do_local = 1,
- .finish = 0},
+ .n_to_read = (long long signed)N,
+ .do_local = 1,
+ .finish = 0},
{.elapsed_time = 0.0,
.n_did_read = 0,
.n_to_read = -1,
- .do_local = 0,
- .finish = 0}};
+ .do_local = 0,
+ .finish = 0}};
int n_to_create = do_nonlocal ? 2 : 1;
- for (int i=0; i<n_to_create; i++) {
- int r = toku_pthread_create(&ths[i], 0, reader_thread, (void*)&rstates[i]);
- CKERR(r);
+ for (int i = 0; i < n_to_create; i++) {
+ int r = toku_pthread_create(toku_uninstrumented,
+ &ths[i],
+ nullptr,
+ reader_thread,
+ static_cast<void *>(&rstates[i]));
+ CKERR(r);
}
- for (int i=0; i<n_to_create; i++) {
- void *retval;
- int r = toku_pthread_join(ths[i], &retval);
- CKERR(r);
- assert(retval==0);
- if (verbose) {
- printf("%9s thread time = %8.2fs on %9lld reads (%.3f us/read)\n",
- (i==0 ? "local" : "nonlocal"),
- rstates[i].elapsed_time, rstates[i].n_did_read, rstates[i].elapsed_time/rstates[i].n_did_read * 1e6);
- }
- rstates[1].finish = 1;
+ for (int i = 0; i < n_to_create; i++) {
+ void *retval;
+ int r = toku_pthread_join(ths[i], &retval);
+ CKERR(r);
+ assert(retval == 0);
+ if (verbose) {
+ printf("%9s thread time = %8.2fs on %9lld reads (%.3f us/read)\n",
+ (i == 0 ? "local" : "nonlocal"),
+ rstates[i].elapsed_time,
+ rstates[i].n_did_read,
+ rstates[i].elapsed_time / rstates[i].n_did_read * 1e6);
+ }
+ rstates[1].finish = 1;
}
if (verbose && do_nonlocal) {
printf("total %9lld reads (%.3f us/read)\n",
diff --git a/storage/tokudb/PerconaFT/src/tests/test_1672532.cc b/storage/tokudb/PerconaFT/src/tests/test_1672532.cc
new file mode 100644
index 00000000000..721e7677824
--- /dev/null
+++ b/storage/tokudb/PerconaFT/src/tests/test_1672532.cc
@@ -0,0 +1,210 @@
+/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
+// vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4:
+#ident "$Id$"
+/*======
+This file is part of PerconaFT.
+
+
+Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
+
+ PerconaFT is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2,
+ as published by the Free Software Foundation.
+
+ PerconaFT is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ PerconaFT is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License, version 3,
+ as published by the Free Software Foundation.
+
+ PerconaFT is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+======= */
+
+#ident \
+ "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
+
+#include "test.h"
+// to verify the DB_LOCKING_READ works to lock the read rows for snapshot
+// isolaton.
+// we create a db, then init a read transaction with repeatable-read isolation
+// and
+// locking read flag, then we start another transaction to grab the write lock.
+// DB_LOCKING_READ is defined here to just make the before and after tests work
+// (before
+// test did not have DB_LOCKING_READ flag).
+#if !defined(DB_LOCKING_READ)
+#define DB_LOCKING_READ 0
+#endif
+static int prelock_range(DBC *cursor, int left, int right) {
+ DBT key_left;
+ dbt_init(&key_left, &left, sizeof left);
+ DBT key_right;
+ dbt_init(&key_right, &right, sizeof right);
+ int r = cursor->c_set_bounds(cursor, &key_left, &key_right, true, 0);
+ return r;
+}
+
+static void test_read_write_range(DB_ENV *env,
+ DB *db,
+ uint32_t iso_flags,
+ int expect_r) {
+ int r;
+
+ DB_TXN *txn_a = NULL;
+ r = env->txn_begin(env, NULL, &txn_a, iso_flags);
+ assert_zero(r);
+ DB_TXN *txn_b = NULL;
+ r = env->txn_begin(env, NULL, &txn_b, iso_flags);
+ assert_zero(r);
+
+ DBC *cursor_a = NULL;
+ r = db->cursor(db, txn_a, &cursor_a, DB_LOCKING_READ);
+ assert_zero(r);
+ DBC *cursor_b = NULL;
+ r = db->cursor(db, txn_b, &cursor_b, DB_RMW);
+ assert_zero(r);
+
+ r = prelock_range(cursor_a, htonl(10), htonl(100));
+ assert_zero(r);
+ r = prelock_range(cursor_b, htonl(50), htonl(200));
+ assert(r == expect_r);
+
+ r = cursor_a->c_close(cursor_a);
+ assert_zero(r);
+ r = cursor_b->c_close(cursor_b);
+ assert_zero(r);
+
+ r = txn_a->commit(txn_a, 0);
+ assert_zero(r);
+ r = txn_b->commit(txn_b, 0);
+ assert_zero(r);
+}
+
+static void test_read_write_point(DB_ENV *env,
+ DB *db,
+ uint32_t iso_flags,
+ int expect_r) {
+ int r;
+
+ DB_TXN *txn1 = NULL;
+ r = env->txn_begin(env, NULL, &txn1, iso_flags);
+ assert_zero(r);
+
+ DB_TXN *txn2 = NULL;
+ r = env->txn_begin(env, NULL, &txn2, iso_flags);
+ assert_zero(r);
+
+ DBC *c1 = NULL;
+ r = db->cursor(db, txn1, &c1, DB_LOCKING_READ);
+ assert_zero(r);
+
+ DBC *c2 = NULL;
+ r = db->cursor(db, txn2, &c2, DB_RMW);
+ assert_zero(r);
+
+ int k = htonl(42);
+ DBT key;
+ dbt_init(&key, &k, sizeof k);
+ DBT val;
+ memset(&val, 0, sizeof val);
+ r = c1->c_get(c1, &key, &val, DB_SET);
+ assert_zero(r);
+
+ r = c2->c_get(c2, &key, &val, DB_SET);
+ assert(r == expect_r);
+
+ r = c1->c_close(c1);
+ assert_zero(r);
+ r = c2->c_close(c2);
+ assert_zero(r);
+
+ r = txn1->commit(txn1, 0);
+ assert_zero(r);
+ r = txn2->commit(txn2, 0);
+ assert_zero(r);
+}
+
+int test_main(int argc, char *const argv[]) {
+ int r;
+
+ const char *env_dir = TOKU_TEST_FILENAME;
+ const char *db_filename = "lockingreadtest";
+
+ parse_args(argc, argv);
+
+ char rm_cmd[strlen(env_dir) + strlen("rm -rf ") + 1];
+ snprintf(rm_cmd, sizeof(rm_cmd), "rm -rf %s", env_dir);
+ r = system(rm_cmd);
+ assert_zero(r);
+
+ r = toku_os_mkdir(env_dir, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
+ assert_zero(r);
+
+ DB_ENV *env = NULL;
+ r = db_env_create(&env, 0);
+ assert_zero(r);
+ int env_open_flags = DB_CREATE | DB_PRIVATE | DB_INIT_MPOOL | DB_INIT_TXN |
+ DB_INIT_LOCK | DB_INIT_LOG;
+ r = env->open(
+ env, env_dir, env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+ assert_zero(r);
+
+ // create the db
+ DB *db = NULL;
+ r = db_create(&db, env, 0);
+ assert_zero(r);
+ DB_TXN *create_txn = NULL;
+ r = env->txn_begin(env, NULL, &create_txn, 0);
+ assert_zero(r);
+ r = db->open(db,
+ create_txn,
+ db_filename,
+ NULL,
+ DB_BTREE,
+ DB_CREATE,
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+ assert_zero(r);
+ r = create_txn->commit(create_txn, 0);
+ assert_zero(r);
+
+ // add a record
+
+ DB_TXN *write_txn = NULL;
+ r = env->txn_begin(env, NULL, &write_txn, 0);
+ assert_zero(r);
+
+ int k = htonl(42);
+ int v = 42;
+ DBT key;
+ dbt_init(&key, &k, sizeof k);
+ DBT val;
+ dbt_init(&val, &v, sizeof v);
+ r = db->put(db, write_txn, &key, &val, DB_NOOVERWRITE);
+ assert_zero(r);
+ r = write_txn->commit(write_txn, 0);
+ assert_zero(r);
+
+ test_read_write_range(env, db, DB_TXN_SNAPSHOT, DB_LOCK_NOTGRANTED);
+ test_read_write_point(env, db, DB_TXN_SNAPSHOT, DB_LOCK_NOTGRANTED);
+
+ r = db->close(db, 0);
+ assert_zero(r);
+
+ r = env->close(env, 0);
+ assert_zero(r);
+ return 0;
+}
diff --git a/storage/tokudb/PerconaFT/src/tests/test_3645.cc b/storage/tokudb/PerconaFT/src/tests/test_3645.cc
index bb5566b032d..e1fa37bef54 100644
--- a/storage/tokudb/PerconaFT/src/tests/test_3645.cc
+++ b/storage/tokudb/PerconaFT/src/tests/test_3645.cc
@@ -239,33 +239,61 @@ test_evictions (void) {
// make the forward fast scanner
myargs[0].fast = true;
myargs[0].fwd = true;
- { int chk_r = toku_pthread_create(&mytids[0], NULL, scan_db, &myargs[0]); CKERR(chk_r); }
+ {
+ int chk_r = toku_pthread_create(
+ toku_uninstrumented, &mytids[0], nullptr, scan_db, &myargs[0]);
+ CKERR(chk_r);
+ }
// make the forward slow scanner
myargs[1].fast = false;
myargs[1].fwd = true;
- { int chk_r = toku_pthread_create(&mytids[1], NULL, scan_db, &myargs[1]); CKERR(chk_r); }
+ {
+ int chk_r = toku_pthread_create(
+ toku_uninstrumented, &mytids[1], nullptr, scan_db, &myargs[1]);
+ CKERR(chk_r);
+ }
// make the backward fast scanner
myargs[2].fast = true;
myargs[2].fwd = false;
- { int chk_r = toku_pthread_create(&mytids[2], NULL, scan_db, &myargs[2]); CKERR(chk_r); }
+ {
+ int chk_r = toku_pthread_create(
+ toku_uninstrumented, &mytids[2], nullptr, scan_db, &myargs[2]);
+ CKERR(chk_r);
+ }
// make the backward slow scanner
myargs[3].fast = false;
myargs[3].fwd = false;
- { int chk_r = toku_pthread_create(&mytids[3], NULL, scan_db, &myargs[3]); CKERR(chk_r); }
+ {
+ int chk_r = toku_pthread_create(
+ toku_uninstrumented, &mytids[3], nullptr, scan_db, &myargs[3]);
+ CKERR(chk_r);
+ }
// make the guy that updates the db
- { int chk_r = toku_pthread_create(&mytids[4], NULL, update_db, &myargs[4]); CKERR(chk_r); }
+ {
+ int chk_r = toku_pthread_create(
+ toku_uninstrumented, &mytids[4], nullptr, update_db, &myargs[4]);
+ CKERR(chk_r);
+ }
// make the guy that does point queries
- { int chk_r = toku_pthread_create(&mytids[5], NULL, ptquery_db, &myargs[5]); CKERR(chk_r); }
+ {
+ int chk_r = toku_pthread_create(
+ toku_uninstrumented, &mytids[5], nullptr, ptquery_db, &myargs[5]);
+ CKERR(chk_r);
+ }
// make the guy that sleeps
- { int chk_r = toku_pthread_create(&mytids[6], NULL, test_time, NULL); CKERR(chk_r); }
-
- for (uint32_t i = 0; i < sizeof(myargs)/sizeof(myargs[0]); i++) {
+ {
+ int chk_r = toku_pthread_create(
+ toku_uninstrumented, &mytids[6], nullptr, test_time, nullptr);
+ CKERR(chk_r);
+ }
+
+ for (uint32_t i = 0; i < sizeof(myargs) / sizeof(myargs[0]); i++) {
void *ret;
r = toku_pthread_join(mytids[i], &ret); assert_zero(r);
}
diff --git a/storage/tokudb/PerconaFT/src/tests/test_4015.cc b/storage/tokudb/PerconaFT/src/tests/test_4015.cc
index dc18242b489..1231e3b4bca 100644
--- a/storage/tokudb/PerconaFT/src/tests/test_4015.cc
+++ b/storage/tokudb/PerconaFT/src/tests/test_4015.cc
@@ -151,10 +151,18 @@ int test_main(int argc, char * const argv[]) {
{ int chk_r = db->open(db, NULL, "db", NULL, DB_BTREE, DB_CREATE, 0666); CKERR(chk_r); }
DBT desc;
dbt_init(&desc, "foo", sizeof("foo"));
- IN_TXN_COMMIT(env, NULL, txn, 0,
- { int chk_r = db->change_descriptor(db, txn, &desc, DB_UPDATE_CMP_DESCRIPTOR); CKERR(chk_r); });
+ IN_TXN_COMMIT(env, NULL, txn, 0, {
+ int chk_r =
+ db->change_descriptor(db, txn, &desc, DB_UPDATE_CMP_DESCRIPTOR);
+ CKERR(chk_r);
+ });
pthread_t thd;
- { int chk_r = toku_pthread_create(&thd, NULL, startA, NULL); CKERR(chk_r); }
+ {
+ int chk_r =
+ toku_pthread_create(
+ toku_uninstrumented, &thd, nullptr, startA, nullptr);
+ CKERR(chk_r);
+ }
startB();
diff --git a/storage/tokudb/PerconaFT/src/tests/test_abort1.cc b/storage/tokudb/PerconaFT/src/tests/test_abort1.cc
index 55449610ffb..7b60364878b 100644
--- a/storage/tokudb/PerconaFT/src/tests/test_abort1.cc
+++ b/storage/tokudb/PerconaFT/src/tests/test_abort1.cc
@@ -87,10 +87,12 @@ test_db_open_aborts (void) {
CKERR2(r, DB_NOTFOUND);
}
toku_struct_stat statbuf;
- char filename[TOKU_PATH_MAX+1];
- r = toku_stat(toku_path_join(filename, 2, TOKU_TEST_FILENAME, "foo.db"), &statbuf);
- assert(r!=0);
- assert(errno==ENOENT);
+ char filename[TOKU_PATH_MAX + 1];
+ r = toku_stat(toku_path_join(filename, 2, TOKU_TEST_FILENAME, "foo.db"),
+ &statbuf,
+ toku_uninstrumented);
+ assert(r != 0);
+ assert(errno == ENOENT);
}
r=env->close(env, 0); assert(r==0);
@@ -153,10 +155,12 @@ test_db_put_aborts (void) {
CAST_FROM_VOIDP(filename, iname.data);
assert(filename);
}
- toku_struct_stat statbuf;
- char fullfile[TOKU_PATH_MAX+1];
- r = toku_stat(toku_path_join(fullfile, 2, TOKU_TEST_FILENAME, filename), &statbuf);
- assert(r==0);
+ toku_struct_stat statbuf;
+ char fullfile[TOKU_PATH_MAX + 1];
+ r = toku_stat(toku_path_join(fullfile, 2, TOKU_TEST_FILENAME, filename),
+ &statbuf,
+ toku_uninstrumented);
+ assert(r == 0);
toku_free(filename);
}
// But the item should not be in it.
diff --git a/storage/tokudb/PerconaFT/src/tests/test_abort4.cc b/storage/tokudb/PerconaFT/src/tests/test_abort4.cc
index e67efb465b2..e797fc640d8 100644
--- a/storage/tokudb/PerconaFT/src/tests/test_abort4.cc
+++ b/storage/tokudb/PerconaFT/src/tests/test_abort4.cc
@@ -160,10 +160,12 @@ verify_and_tear_down(int close_first) {
CAST_FROM_VOIDP(filename, iname.data);
assert(filename);
}
- toku_struct_stat statbuf;
- char fullfile[TOKU_PATH_MAX+1];
- r = toku_stat(toku_path_join(fullfile, 2, TOKU_TEST_FILENAME, filename), &statbuf);
- assert(r==0);
+ toku_struct_stat statbuf;
+ char fullfile[TOKU_PATH_MAX + 1];
+ r = toku_stat(toku_path_join(fullfile, 2, TOKU_TEST_FILENAME, filename),
+ &statbuf,
+ toku_uninstrumented);
+ assert(r == 0);
toku_free(filename);
}
CKERR(r);
diff --git a/storage/tokudb/PerconaFT/src/tests/test_abort5.cc b/storage/tokudb/PerconaFT/src/tests/test_abort5.cc
index 728afcce1b9..d5d056d5126 100644
--- a/storage/tokudb/PerconaFT/src/tests/test_abort5.cc
+++ b/storage/tokudb/PerconaFT/src/tests/test_abort5.cc
@@ -191,10 +191,12 @@ verify_and_tear_down(int close_first) {
CAST_FROM_VOIDP(filename, iname.data);
assert(filename);
}
- toku_struct_stat statbuf;
- char fullfile[TOKU_PATH_MAX+1];
- r = toku_stat(toku_path_join(fullfile, 2, TOKU_TEST_FILENAME, filename), &statbuf);
- assert(r==0);
+ toku_struct_stat statbuf;
+ char fullfile[TOKU_PATH_MAX + 1];
+ r = toku_stat(toku_path_join(fullfile, 2, TOKU_TEST_FILENAME, filename),
+ &statbuf,
+ toku_uninstrumented);
+ assert(r == 0);
toku_free(filename);
}
if (close_first) {
diff --git a/storage/tokudb/PerconaFT/src/tests/test_forkjoin.cc b/storage/tokudb/PerconaFT/src/tests/test_forkjoin.cc
index 910cf46e513..766372a15c2 100644
--- a/storage/tokudb/PerconaFT/src/tests/test_forkjoin.cc
+++ b/storage/tokudb/PerconaFT/src/tests/test_forkjoin.cc
@@ -48,12 +48,13 @@ f (void *arg) {
return arg;
}
-int
-test_main(int argc, char *const argv[]) {
+int test_main(int argc, char *const argv[]) {
parse_args(argc, argv);
toku_pthread_t t;
- int r = toku_pthread_create(&t, 0, f, 0); assert(r == 0);
+ int r = toku_pthread_create(toku_uninstrumented, &t, nullptr, f, nullptr);
+ assert(r == 0);
void *ret;
- r = toku_pthread_join(t, &ret); assert(r == 0);
+ r = toku_pthread_join(t, &ret);
+ assert(r == 0);
return 0;
}
diff --git a/storage/tokudb/PerconaFT/src/tests/test_groupcommit_count.cc b/storage/tokudb/PerconaFT/src/tests/test_groupcommit_count.cc
index 414ddd2b70a..35104c2a569 100644
--- a/storage/tokudb/PerconaFT/src/tests/test_groupcommit_count.cc
+++ b/storage/tokudb/PerconaFT/src/tests/test_groupcommit_count.cc
@@ -87,12 +87,16 @@ test_groupcommit (int nthreads) {
int i;
toku_pthread_t threads[nthreads];
int whichthread[nthreads];
- for (i=0; i<nthreads; i++) {
- whichthread[i]=i;
- r=toku_pthread_create(&threads[i], 0, start_a_thread, &whichthread[i]);
+ for (i = 0; i < nthreads; i++) {
+ whichthread[i] = i;
+ r = toku_pthread_create(toku_uninstrumented,
+ &threads[i],
+ nullptr,
+ start_a_thread,
+ &whichthread[i]);
}
- for (i=0; i<nthreads; i++) {
- toku_pthread_join(threads[i], 0);
+ for (i = 0; i < nthreads; i++) {
+ toku_pthread_join(threads[i], 0);
}
r=db->close(db, 0); assert(r==0);
diff --git a/storage/tokudb/PerconaFT/src/tests/test_groupcommit_perf.cc b/storage/tokudb/PerconaFT/src/tests/test_groupcommit_perf.cc
index 94eaf2a01a9..6f872d10a32 100644
--- a/storage/tokudb/PerconaFT/src/tests/test_groupcommit_perf.cc
+++ b/storage/tokudb/PerconaFT/src/tests/test_groupcommit_perf.cc
@@ -84,12 +84,16 @@ test_groupcommit (int nthreads) {
int i;
toku_pthread_t threads[nthreads];
int whichthread[nthreads];
- for (i=0; i<nthreads; i++) {
- whichthread[i]=i;
- r=toku_pthread_create(&threads[i], 0, start_a_thread, &whichthread[i]);
+ for (i = 0; i < nthreads; i++) {
+ whichthread[i] = i;
+ r = toku_pthread_create(toku_uninstrumented,
+ &threads[i],
+ nullptr,
+ start_a_thread,
+ &whichthread[i]);
}
- for (i=0; i<nthreads; i++) {
- toku_pthread_join(threads[i], 0);
+ for (i = 0; i < nthreads; i++) {
+ toku_pthread_join(threads[i], 0);
}
#if 0
r=env->txn_begin(env, 0, &tid, 0); CKERR(r);
diff --git a/storage/tokudb/PerconaFT/src/tests/test_iterate_pending_lock_requests.cc b/storage/tokudb/PerconaFT/src/tests/test_iterate_pending_lock_requests.cc
index f2bf0a2c756..66471a74af2 100644
--- a/storage/tokudb/PerconaFT/src/tests/test_iterate_pending_lock_requests.cc
+++ b/storage/tokudb/PerconaFT/src/tests/test_iterate_pending_lock_requests.cc
@@ -112,12 +112,17 @@ int test_main(int UU(argc), char *const UU(argv[])) {
acquire_lock(txn1, magic_key);
acquire_lock_extra e1(txn2, magic_key);
- r = toku_pthread_create(&thread1, NULL, acquire_lock_thread, &e1); CKERR(r);
+ r = toku_pthread_create(
+ toku_uninstrumented, &thread1, nullptr, acquire_lock_thread, &e1);
+ CKERR(r);
acquire_lock_extra e2(txn3, magic_key);
- r = toku_pthread_create(&thread2, NULL, acquire_lock_thread, &e2); CKERR(r);
+ r = toku_pthread_create(
+ toku_uninstrumented, &thread2, nullptr, acquire_lock_thread, &e2);
+ CKERR(r);
sleep(1);
- r = env->iterate_pending_lock_requests(env, iterate_callback, NULL); CKERR(r);
+ r = env->iterate_pending_lock_requests(env, iterate_callback, NULL);
+ CKERR(r);
invariant(iterate_callback_called == 2);
void *v;
diff --git a/storage/tokudb/PerconaFT/src/tests/test_lock_timeout_callback.cc b/storage/tokudb/PerconaFT/src/tests/test_lock_timeout_callback.cc
index 75ea49ec858..571bae69916 100644
--- a/storage/tokudb/PerconaFT/src/tests/test_lock_timeout_callback.cc
+++ b/storage/tokudb/PerconaFT/src/tests/test_lock_timeout_callback.cc
@@ -118,7 +118,8 @@ int test_main(int UU(argc), char *const UU(argv[])) {
acquire_lock(txn2, magic_key + 1);
toku_pthread_t thread;
acquire_lock_extra e(txn1, magic_key + 1);
- r = toku_pthread_create(&thread, NULL, acquire_lock_thread, &e);
+ r = toku_pthread_create(
+ toku_uninstrumented, &thread, nullptr, acquire_lock_thread, &e);
usleep(100000);
acquire_lock(txn2, magic_key);
invariant(callback_calls == 2);
diff --git a/storage/tokudb/PerconaFT/src/tests/test_log1.cc b/storage/tokudb/PerconaFT/src/tests/test_log1.cc
index 65fa1d830ef..5473a8e3d5e 100644
--- a/storage/tokudb/PerconaFT/src/tests/test_log1.cc
+++ b/storage/tokudb/PerconaFT/src/tests/test_log1.cc
@@ -87,10 +87,12 @@ static void make_db (bool close_env) {
r=tid->commit(tid, 0); assert(r==0);
r=db->close(db, 0); assert(r==0);
{
- toku_struct_stat statbuf;
- char fullfile[TOKU_PATH_MAX+1];
- r = toku_stat(toku_path_join(fullfile, 2, TOKU_TEST_FILENAME, filename), &statbuf);
- assert(r==0);
+ toku_struct_stat statbuf;
+ char fullfile[TOKU_PATH_MAX + 1];
+ r = toku_stat(toku_path_join(fullfile, 2, TOKU_TEST_FILENAME, filename),
+ &statbuf,
+ toku_uninstrumented);
+ assert(r == 0);
toku_free(filename);
}
if (close_env) {
diff --git a/storage/tokudb/PerconaFT/src/tests/test_log1_abort.cc b/storage/tokudb/PerconaFT/src/tests/test_log1_abort.cc
index 92c3657a154..c66409fb823 100644
--- a/storage/tokudb/PerconaFT/src/tests/test_log1_abort.cc
+++ b/storage/tokudb/PerconaFT/src/tests/test_log1_abort.cc
@@ -80,11 +80,13 @@ test_main (int UU(argc), char UU(*const argv[])) {
r=env->close(env, 0);
assert(r==0);
{
- toku_struct_stat statbuf;
- char filename[TOKU_PATH_MAX+1];
- r = toku_stat(toku_path_join(filename, 2, TOKU_TEST_FILENAME, "foo.db"), &statbuf);
- assert(r==-1);
- assert(errno==ENOENT);
+ toku_struct_stat statbuf;
+ char filename[TOKU_PATH_MAX + 1];
+ r = toku_stat(toku_path_join(filename, 2, TOKU_TEST_FILENAME, "foo.db"),
+ &statbuf,
+ toku_uninstrumented);
+ assert(r == -1);
+ assert(errno == ENOENT);
}
return 0;
}
diff --git a/storage/tokudb/PerconaFT/src/tests/test_logmax.cc b/storage/tokudb/PerconaFT/src/tests/test_logmax.cc
index e5de0a5d906..133eb36ddb5 100644
--- a/storage/tokudb/PerconaFT/src/tests/test_logmax.cc
+++ b/storage/tokudb/PerconaFT/src/tests/test_logmax.cc
@@ -50,14 +50,19 @@ check_logmax (int max) {
struct dirent *ent;
while ((ent=readdir(dir))) {
if ((ent->d_type==DT_REG || ent->d_type==DT_UNKNOWN) && strncmp(ent->d_name, "log", 3)==0) {
- // It is a "log*" file
- char full_fname[TOKU_PATH_MAX+1];
- toku_struct_stat sbuf;
- int r = toku_stat(toku_path_join(full_fname, 2, TOKU_TEST_FILENAME, ent->d_name), &sbuf);
- assert(r==0);
- if (verbose)
- printf("%s is of size %" PRId64 "\n", ent->d_name, (int64_t)sbuf.st_size);
- if (sbuf.st_size > max) any_too_big=1;
+ // It is a "log*" file
+ char full_fname[TOKU_PATH_MAX + 1];
+ toku_struct_stat sbuf;
+ int r = toku_stat(
+ toku_path_join(full_fname, 2, TOKU_TEST_FILENAME, ent->d_name),
+ &sbuf,
+ toku_uninstrumented);
+ assert(r == 0);
+ if (verbose)
+ printf("%s is of size %" PRId64 "\n",
+ ent->d_name,
+ (int64_t)sbuf.st_size);
+ if (sbuf.st_size > max) any_too_big=1;
}
}
assert(!any_too_big);
diff --git a/storage/tokudb/PerconaFT/src/tests/test_multiple_checkpoints_block_commit.cc b/storage/tokudb/PerconaFT/src/tests/test_multiple_checkpoints_block_commit.cc
index 66e9f4a5ec8..da53a7bfe11 100644
--- a/storage/tokudb/PerconaFT/src/tests/test_multiple_checkpoints_block_commit.cc
+++ b/storage/tokudb/PerconaFT/src/tests/test_multiple_checkpoints_block_commit.cc
@@ -101,10 +101,17 @@ static void run_test(void) {
toku_pthread_t chkpt1_tid;
toku_pthread_t chkpt2_tid;
-
- { int chk_r = toku_pthread_create(&chkpt1_tid, NULL, run_checkpoint, NULL); CKERR(chk_r); }
- { int chk_r = toku_pthread_create(&chkpt2_tid, NULL, run_checkpoint, NULL); CKERR(chk_r); }
- usleep(2*1024*1024);
+ {
+ int chk_r = toku_pthread_create(
+ toku_uninstrumented, &chkpt1_tid, nullptr, run_checkpoint, nullptr);
+ CKERR(chk_r);
+ }
+ {
+ int chk_r = toku_pthread_create(
+ toku_uninstrumented, &chkpt2_tid, nullptr, run_checkpoint, nullptr);
+ CKERR(chk_r);
+ }
+ usleep(2 * 1024 * 1024);
struct timeval tstart;
gettimeofday(&tstart, NULL);
DB_TXN *txn = NULL;
diff --git a/storage/tokudb/PerconaFT/src/tests/test_stress_hot_indexing.cc b/storage/tokudb/PerconaFT/src/tests/test_stress_hot_indexing.cc
index e0bf0d2ec6f..6395f591660 100644
--- a/storage/tokudb/PerconaFT/src/tests/test_stress_hot_indexing.cc
+++ b/storage/tokudb/PerconaFT/src/tests/test_stress_hot_indexing.cc
@@ -312,12 +312,11 @@ stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) {
run_workers(myargs, num_threads, cli_args->num_seconds, false, cli_args);
}
-int
-test_main(int argc, char *const argv[]) {
+int test_main(int argc, char *const argv[]) {
gid_count = 0;
memset(hi_gid, 0, sizeof(hi_gid));
- toku_mutex_init(&hi_lock, NULL);
- toku_mutex_init(&fops_lock, NULL);
+ toku_mutex_init(toku_uninstrumented, &hi_lock, nullptr);
+ toku_mutex_init(toku_uninstrumented, &fops_lock, nullptr);
hot_db = NULL;
struct cli_args args = get_default_args();
// let's make default checkpointing period really slow
diff --git a/storage/tokudb/PerconaFT/src/tests/test_thread_insert.cc b/storage/tokudb/PerconaFT/src/tests/test_thread_insert.cc
index 0d5245e8f80..a266de638f1 100644
--- a/storage/tokudb/PerconaFT/src/tests/test_thread_insert.cc
+++ b/storage/tokudb/PerconaFT/src/tests/test_thread_insert.cc
@@ -150,10 +150,13 @@ test_main(int argc, char *const argv[]) {
work[i].endno = n;
}
- if (verbose) printf("pid:%d\n", toku_os_getpid());
+ if (verbose)
+ printf("pid:%d\n", toku_os_getpid());
- for (i=1; i<nthreads; i++) {
- r = toku_pthread_create(&work[i].tid, 0, do_inserts, &work[i]); assert(r == 0);
+ for (i = 1; i < nthreads; i++) {
+ r = toku_pthread_create(
+ toku_uninstrumented, &work[i].tid, nullptr, do_inserts, &work[i]);
+ assert(r == 0);
}
work[0].do_exit = 0;
diff --git a/storage/tokudb/PerconaFT/src/tests/test_txn_abort7.cc b/storage/tokudb/PerconaFT/src/tests/test_txn_abort7.cc
index fb428f437b1..0a4463644b3 100644
--- a/storage/tokudb/PerconaFT/src/tests/test_txn_abort7.cc
+++ b/storage/tokudb/PerconaFT/src/tests/test_txn_abort7.cc
@@ -79,10 +79,12 @@ test_abort_create (void) {
CAST_FROM_VOIDP(filename, iname.data);
assert(filename);
}
- toku_struct_stat statbuf;
- char fullfile[TOKU_PATH_MAX+1];
- r = toku_stat(toku_path_join(fullfile, 2, TOKU_TEST_FILENAME, filename), &statbuf);
- assert(r==0);
+ toku_struct_stat statbuf;
+ char fullfile[TOKU_PATH_MAX + 1];
+ r = toku_stat(toku_path_join(fullfile, 2, TOKU_TEST_FILENAME, filename),
+ &statbuf,
+ toku_uninstrumented);
+ assert(r == 0);
toku_free(filename);
}
@@ -100,10 +102,13 @@ test_abort_create (void) {
CKERR2(r, DB_NOTFOUND);
}
toku_struct_stat statbuf;
- char fullfile[TOKU_PATH_MAX+1];
- r = toku_stat(toku_path_join(fullfile, 2, TOKU_TEST_FILENAME, "test.db"), &statbuf);
- assert(r!=0);
- assert(errno==ENOENT);
+ char fullfile[TOKU_PATH_MAX + 1];
+ r = toku_stat(
+ toku_path_join(fullfile, 2, TOKU_TEST_FILENAME, "test.db"),
+ &statbuf,
+ toku_uninstrumented);
+ assert(r != 0);
+ assert(errno == ENOENT);
}
r = env->close(env, 0); assert(r == 0);
diff --git a/storage/tokudb/PerconaFT/src/tests/threaded_stress_test_helpers.h b/storage/tokudb/PerconaFT/src/tests/threaded_stress_test_helpers.h
index f2bacceed9d..e232f327d10 100644
--- a/storage/tokudb/PerconaFT/src/tests/threaded_stress_test_helpers.h
+++ b/storage/tokudb/PerconaFT/src/tests/threaded_stress_test_helpers.h
@@ -469,11 +469,11 @@ static int get_commit_flags(struct cli_args *args) {
}
struct worker_extra {
- struct arg* thread_arg;
+ struct arg *thread_arg;
toku_mutex_t *operation_lock_mutex;
- struct rwlock *operation_lock;
+ struct st_rwlock *operation_lock;
uint64_t *counters;
- int64_t pad[4]; // pad to 64 bytes
+ int64_t pad[4]; // pad to 64 bytes
};
static void lock_worker_op(struct worker_extra* we) {
@@ -1772,11 +1772,12 @@ static int run_workers(
)
{
int r;
- const struct perf_formatter *perf_formatter = &perf_formatters[cli_args->perf_output_format];
+ const struct perf_formatter *perf_formatter =
+ &perf_formatters[cli_args->perf_output_format];
toku_mutex_t mutex = ZERO_MUTEX_INITIALIZER;
- toku_mutex_init(&mutex, nullptr);
- struct rwlock rwlock;
- rwlock_init(&rwlock);
+ toku_mutex_init(toku_uninstrumented, &mutex, nullptr);
+ struct st_rwlock rwlock;
+ rwlock_init(toku_uninstrumented, &rwlock);
toku_pthread_t tids[num_threads];
toku_pthread_t time_tid;
if (cli_args->print_performance) {
@@ -1798,15 +1799,26 @@ static int run_workers(
worker_extra[i].thread_arg = &thread_args[i];
worker_extra[i].operation_lock = &rwlock;
worker_extra[i].operation_lock_mutex = &mutex;
- XCALLOC_N((int) NUM_OPERATION_TYPES, worker_extra[i].counters);
+ XCALLOC_N((int)NUM_OPERATION_TYPES, worker_extra[i].counters);
TOKU_DRD_IGNORE_VAR(worker_extra[i].counters);
- { int chk_r = toku_pthread_create(&tids[i], nullptr, worker, &worker_extra[i]); CKERR(chk_r); }
+ {
+ int chk_r = toku_pthread_create(toku_uninstrumented,
+ &tids[i],
+ nullptr,
+ worker,
+ &worker_extra[i]);
+ CKERR(chk_r);
+ }
if (verbose)
- printf("%lu created\n", (unsigned long) tids[i]);
+ printf("%lu created\n", (unsigned long)tids[i]);
+ }
+ {
+ int chk_r = toku_pthread_create(
+ toku_uninstrumented, &time_tid, nullptr, test_time, &tte);
+ CKERR(chk_r);
}
- { int chk_r = toku_pthread_create(&time_tid, nullptr, test_time, &tte); CKERR(chk_r); }
if (verbose)
- printf("%lu created\n", (unsigned long) time_tid);
+ printf("%lu created\n", (unsigned long)time_tid);
void *ret;
r = toku_pthread_join(time_tid, &ret); assert_zero(r);
@@ -1817,17 +1829,22 @@ static int run_workers(
// threads (i.e. there is some runaway thread).
struct sleep_and_crash_extra sac_extra;
ZERO_STRUCT(sac_extra);
- toku_mutex_init(&sac_extra.mutex, nullptr);
- toku_cond_init(&sac_extra.cond, nullptr);
+ toku_mutex_init(toku_uninstrumented, &sac_extra.mutex, nullptr);
+ toku_cond_init(toku_uninstrumented, &sac_extra.cond, nullptr);
sac_extra.seconds = cli_args->join_timeout;
sac_extra.is_setup = false;
sac_extra.threads_have_joined = false;
toku_mutex_lock(&sac_extra.mutex);
toku_pthread_t sac_thread;
- r = toku_pthread_create(&sac_thread, nullptr, sleep_and_crash, &sac_extra);
+ r = toku_pthread_create(toku_uninstrumented,
+ &sac_thread,
+ nullptr,
+ sleep_and_crash,
+ &sac_extra);
assert_zero(r);
- // Wait for sleep_and_crash thread to get set up, spinning is ok, this should be quick.
+ // Wait for sleep_and_crash thread to get set up, spinning is ok, this
+ // should be quick.
while (!sac_extra.is_setup) {
toku_mutex_unlock(&sac_extra.mutex);
r = toku_pthread_yield();
diff --git a/storage/tokudb/PerconaFT/src/tests/txn_manager_handle_snapshot_atomicity.cc b/storage/tokudb/PerconaFT/src/tests/txn_manager_handle_snapshot_atomicity.cc
index 30cc16d73a7..469e78f492f 100644
--- a/storage/tokudb/PerconaFT/src/tests/txn_manager_handle_snapshot_atomicity.cc
+++ b/storage/tokudb/PerconaFT/src/tests/txn_manager_handle_snapshot_atomicity.cc
@@ -52,8 +52,8 @@ struct test_sync {
static void test_sync_init(struct test_sync *UU(sync)) {
#if TOKU_DEBUG_TXN_SYNC
sync->state = 0;
- toku_mutex_init(&sync->lock, NULL);
- toku_cond_init(&sync->cv, NULL);
+ toku_mutex_init(toku_uninstrumented, &sync->lock, nullptr);
+ toku_cond_init(toku_uninstrumented, &sync->cv, nullptr);
#endif
}
diff --git a/storage/tokudb/PerconaFT/src/ydb.cc b/storage/tokudb/PerconaFT/src/ydb.cc
index 886832cec6a..9875e9227d4 100644
--- a/storage/tokudb/PerconaFT/src/ydb.cc
+++ b/storage/tokudb/PerconaFT/src/ydb.cc
@@ -228,7 +228,7 @@ env_fs_poller(void *arg) {
int in_red; // set true to prevent certain operations (returning ENOSPC)
// get the fs sizes for the home dir
- uint64_t avail_size, total_size;
+ uint64_t avail_size = 0, total_size = 0;
r = toku_get_filesystem_sizes(env->i->dir, &avail_size, NULL, &total_size);
assert(r == 0);
in_yellow = (avail_size < 2 * env_fs_redzone(env, total_size));
@@ -644,7 +644,7 @@ static int validate_env(DB_ENV *env,
path = toku_construct_full_name(
2, env->i->dir, toku_product_name_strings.environmentdictionary);
assert(path);
- r = toku_stat(path, &buf);
+ r = toku_stat(path, &buf, toku_uninstrumented);
if (r == 0) {
expect_newenv = false; // persistent info exists
} else {
@@ -669,7 +669,7 @@ static int validate_env(DB_ENV *env,
path = toku_construct_full_name(
2, env->i->dir, toku_product_name_strings.rollback_cachefile);
assert(path);
- r = toku_stat(path, &buf);
+ r = toku_stat(path, &buf, toku_uninstrumented);
if (r == 0) {
if (expect_newenv) // rollback cachefile exists, but persistent env
// is missing
@@ -711,7 +711,7 @@ static int validate_env(DB_ENV *env,
path = toku_construct_full_name(
2, env->i->dir, toku_product_name_strings.fileopsdirectory);
assert(path);
- r = toku_stat(path, &buf);
+ r = toku_stat(path, &buf, toku_uninstrumented);
if (r == 0) {
if (expect_newenv) // fileops directory exists, but persistent env
// is missing
@@ -857,10 +857,11 @@ env_open(DB_ENV * env, const char *home, uint32_t flags, int mode) {
// Verify that the home exists.
toku_struct_stat buf;
- r = toku_stat(home, &buf);
+ r = toku_stat(home, &buf, toku_uninstrumented);
if (r != 0) {
int e = get_error_errno();
- r = toku_ydb_do_error(env, e, "Error from toku_stat(\"%s\",...)\n", home);
+ r = toku_ydb_do_error(
+ env, e, "Error from toku_stat(\"%s\",...)\n", home);
goto cleanup;
}
unused_flags &= ~DB_PRIVATE;
@@ -876,13 +877,22 @@ env_open(DB_ENV * env, const char *home, uint32_t flags, int mode) {
env->i->open_flags = flags;
env->i->open_mode = mode;
+ // Instrumentation probe start
+ TOKU_PROBE_START(toku_instr_probe_1);
+
env_setup_real_data_dir(env);
env_setup_real_log_dir(env);
env_setup_real_tmp_dir(env);
- r = toku_single_process_lock(env->i->dir, "environment", &env->i->envdir_lockfd);
- if (r!=0) goto cleanup;
- r = toku_single_process_lock(env->i->real_data_dir, "data", &env->i->datadir_lockfd);
+ // Instrumentation probe stop
+ toku_instr_probe_1->stop();
+
+ r = toku_single_process_lock(
+ env->i->dir, "environment", &env->i->envdir_lockfd);
+ if (r != 0)
+ goto cleanup;
+ r = toku_single_process_lock(
+ env->i->real_data_dir, "data", &env->i->datadir_lockfd);
if (r!=0) goto cleanup;
r = toku_single_process_lock(env->i->real_log_dir, "logs", &env->i->logdir_lockfd);
if (r!=0) goto cleanup;
@@ -2932,7 +2942,8 @@ toku_env_create(DB_ENV ** envp, uint32_t flags) {
result->i->open_dbs_by_dname->create();
XMALLOC(result->i->open_dbs_by_dict_id);
result->i->open_dbs_by_dict_id->create();
- toku_pthread_rwlock_init(&result->i->open_dbs_rwlock, NULL);
+ toku_pthread_rwlock_init(
+ *result_i_open_dbs_rwlock_key, &result->i->open_dbs_rwlock, nullptr);
*envp = result;
r = 0;
diff --git a/storage/tokudb/PerconaFT/src/ydb_db.cc b/storage/tokudb/PerconaFT/src/ydb_db.cc
index 29d21ad0452..6b4452325f4 100644
--- a/storage/tokudb/PerconaFT/src/ydb_db.cc
+++ b/storage/tokudb/PerconaFT/src/ydb_db.cc
@@ -84,53 +84,56 @@ ydb_db_layer_get_status(YDB_DB_LAYER_STATUS statp) {
*statp = ydb_db_layer_status;
}
-void create_iname_hint(const char *dname, char *hint) {
+void create_iname_hint(DB_ENV *env, const char *dname, char *hint) {
//Requires: size of hint array must be > strlen(dname)
//Copy alphanumeric characters only.
//Replace strings of non-alphanumeric characters with a single underscore.
- bool underscored = false;
- while (*dname) {
- if (isalnum(*dname)) {
- char c = *dname++;
- *hint++ = c;
- underscored = false;
- }
- else {
- if (!underscored)
- *hint++ = '_';
- dname++;
- underscored = true;
+ if (env->get_dir_per_db(env) && !toku_os_is_absolute_name(dname)) {
+ assert(dname);
+ if (*dname == '.')
+ ++dname;
+ if (*dname == '/')
+ ++dname;
+ bool underscored = false;
+ bool dbdir_is_parsed = false;
+ // Do not change the first '/' because this is
+ // delimiter which splits name into database dir
+ // and table dir.
+ while (*dname) {
+ if (isalnum(*dname) || (*dname == '/' && !dbdir_is_parsed)) {
+ char c = *dname++;
+ *hint++ = c;
+ if (c == '/')
+ dbdir_is_parsed = true;
+ underscored = false;
+ } else if (!dbdir_is_parsed) {
+ char c = *dname++;
+ *hint++ = c;
+ } else {
+ if (!underscored)
+ *hint++ = '_';
+ dname++;
+ underscored = true;
+ }
}
- }
- *hint = '\0';
-}
-
-void create_iname_hint_for_dbdir(const char *dname, char *hint) {
- assert(dname);
- if (*dname == '.')
- ++dname;
- if (*dname == '/')
- ++dname;
- bool underscored = false;
- bool dbdir_is_parsed = false;
- // Do not change the first '/' because this is
- // delimiter which splits name into database dir
- // and table dir.
- while (*dname) {
- if (isalnum(*dname) || (*dname == '/' && !dbdir_is_parsed)) {
- char c = *dname++;
- *hint++ = c;
- if (c == '/')
- dbdir_is_parsed = true;
- underscored = false;
- } else {
- if (!underscored)
- *hint++ = '_';
- dname++;
- underscored = true;
+ *hint = '\0';
+ } else {
+ bool underscored = false;
+ while (*dname) {
+ if (isalnum(*dname)) {
+ char c = *dname++;
+ *hint++ = c;
+ underscored = false;
+ }
+ else {
+ if (!underscored)
+ *hint++ = '_';
+ dname++;
+ underscored = true;
+ }
}
+ *hint = '\0';
}
- *hint = '\0';
}
// n < 0 means to ignore mark and ignore n
@@ -188,10 +191,7 @@ std::unique_ptr<char[], decltype(&toku_free)> generate_iname_for_rename_or_open(
} else if (is_open)
id1 = toku_sync_fetch_and_add(&nontransactional_open_id, 1);
- if (env->get_dir_per_db(env) && !toku_os_is_absolute_name(dname))
- create_iname_hint_for_dbdir(dname, hint);
- else
- create_iname_hint(dname, hint);
+ create_iname_hint(env, dname, hint);
result.reset(create_iname(env, id1, id2, hint, NULL, -1));
@@ -1222,15 +1222,18 @@ load_inames(DB_ENV * env, DB_TXN * txn, int N, DB * dbs[/*N*/], const char * new
for (i = 0; i < N; i++) {
char * dname = dbs[i]->i->dname;
toku_fill_dbt(&dname_dbt, dname, strlen(dname)+1);
+
// now create new iname
char hint[strlen(dname) + 1];
- if (env->get_dir_per_db(env) && !toku_os_is_absolute_name(dname))
- create_iname_hint_for_dbdir(dname, hint);
- else
- create_iname_hint(dname, hint);
- const char *new_iname = create_iname(env, xid.parent_id64, xid.child_id64, hint, mark, i); // allocates memory for iname_in_env
+ create_iname_hint(env, dname, hint);
+
+ // allocates memory for iname_in_env
+ const char *new_iname =
+ create_iname(env, xid.parent_id64, xid.child_id64, hint, mark, i);
new_inames_in_env[i] = new_iname;
- toku_fill_dbt(&iname_dbt, new_iname, strlen(new_iname) + 1); // iname_in_env goes in directory
+
+ // iname_in_env goes in directory
+ toku_fill_dbt(&iname_dbt, new_iname, strlen(new_iname) + 1);
rval = toku_db_put(env->i->directory, txn, &dname_dbt, &iname_dbt, 0, true);
if (rval) break;
}
diff --git a/storage/tokudb/PerconaFT/src/ydb_db.h b/storage/tokudb/PerconaFT/src/ydb_db.h
index 8be28857c14..ab8fcd2a401 100644
--- a/storage/tokudb/PerconaFT/src/ydb_db.h
+++ b/storage/tokudb/PerconaFT/src/ydb_db.h
@@ -122,8 +122,7 @@ toku_db_destruct_autotxn(DB_TXN *txn, int r, bool changed) {
return r;
}
-void create_iname_hint_for_dbdir(const char *dname, char *hint);
-void create_iname_hint(const char *dname, char *hint);
+void create_iname_hint(DB_ENV *env, const char *dname, char *hint);
char *create_iname(DB_ENV *env,
uint64_t id1,
uint64_t id2,
diff --git a/storage/tokudb/PerconaFT/src/ydb_env_func.cc b/storage/tokudb/PerconaFT/src/ydb_env_func.cc
index cd5388106ac..aa8f9063a7e 100644
--- a/storage/tokudb/PerconaFT/src/ydb_env_func.cc
+++ b/storage/tokudb/PerconaFT/src/ydb_env_func.cc
@@ -110,7 +110,7 @@ void db_env_set_func_pread (ssize_t (*fun)(int, void *, size_t, off_t)) {
}
void db_env_set_func_loader_fwrite (size_t (*fwrite_fun)(const void*,size_t,size_t,FILE*)) {
- ft_loader_set_os_fwrite(fwrite_fun);
+ toku_set_func_fwrite(fwrite_fun);
}
void db_env_set_func_malloc (void *(*f)(size_t)) {
diff --git a/storage/tokudb/PerconaFT/src/ydb_txn.cc b/storage/tokudb/PerconaFT/src/ydb_txn.cc
index 40b479055f2..dd5fb3b8f0c 100644
--- a/storage/tokudb/PerconaFT/src/ydb_txn.cc
+++ b/storage/tokudb/PerconaFT/src/ydb_txn.cc
@@ -540,10 +540,12 @@ int toku_txn_begin(DB_ENV *env, DB_TXN * stxn, DB_TXN ** txn, uint32_t flags) {
db_txn_struct_i(result)->iso = child_isolation;
db_txn_struct_i(result)->lt_map.create_no_array();
- toku_mutex_init(&db_txn_struct_i(result)->txn_mutex, NULL);
+ toku_mutex_init(*db_txn_struct_i_txn_mutex_key,
+ &db_txn_struct_i(result)->txn_mutex,
+ nullptr);
TXN_SNAPSHOT_TYPE snapshot_type;
- switch(db_txn_struct_i(result)->iso){
+ switch (db_txn_struct_i(result)->iso) {
case(TOKU_ISO_SNAPSHOT):
{
snapshot_type = TXN_SNAPSHOT_ROOT;
@@ -603,7 +605,9 @@ void toku_keep_prepared_txn_callback (DB_ENV *env, TOKUTXN tokutxn) {
toku_txn_set_container_db_txn(tokutxn, result);
- toku_mutex_init(&db_txn_struct_i(result)->txn_mutex, NULL);
+ toku_mutex_init(*db_txn_struct_i_txn_mutex_key,
+ &db_txn_struct_i(result)->txn_mutex,
+ nullptr);
}
// Test-only function