Commit 33ebb7b3 authored by Yoni Fogel's avatar Yoni Fogel

Improve checkpoint tests

git-svn-id: file:///svn/toku/tokudb@11496 c7de825b-a66e-492c-adef-691d508d4ae1
parent b04619c7
......@@ -23,7 +23,7 @@ checkpoint_test_1(u_int32_t flags, u_int32_t n, int snap_all) {
fflush(stdout);
}
dir_create();
env_startup();
env_startup(0,0);
int run;
int r;
DICTIONARY_S db_control;
......@@ -61,7 +61,7 @@ checkpoint_test_2(u_int32_t flags, u_int32_t n) {
fflush(stdout);
}
dir_create();
env_startup();
env_startup(0,0);
int run;
int r;
DICTIONARY_S db_control;
......
......@@ -88,8 +88,9 @@ dir_create(void) {
CKERR(r);
}
// pass in zeroes for default cachesize
static void UU()
env_startup(void) {
env_startup(int32_t gbytes, int32_t bytes) {
int r;
r = db_env_create(&env, 0);
CKERR(r);
......@@ -97,6 +98,10 @@ env_startup(void) {
CKERR(r);
r = env->set_default_dup_compare(env, int64_dbt_cmp);
CKERR(r);
if (gbytes | bytes) {
r = env->set_cachesize(env, gbytes, bytes, 1);
CKERR(r);
}
r = env->open(env, ENVDIR, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO);
CKERR(r);
env->set_errfile(env, stderr);
......@@ -262,8 +267,8 @@ generate_val(int64_t key) {
}
static void UU()
insert_n_fixed(DB *db1, DB *db2, DB_TXN *txn, int firstkey, int n) {
static void
insert_n(DB *db1, DB *db2, DB_TXN *txn, int firstkey, int n, int offset) {
int64_t k;
int64_t v;
int r;
......@@ -280,7 +285,7 @@ insert_n_fixed(DB *db1, DB *db2, DB_TXN *txn, int firstkey, int n) {
for (i = 0; i<n; i++) {
k = firstkey + i;
v = generate_val(k);
v = generate_val(k) + offset;
dbt_init(&key, &k, sizeof(k));
dbt_init(&val, &v, sizeof(v));
if (db1) {
......@@ -295,6 +300,20 @@ insert_n_fixed(DB *db1, DB *db2, DB_TXN *txn, int firstkey, int n) {
}
static void UU()
insert_n_broken(DB *db1, DB *db2, DB_TXN *txn, int firstkey, int n) {
insert_n(db1, db2, txn, firstkey, n, 2718);
}
static void UU()
insert_n_fixed(DB *db1, DB *db2, DB_TXN *txn, int firstkey, int n) {
insert_n(db1, db2, txn, firstkey, n, 0);
}
static void UU()
snapshot(DICTIONARY d, int do_checkpoint) {
if (do_checkpoint) {
......
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