diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2018-09-03 14:22:54 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2018-09-03 16:29:29 +0200 |
commit | a816eac92ac2381e1b9cd4d655e733bdeafb173e (patch) | |
tree | 9f980b71270a4d886466b58b41e8e5c024ada9d7 /storage/tokudb/PerconaFT/src | |
parent | 3cd4da3257b84e35b82fa6f5542fc78bc80dfdb9 (diff) | |
download | mariadb-git-a816eac92ac2381e1b9cd4d655e733bdeafb173e.tar.gz |
5.6.41-84.1
Diffstat (limited to 'storage/tokudb/PerconaFT/src')
-rw-r--r-- | storage/tokudb/PerconaFT/src/tests/get_last_key.cc | 32 | ||||
-rw-r--r-- | storage/tokudb/PerconaFT/src/ydb.cc | 3 |
2 files changed, 25 insertions, 10 deletions
diff --git a/storage/tokudb/PerconaFT/src/tests/get_last_key.cc b/storage/tokudb/PerconaFT/src/tests/get_last_key.cc index 3749d9ea8ff..ad6cf34fda3 100644 --- a/storage/tokudb/PerconaFT/src/tests/get_last_key.cc +++ b/storage/tokudb/PerconaFT/src/tests/get_last_key.cc @@ -161,16 +161,18 @@ static void do_test(size_t ct_size, int num_keys) r = env->txn_begin(env, nullptr, &txn, 0); CKERR(r); - DBT key, value; - for (i = 0; i < num_keys; i++) { - int v, k = toku_htonl(i); - dbt_init(&key, &k, sizeof(int)); - dbt_init(&value, &v, sizeof(int)); - get_value_by_key(&key, &value); - r = db->put(db, txn, &key, &value, 0); - CKERR(r); + { + DBT key, value; + for (i = 0; i < num_keys; i++) { + int v, k = toku_htonl(i); + dbt_init(&key, &k, sizeof(int)); + dbt_init(&value, &v, sizeof(int)); + get_value_by_key(&key, &value); + if (0) printf("put %d\n", k); + r = db->put(db, txn, &key, &value, 0); + CKERR(r); + } } - CKERR(r); int expect_r = num_keys == 0 ? DB_NOTFOUND : 0; check_last_key_matches(db, expect_r, num_keys - 1); @@ -186,13 +188,23 @@ static void do_test(size_t ct_size, int num_keys) r = env->txn_begin(env, nullptr, &txn, 0); CKERR(r); - r = db->del(db, txn, &key, 0); + // Delete the last key + { + DBT key; + int k = toku_htonl(num_keys - 1); + dbt_init(&key, &k, sizeof(int)); + if (0) printf("del %d\n", *(int*)key.data); + r = db->del(db, txn, &key, 0); + CKERR(r); + } check_last_key_matches(db, 0, num_keys - 1); r = txn->commit(txn, 0); + CKERR(r); check_last_key_matches(db, 0, num_keys - 1); r = txn2->commit(txn2, 0); + CKERR(r); check_last_key_matches(db, 0, num_keys - 1); //Run Garbage collection (NOTE does not work when everything fits in root??? WHY) diff --git a/storage/tokudb/PerconaFT/src/ydb.cc b/storage/tokudb/PerconaFT/src/ydb.cc index a172773bca3..66e7502f625 100644 --- a/storage/tokudb/PerconaFT/src/ydb.cc +++ b/storage/tokudb/PerconaFT/src/ydb.cc @@ -185,9 +185,12 @@ toku_ydb_init(void) { // Do not clean up resources if env is panicked, just exit ugly void toku_ydb_destroy(void) { + if (!ydb_layer_status.initialized) + return; if (env_is_panicked == 0) { toku_ft_layer_destroy(); } + ydb_layer_status.initialized = false; } static int |