Commit a00c0094 authored by Dave Wells's avatar Dave Wells Committed by Yoni Fogel

changed checkpoint_stress.c to work correctly with -l option. This allows...

changed checkpoint_stress.c to work correctly with -l option.  This allows testing with recovery turned on.  Incomplete, but partially addresses #1977

git-svn-id: file:///svn/toku/tokudb@14720 c7de825b-a66e-492c-adef-691d508d4ae1
parent 459df1d0
......@@ -507,6 +507,18 @@ checkpoint_stress.tdbrun: checkpoint_stress.tdb$(BINSUF) $(PTHREAD_LOCAL)
test `grep -l 'HAPPY CRASH' dir.checkpoint_stress.c.tdb/error.* |wc -l` = $$(($(STRESS_RUNS)-1)) \
) $(MAYBEINVERTER) $(SUMMARIZE_CMD)
recover_stress.tdbrun: SHELL=/bin/bash
recover_stress.tdbrun: checkpoint_stress.tdb$(BINSUF) $(PTHREAD_LOCAL)
$(VGRIND) ./$< -C -n $(STRESS_SIZE) -l $(VERBVERBOSE) && \
($(VGRIND) ./$< -C -i 0 -n $(STRESS_SIZE) -l $(VERBVERBOSE) && \
for (( i = 1; i < $(STRESS_RUNS); i++ )); do \
date; \
./$< -c -i $$i -n $(STRESS_SIZE) -l $(VERBVERBOSE) 2> dir.checkpoint_stress.c.tdb/error.$$i ; \
if ! grep -q 'HAPPY CRASH' dir.checkpoint_stress.c.tdb/error.$$i; then break; fi; \
done && \
test `grep -l 'HAPPY CRASH' dir.checkpoint_stress.c.tdb/error.* |wc -l` = $$(($(STRESS_RUNS)-1)) \
) $(MAYBEINVERTER) $(SUMMARIZE_CMD)
# helgrind1 is supposed to fail.
helgrind1.tdbrun: TDBVGRIND=$(HGRIND) --log-file=helgrind1.tdb.deleteme
helgrind1.tdbrun: MAYBEINVERTER=$(INVERTER)
......
......@@ -23,7 +23,7 @@ checkpoint_test_1(u_int32_t flags, u_int32_t n, int snap_all) {
fflush(stdout);
}
dir_create();
env_startup(0, FALSE);
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(0, FALSE);
env_startup(0, 0);
int run;
int r;
DICTIONARY_S db_control;
......
......@@ -107,7 +107,8 @@ thin_out(DB* db, int iter) {
}
}
r = txn->commit(txn, 0);
if ( !do_log_recover )
r = txn->commit(txn, 0);
CKERR(r);
}
......@@ -156,7 +157,11 @@ verify_and_insert (DB* db, int iter) {
firstkey = iter * oper_per_iter;
numkeys = oper_per_iter;
int r;
DB_TXN *txn;
r = env->txn_begin(env, NULL, &txn, 0); CKERR(r);
insert_n_fixed(db, NULL, NULL, firstkey, numkeys);
r = txn->commit(txn, 0); CKERR(r);
}
......@@ -219,8 +224,14 @@ run_test (int iter, int die) {
if (verbose)
printf("checkpoint_stress: iter = %d, cachesize (bytes) = 0x%08"PRIx64"\n", iter, cachebytes);
env_startup(cachebytes, do_log_recover);
int recovery_flags = 0;
if ( do_log_recover ) {
flags += DB_INIT_LOG;
if ( iter != 0 )
flags += DB_RECOVER;
}
env_startup(cachebytes, recovery_flags);
// create array of dictionaries
// for each dictionary verify previous iterations and perform new inserts
......
......@@ -96,7 +96,7 @@ dir_create(void) {
// pass in zeroes for default cachesize
static void UU()
env_startup(int64_t bytes, BOOL do_log_recover) {
env_startup(int64_t bytes, int recovery_flags) {
int r;
r = db_env_create(&env, 0);
CKERR(r);
......@@ -108,9 +108,7 @@ static void UU()
r = env->set_cachesize(env, bytes >> 30, bytes % (1<<30), 1);
CKERR(r);
}
int envflags = DB_INIT_LOCK | DB_INIT_MPOOL | DB_INIT_TXN | DB_CREATE | DB_PRIVATE;
if (do_log_recover)
envflags += DB_INIT_LOG | DB_RECOVER;
int envflags = DB_INIT_LOCK | DB_INIT_MPOOL | DB_INIT_TXN | DB_CREATE | DB_PRIVATE | recovery_flags;
r = env->open(env, ENVDIR, envflags, S_IRWXU+S_IRWXG+S_IRWXO);
CKERR(r);
env->set_errfile(env, stderr);
......
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