Commit 3ab7e8ce authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

refs #6040 get random insertions working in our examples by increasing the...

refs #6040 get random insertions working in our examples by increasing the cache size to 1G and turning checkpointing on

git-svn-id: file:///svn/toku/tokudb@53411 c7de825b-a66e-492c-adef-691d508d4ae1
parent af963ded
......@@ -280,8 +280,9 @@ int main(int argc, char *argv[]) {
long key_range = 100000;
bool do_txn = true;
u_int32_t pagesize = 0;
u_int64_t cachesize = 0;
u_int64_t cachesize = 1000000000;
int ndbs = 4;
u_int32_t checkpoint_period = 60;
int i;
for (i = 1; i < argc; i++) {
......@@ -326,6 +327,10 @@ int main(int argc, char *argv[]) {
force_multiple = atoi(argv[++i]);
continue;
}
if (strcmp(arg, "--checkpoint_period") == 0 && i+1 < argc) {
checkpoint_period = atoi(argv[++i]);
continue;
}
assert(0);
}
......@@ -350,6 +355,14 @@ int main(int argc, char *argv[]) {
r = db_env->set_generate_row_callback_for_put(db_env, my_generate_row_for_put); assert(r == 0);
#endif
r = db_env->open(db_env, db_env_dir, db_env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
#if defined(TOKUDB)
if (checkpoint_period) {
r = db_env->checkpointing_set_period(db_env, checkpoint_period); assert(r == 0);
u_int32_t period;
r = db_env->checkpointing_get_period(db_env, &period); assert(r == 0 && period == checkpoint_period);
}
#endif
// create the db
DB *dbs[ndbs];
......
......@@ -47,7 +47,7 @@ static void insert (long long v);
int keysize = sizeof (long long);
int valsize = sizeof (long long);
int pagesize = 0;
long long cachesize = 128*1024*1024;
long long cachesize = 1000000000; // 1GB
int do_1514_point_query = 0;
int dupflags = 0;
int noserial = 0; // Don't do the serial stuff
......@@ -70,8 +70,7 @@ int env_open_flags = DB_CREATE|DB_PRIVATE|DB_INIT_MPOOL;
u_int32_t put_flags = 0;
double compressibility = -1; // -1 means make it very compressible. 1 means use random bits everywhere. 2 means half the bits are random.
int do_append = 0;
int do_checkpoint_period = 0;
u_int32_t checkpoint_period = 0;
u_int32_t checkpoint_period = 60;
static void do_prelock(DB* db, DB_TXN* txn) {
if (prelock) {
......@@ -132,12 +131,11 @@ static void benchmark_setup (void) {
}
#if defined(TOKUDB)
if (do_checkpoint_period) {
r = dbenv->checkpointing_set_period(dbenv, checkpoint_period);
assert(r == 0);
if (checkpoint_period) {
printf("set checkpoint_period %u\n", checkpoint_period);
r = dbenv->checkpointing_set_period(dbenv, checkpoint_period); assert(r == 0);
u_int32_t period;
r = dbenv->checkpointing_get_period(dbenv, &period);
assert(r == 0 && period == checkpoint_period);
r = dbenv->checkpointing_get_period(dbenv, &period); assert(r == 0 && period == checkpoint_period);
}
#endif
......@@ -331,21 +329,27 @@ static void biginsert (long long n_elements, struct timeval *starttime) {
gettimeofday(&t1,0);
serial_insert_from(i);
gettimeofday(&t2,0);
if (verbose) printf("serial %9.6fs %8.0f/s ", toku_tdiff(&t2, &t1), items_per_iteration/toku_tdiff(&t2, &t1));
fflush(stdout);
if (verbose) {
printf("serial %9.6fs %8.0f/s ", toku_tdiff(&t2, &t1), items_per_iteration/toku_tdiff(&t2, &t1));
fflush(stdout);
}
}
if (!norandom) {
gettimeofday(&t1,0);
random_insert_below((i+items_per_iteration)*SERIAL_SPACING);
gettimeofday(&t2,0);
if (verbose) printf("random %9.6fs %8.0f/s ", toku_tdiff(&t2, &t1), items_per_iteration/toku_tdiff(&t2, &t1));
gettimeofday(&t1,0);
random_insert_below((i+items_per_iteration)*SERIAL_SPACING);
gettimeofday(&t2,0);
if (verbose) {
printf("random %9.6fs %8.0f/s ", toku_tdiff(&t2, &t1), items_per_iteration/toku_tdiff(&t2, &t1));
fflush(stdout);
}
}
if (verbose) {
printf("cumulative %9.6fs %8.0f/s\n", toku_tdiff(&t2, starttime), (((float)items_per_iteration*(!noserial+!norandom))/toku_tdiff(&t2, starttime))*(iteration+1));
fflush(stdout);
}
if (verbose) printf("cumulative %9.6fs %8.0f/s\n", toku_tdiff(&t2, starttime), (((float)items_per_iteration*(!noserial+!norandom))/toku_tdiff(&t2, starttime))*(iteration+1));
}
}
const long long default_n_items = 1LL<<22;
static int print_usage (const char *argv0) {
......@@ -458,7 +462,6 @@ int main (int argc, const char *argv[]) {
do_append = 1;
} else if (strcmp(arg, "--checkpoint-period") == 0) {
if (i+1 >= argc) return print_usage(argv[9]);
do_checkpoint_period = 1;
checkpoint_period = (u_int32_t) atoi(argv[++i]);
} else if (strcmp(arg, "--unique_checks") == 0) {
if (i+1 >= argc) return print_usage(argv[0]);
......
......@@ -248,11 +248,9 @@ int main(int argc, char *argv[]) {
r = db_env->open(db_env, db_env_dir, db_env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
#if defined(TOKUDB)
if (checkpoint_period) {
r = db_env->checkpointing_set_period(db_env, checkpoint_period);
assert(r == 0);
r = db_env->checkpointing_set_period(db_env, checkpoint_period); assert(r == 0);
u_int32_t period;
r = db_env->checkpointing_get_period(db_env, &period);
assert(r == 0 && period == checkpoint_period);
r = db_env->checkpointing_get_period(db_env, &period); assert(r == 0 && period == checkpoint_period);
}
#endif
......
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