Commit e6104d9c authored by Leif Walsh's avatar Leif Walsh Committed by Yoni Fogel

[t:3997] add cleaner thread variables to db-benchmark-test.c and scanscan.c

git-svn-id: file:///svn/toku/tokudb@36791 c7de825b-a66e-492c-adef-691d508d4ae1
parent 8e17696c
......@@ -41,6 +41,8 @@ int do_1514_point_query = 0;
int dupflags = 0;
int insert_multiple = 0;
int num_dbs = 1;
int cleaner_period = 0;
int cleaner_iterations = 0;
int noserial = 0; // Don't do the serial stuff
int norandom = 0; // Don't do the random stuff
int prelock = 0;
......@@ -215,6 +217,23 @@ static void benchmark_setup (void) {
}
#endif
#if defined(TOKUDB)
if (cleaner_period) {
r = dbenv->cleaner_set_period(dbenv, cleaner_period);
assert(r == 0);
u_int32_t period;
r = dbenv->cleaner_get_period(dbenv, &period);
assert(r == 0 && period == cleaner_period);
}
if (cleaner_iterations) {
r = dbenv->cleaner_set_iterations(dbenv, cleaner_iterations);
assert(r == 0);
u_int32_t iterations;
r = dbenv->cleaner_get_iterations(dbenv, &iterations);
assert(r == 0 && iterations == cleaner_iterations);
}
#endif
for (which = 0; which < num_dbs; which++) {
r = db_create(&dbs[which], dbenv, 0);
assert(r == 0);
......@@ -525,6 +544,8 @@ static int print_usage (const char *argv0) {
fprintf(stderr, " --append append to an existing file\n");
fprintf(stderr, " --userandom use random()\n");
fprintf(stderr, " --checkpoint-period %"PRIu32" checkpoint period\n", checkpoint_period);
fprintf(stderr, " --cleaner-period %"PRIu32" cleaner period\n", cleaner_period);
fprintf(stderr, " --cleaner-iterations %"PRIu32" cleaner iterations\n", cleaner_iterations);
fprintf(stderr, " --numdbs N Insert same items into N dbs (1 to %d)\n", MAX_DBS);
fprintf(stderr, " --insertmultiple Use DB_ENV->put_multiple api. Requires transactions.\n");
fprintf(stderr, " --redzone N redzone in percent\n");
......@@ -595,6 +616,18 @@ static int test_main (int argc, char *const argv[]) {
fprintf(stderr, "--numdbs needs between 1 and %d\n", MAX_DBS);
return print_usage(argv[0]);
}
} else if (strcmp(arg, "--cleaner-period") == 0) {
cleaner_period = atoi(argv[++i]);
if (cleaner_period < 0) {
fprintf(stderr, "--cleaner-period needs to be positive\n");
return print_usage(argv[0]);
}
} else if (strcmp(arg, "--cleaner-iterations") == 0) {
cleaner_iterations = atoi(argv[++i]);
if (cleaner_iterations < 0) {
fprintf(stderr, "--cleaner-iterations needs to be positive\n");
return print_usage(argv[0]);
}
} else if (strcmp(arg, "--compressibility") == 0) {
compressibility = atof(argv[++i]);
init_random_c(); (void) get_random_c();
......
......@@ -19,6 +19,7 @@
static const char *pname;
static enum run_mode { RUN_HWC, RUN_LWC, RUN_VERIFY, RUN_RANGE, RUN_FLATTEN} run_mode = RUN_HWC;
static int do_txns=1, prelock=0, prelockflag=0;
static int cleaner_period=0, cleaner_iterations=0;
static u_int32_t lock_flag = 0;
static long limitcount=-1;
static u_int32_t cachesize = 127*1024*1024;
......@@ -33,24 +34,26 @@ static const char *log_dir = NULL;
static int print_usage (const char *argv0) {
fprintf(stderr, "Usage:\n%s [--verify-lwc | --lwc | --nohwc] [--prelock] [--prelockflag] [--prelockwriteflag] [--env DIR] [--verbose]\n", argv0);
fprintf(stderr, " --verify-lwc means to run the light weight cursor and the heavyweight cursor to verify that they get the same answer.\n");
fprintf(stderr, " --flatten Flatten only using special flatten function\n");
fprintf(stderr, " --lwc run light weight cursors instead of heavy weight cursors\n");
fprintf(stderr, " --prelock acquire a read lock on the entire table before running\n");
fprintf(stderr, " --prelockflag pass DB_PRELOCKED to the the cursor get operation whenever the locks have been acquired\n");
fprintf(stderr, " --prelockwriteflag pass DB_PRELOCKED_WRITE to the cursor get operation\n");
fprintf(stderr, " --nox no transactions (no locking)\n");
fprintf(stderr, " --count <count> read the first COUNT rows and then stop.\n");
fprintf(stderr, " --cachesize <n> set the env cachesize to <n>\n");
fprintf(stderr, " --mysql compare keys that are mysql big int not null types\n");
fprintf(stderr, " --env DIR put db files in DIR instead of default\n");
fprintf(stderr, " --log_dir LOGDIR put the logs in LOGDIR\n");
fprintf(stderr, " --range LOW HIGH set the LOW and HIGH key boundaries in which random range queries are made\n");
fprintf(stderr, " --experiments N run N experiments (default:%d)\n", n_experiments);
fprintf(stderr, " --srandom N srandom(N)\n");
fprintf(stderr, " --recover run recovery\n");
fprintf(stderr, " --verbose print verbose information\n");
fprintf(stderr, " --bulk_fetch 0|1 do bulk fetch on lwc operations (default: 1)\n");
fprintf(stderr, " --verify-lwc means to run the light weight cursor and the heavyweight cursor to verify that they get the same answer.\n");
fprintf(stderr, " --flatten Flatten only using special flatten function\n");
fprintf(stderr, " --lwc run light weight cursors instead of heavy weight cursors\n");
fprintf(stderr, " --prelock acquire a read lock on the entire table before running\n");
fprintf(stderr, " --prelockflag pass DB_PRELOCKED to the the cursor get operation whenever the locks have been acquired\n");
fprintf(stderr, " --prelockwriteflag pass DB_PRELOCKED_WRITE to the cursor get operation\n");
fprintf(stderr, " --nox no transactions (no locking)\n");
fprintf(stderr, " --count <count> read the first COUNT rows and then stop.\n");
fprintf(stderr, " --cachesize <n> set the env cachesize to <n>\n");
fprintf(stderr, " --cleaner-period <n> set the cleaner period to <n>\n");
fprintf(stderr, " --cleaner-iterations <n> set the cleaner iterations to <n>\n");
fprintf(stderr, " --mysql compare keys that are mysql big int not null types\n");
fprintf(stderr, " --env DIR put db files in DIR instead of default\n");
fprintf(stderr, " --log_dir LOGDIR put the logs in LOGDIR\n");
fprintf(stderr, " --range LOW HIGH set the LOW and HIGH key boundaries in which random range queries are made\n");
fprintf(stderr, " --experiments N run N experiments (default:%d)\n", n_experiments);
fprintf(stderr, " --srandom N srandom(N)\n");
fprintf(stderr, " --recover run recovery\n");
fprintf(stderr, " --verbose print verbose information\n");
fprintf(stderr, " --bulk_fetch 0|1 do bulk fetch on lwc operations (default: 1)\n");
return 1;
}
......@@ -106,6 +109,14 @@ static void parse_args (int argc, char *const argv[]) {
char *end;
argc--; argv++;
cachesize=(u_int32_t)strtol(*argv, &end, 10);
} else if (strcmp(*argv, "--cleaner-period")==0 && argc>0) {
char *end;
argc--; argv++;
cleaner_period=(u_int32_t)strtol(*argv, &end, 10);
} else if (strcmp(*argv, "--cleaner-iterations")==0 && argc>0) {
char *end;
argc--; argv++;
cleaner_iterations=(u_int32_t)strtol(*argv, &end, 10);
} else if (strcmp(*argv, "--env") == 0) {
argc--; argv++;
if (argc==0) exit(print_usage(pname));
......@@ -187,6 +198,14 @@ static void scanscan_setup (void) {
double tend = gettime();
if (verbose)
printf("env open %f seconds\n", tend-tstart);
#ifdef TOKUDB
if (cleaner_period) {
r = env->cleaner_set_period(env, cleaner_period); assert(r == 0);
}
if (cleaner_iterations) {
r = env->cleaner_set_iterations(env, cleaner_iterations); assert(r == 0);
}
#endif
r = db_create(&db, env, 0); assert(r==0);
#ifndef TOKUDB
if (do_mysql) {
......
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