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

#2934 closes[t:2934] add --optimize to db-benchmark, fix the leafentry print function

git-svn-id: file:///svn/toku/tokudb@23806 c7de825b-a66e-492c-adef-691d508d4ae1
parent 9c760a2b
...@@ -71,6 +71,7 @@ static const char *log_dir = NULL; ...@@ -71,6 +71,7 @@ static const char *log_dir = NULL;
static int commitflags = 0; static int commitflags = 0;
static int redzone = 0; static int redzone = 0;
static int redzone_set = 0; static int redzone_set = 0;
static int do_optimize = 0;
static int use_random = 0; static int use_random = 0;
enum { MAX_RANDOM_C = 16000057 }; // prime-numbers.org enum { MAX_RANDOM_C = 16000057 }; // prime-numbers.org
...@@ -330,6 +331,12 @@ static void benchmark_shutdown (void) { ...@@ -330,6 +331,12 @@ static void benchmark_shutdown (void) {
for (which = 0; which < num_dbs; which++) { for (which = 0; which < num_dbs; which++) {
DB *db = dbs[which]; DB *db = dbs[which];
if (do_optimize) {
#if defined(TOKUDB)
r = db->optimize(db);
assert(r == 0);
#endif
}
r = db->close(db, 0); r = db->close(db, 0);
assert(r == 0); assert(r == 0);
} }
...@@ -666,6 +673,8 @@ static int test_main (int argc, char *const argv[]) { ...@@ -666,6 +673,8 @@ static int test_main (int argc, char *const argv[]) {
if (i+1 >= argc) return print_usage(argv[0]); if (i+1 >= argc) return print_usage(argv[0]);
redzone_set = 1; redzone_set = 1;
redzone = atoi(argv[++i]); redzone = atoi(argv[++i]);
} else if (strcmp(arg, "--optimize") == 0) {
do_optimize = 1;
} else { } else {
return print_usage(argv[0]); return print_usage(argv[0]);
} }
......
...@@ -1334,7 +1334,7 @@ print_leafentry (FILE *outf, LEAFENTRY le) { ...@@ -1334,7 +1334,7 @@ print_leafentry (FILE *outf, LEAFENTRY le) {
// fprintf(outf, "\n%*s", i+1, " "); //Nested indenting // fprintf(outf, "\n%*s", i+1, " "); //Nested indenting
uxr = &ule.uxrs[i]; uxr = &ule.uxrs[i];
char prov = i < ule.num_cuxrs ? 'c' : 'p'; char prov = i < ule.num_cuxrs ? 'c' : 'p';
fprintf(outf, " ");
if (uxr_is_placeholder(uxr)) if (uxr_is_placeholder(uxr))
fprintf(outf, "P: xid=%016" PRIx64, uxr->xid); fprintf(outf, "P: xid=%016" PRIx64, uxr->xid);
else if (uxr_is_delete(uxr)) else if (uxr_is_delete(uxr))
......
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