Commit ac6aa66e authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

#4045 add envdir to stress tests so we can run them in parallel refs[t:4045]

git-svn-id: file:///svn/toku/tokudb@35822 c7de825b-a66e-492c-adef-691d508d4ae1
parent 9acace70
...@@ -965,8 +965,12 @@ check_blocking_tdb: $(BLOCKING_TDB_TESTS) ...@@ -965,8 +965,12 @@ check_blocking_tdb: $(BLOCKING_TDB_TESTS)
check_blocking_bdb: $(BLOCKING_BDB_TESTS) check_blocking_bdb: $(BLOCKING_BDB_TESTS)
check_drd: drd_tiny_test_stress1.tdbrun check_drd: drd_tiny_test_stress1.tdbrun drd_test_stress1.tdbrun
true true
drd_tiny_test_stress1.tdbrun: test_stress1.tdb drd_tiny_test_stress1.tdbrun: test_stress1.tdb
$(VALGRIND) --tool=drd --quiet --suppressions=drd.suppressions ./test_stress1.tdb --num_seconds 5 --num_elements 150 $(VALGRIND) --tool=drd --quiet --suppressions=drd.suppressions ./test_stress1.tdb --num_seconds 5 --num_elements 150 --envdir dir.$@
drd_test_stress1.tdbrun: test_stress1.tdb
./test_stress1.tdb --only_create --envdir dir.$@ && \
$(VALGRIND) --tool=drd --quiet --suppressions=drd.suppressions ./test_stress1.tdb --only_stress --num_seconds 10 --envdir dir.$@
...@@ -566,20 +566,22 @@ static int create_table(DB_ENV **env_res, DB **db_res, ...@@ -566,20 +566,22 @@ static int create_table(DB_ENV **env_res, DB **db_res,
u_int32_t cachesize, u_int32_t cachesize,
u_int32_t checkpointing_period, u_int32_t checkpointing_period,
u_int32_t pagesize, u_int32_t pagesize,
u_int32_t readpagesize) { u_int32_t readpagesize,
char *envdir) {
int r; int r;
r = system("rm -rf " ENVDIR); char rmcmd[32 + strlen(envdir)]; sprintf(rmcmd, "rm -rf %s", envdir);
r = system(rmcmd);
CKERR(r); CKERR(r);
r=toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0); r = toku_os_mkdir(envdir, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0);
DB_ENV *env; DB_ENV *env;
r = db_env_create(&env, 0); assert(r == 0); r = db_env_create(&env, 0); assert(r == 0);
r = env->set_redzone(env, 0); CKERR(r); r = env->set_redzone(env, 0); CKERR(r);
r=env->set_default_bt_compare(env, bt_compare); CKERR(r); r = env->set_default_bt_compare(env, bt_compare); CKERR(r);
r = env->set_cachesize(env, 0, cachesize, 1); CKERR(r); r = env->set_cachesize(env, 0, cachesize, 1); CKERR(r);
r = env->set_generate_row_callback_for_put(env, generate_row_for_put); CKERR(r); r = env->set_generate_row_callback_for_put(env, generate_row_for_put); 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); 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);
r = env->checkpointing_set_period(env, checkpointing_period); r = env->checkpointing_set_period(env, checkpointing_period);
CKERR(r); CKERR(r);
...@@ -658,19 +660,20 @@ static int open_table(DB_ENV **env_res, DB **db_res, ...@@ -658,19 +660,20 @@ static int open_table(DB_ENV **env_res, DB **db_res,
int (*bt_compare)(DB *, const DBT *, const DBT *), int (*bt_compare)(DB *, const DBT *, const DBT *),
u_int64_t cachesize, u_int64_t cachesize,
u_int32_t checkpointing_period, u_int32_t checkpointing_period,
test_update_callback_f f) { test_update_callback_f f,
char *envdir) {
int r; int r;
/* create the dup database file */ /* create the dup database file */
DB_ENV *env; DB_ENV *env;
r = db_env_create(&env, 0); assert(r == 0); r = db_env_create(&env, 0); assert(r == 0);
r = env->set_redzone(env, 0); CKERR(r); r = env->set_redzone(env, 0); CKERR(r);
r=env->set_default_bt_compare(env, bt_compare); CKERR(r); r = env->set_default_bt_compare(env, bt_compare); CKERR(r);
env->set_update(env, f); env->set_update(env, f);
// set the cache size to 10MB // set the cache size to 10MB
r = env->set_cachesize(env, cachesize / (1 << 30), cachesize % (1 << 30), 1); CKERR(r); r = env->set_cachesize(env, cachesize / (1 << 30), cachesize % (1 << 30), 1); CKERR(r);
r = env->set_generate_row_callback_for_put(env, generate_row_for_put); CKERR(r); r = env->set_generate_row_callback_for_put(env, generate_row_for_put); CKERR(r);
r=env->open(env, ENVDIR, DB_RECOVER|DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r = env->open(env, envdir, DB_RECOVER|DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = env->checkpointing_set_period(env, checkpointing_period); r = env->checkpointing_set_period(env, checkpointing_period);
CKERR(r); CKERR(r);
...@@ -706,6 +709,7 @@ struct cli_args { ...@@ -706,6 +709,7 @@ struct cli_args {
test_update_callback_f update_function; test_update_callback_f update_function;
bool do_test_and_crash; bool do_test_and_crash;
bool do_recover; bool do_recover;
char *envdir;
}; };
static const struct cli_args DEFAULT_ARGS = { static const struct cli_args DEFAULT_ARGS = {
...@@ -721,7 +725,8 @@ static const struct cli_args DEFAULT_ARGS = { ...@@ -721,7 +725,8 @@ static const struct cli_args DEFAULT_ARGS = {
.num_ptquery_threads = 1, .num_ptquery_threads = 1,
.update_function = update_op_callback, .update_function = update_op_callback,
.do_test_and_crash = false, .do_test_and_crash = false,
.do_recover = false .do_recover = false,
.envdir = ENVDIR,
}; };
static inline void parse_stress_test_args (int argc, char *const argv[], struct cli_args *args) { static inline void parse_stress_test_args (int argc, char *const argv[], struct cli_args *args) {
...@@ -749,43 +754,35 @@ static inline void parse_stress_test_args (int argc, char *const argv[], struct ...@@ -749,43 +754,35 @@ static inline void parse_stress_test_args (int argc, char *const argv[], struct
exit(resultcode); exit(resultcode);
} }
else if (strcmp(argv[1], "--num_elements") == 0) { else if (strcmp(argv[1], "--num_elements") == 0) {
argc--; argc--; argv++;
argv++;
args->num_elements = atoi(argv[1]); args->num_elements = atoi(argv[1]);
} }
else if (strcmp(argv[1], "--num_seconds") == 0) { else if (strcmp(argv[1], "--num_seconds") == 0) {
argc--; argc--; argv++;
argv++;
args->time_of_test = atoi(argv[1]); args->time_of_test = atoi(argv[1]);
} }
else if (strcmp(argv[1], "--node_size") == 0) { else if (strcmp(argv[1], "--node_size") == 0) {
argc--; argc--; argv++;
argv++;
args->node_size = atoi(argv[1]); args->node_size = atoi(argv[1]);
} }
else if (strcmp(argv[1], "--basement_node_size") == 0) { else if (strcmp(argv[1], "--basement_node_size") == 0) {
argc--; argc--; argv++;
argv++;
args->basement_node_size = atoi(argv[1]); args->basement_node_size = atoi(argv[1]);
} }
else if (strcmp(argv[1], "--cachetable_size") == 0) { else if (strcmp(argv[1], "--cachetable_size") == 0) {
argc--; argc--; argv++;
argv++;
args->cachetable_size = strtoll(argv[1], NULL, 0); args->cachetable_size = strtoll(argv[1], NULL, 0);
} }
else if (strcmp(argv[1], "--checkpointing_period") == 0) { else if (strcmp(argv[1], "--checkpointing_period") == 0) {
argc--; argc--; argv++;
argv++;
args->checkpointing_period = atoi(argv[1]); args->checkpointing_period = atoi(argv[1]);
} }
else if (strcmp(argv[1], "--update_broadcast_period") == 0) { else if (strcmp(argv[1], "--update_broadcast_period") == 0) {
argc--; argc--; argv++;
argv++;
args->update_broadcast_period_ms = atoi(argv[1]); args->update_broadcast_period_ms = atoi(argv[1]);
} }
else if (strcmp(argv[1], "--num_ptquery_threads") == 0) { else if (strcmp(argv[1], "--num_ptquery_threads") == 0) {
argc--; argc--; argv++;
argv++;
args->num_ptquery_threads = atoi(argv[1]); args->num_ptquery_threads = atoi(argv[1]);
} }
else if (strcmp(argv[1], "--only_create") == 0) { else if (strcmp(argv[1], "--only_create") == 0) {
...@@ -800,6 +797,10 @@ static inline void parse_stress_test_args (int argc, char *const argv[], struct ...@@ -800,6 +797,10 @@ static inline void parse_stress_test_args (int argc, char *const argv[], struct
else if (strcmp(argv[1], "--recover") == 0) { else if (strcmp(argv[1], "--recover") == 0) {
args->do_recover = true; args->do_recover = true;
} }
else if (strcmp(argv[1], "--envdir") == 0 && argc > 1) {
argc--; argv++;
args->envdir = argv[1];
}
else { else {
resultcode=1; resultcode=1;
goto do_usage; goto do_usage;
...@@ -828,8 +829,8 @@ stress_test_main(struct cli_args *args) ...@@ -828,8 +829,8 @@ stress_test_main(struct cli_args *args)
args->cachetable_size, args->cachetable_size,
args->checkpointing_period, args->checkpointing_period,
args->node_size, args->node_size,
args->basement_node_size args->basement_node_size,
); args->envdir);
CHK(fill_table_with_zeroes(db, args->num_elements)); CHK(fill_table_with_zeroes(db, args->num_elements));
CHK(close_table(env, db)); CHK(close_table(env, db));
} }
...@@ -839,7 +840,8 @@ stress_test_main(struct cli_args *args) ...@@ -839,7 +840,8 @@ stress_test_main(struct cli_args *args)
int_dbt_cmp, int_dbt_cmp,
args->cachetable_size, //cachetable size args->cachetable_size, //cachetable size
args->checkpointing_period, // checkpoint period args->checkpointing_period, // checkpoint period
args->update_function)); args->update_function,
args->envdir));
stress_table(env, &db, args); stress_table(env, &db, args);
CHK(close_table(env, db)); CHK(close_table(env, db));
} }
...@@ -854,7 +856,8 @@ UU() stress_recover(struct cli_args *args) { ...@@ -854,7 +856,8 @@ UU() stress_recover(struct cli_args *args) {
int_dbt_cmp, int_dbt_cmp,
args->cachetable_size, //cachetable size args->cachetable_size, //cachetable size
args->checkpointing_period, // checkpoint period args->checkpointing_period, // checkpoint period
args->update_function)); args->update_function,
args->envdir));
DB_TXN* txn = NULL; DB_TXN* txn = NULL;
struct arg recover_args; struct arg recover_args;
......
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