Commit dd061396 authored by Rich Prohaska's avatar Rich Prohaska

added -DS flags to tokudb_gen to generate duplicates and dupsort header fields. closes #315

git-svn-id: file:///svn/tokudb@1939 c7de825b-a66e-492c-adef-691d508d4ae1
parent 162dcc52
...@@ -6,6 +6,7 @@ BDB_LOAD=$(BDBDIR)/bin/db_load ...@@ -6,6 +6,7 @@ BDB_LOAD=$(BDBDIR)/bin/db_load
DIFF=diff -I 'db_pagesize=' DIFF=diff -I 'db_pagesize='
OPTFLAGS = -O2
CFLAGS = -std=gnu89 -W -Wall -Wno-unused -g $(OPTFLAGS) $(GCOV_FLAGS) CFLAGS = -std=gnu89 -W -Wall -Wno-unused -g $(OPTFLAGS) $(GCOV_FLAGS)
# vars to compile bins that handle tokudb using libdb.so # vars to compile bins that handle tokudb using libdb.so
...@@ -61,9 +62,9 @@ coverage: $(UTILS) ...@@ -61,9 +62,9 @@ coverage: $(UTILS)
strip: $(STATIC_UTILS) strip: $(STATIC_UTILS)
strip $(STATIC_UTILS) strip $(STATIC_UTILS)
test: $(UTILS) $(BDB_UTILS) $(STATIC_UTILS) test_gen test_load test_dump test_bdb_tokudb test: $(UTILS) $(BDB_UTILS) $(STATIC_UTILS) test_gen test_load test_dump test_nodup test_dupsort
test-coverage: $(UTILS) test_gen test_load test_dump test_bdb_tokudb test-coverage: $(UTILS) test_gen test_load test_dump test_nodup test_dupsort
test_gen: test_gen_hex test_gen: test_gen_hex
...@@ -87,7 +88,6 @@ test_gen_hex: ...@@ -87,7 +88,6 @@ test_gen_hex:
test_load: test_load_hex test_load_text test_load: test_load_hex test_load_text
test_load_hex: test_load_hex:
#Generating $(TEST_GEN_HEX_NUMKEYS) keys. [$(TEST_GEN_HEX_LENGTHMIN),$(TEST_GEN_HEX_LENGTHLIMIT)) bytes + identifier overhead #Generating $(TEST_GEN_HEX_NUMKEYS) keys. [$(TEST_GEN_HEX_LENGTHMIN),$(TEST_GEN_HEX_LENGTHLIMIT)) bytes + identifier overhead
@echo "Generating text input > db > text" @echo "Generating text input > db > text"
...@@ -129,11 +129,26 @@ test_dump: ...@@ -129,11 +129,26 @@ test_dump:
$(UNSETTOKUENV) ./tokudb_dump.bdb $@.bdb.temp > $@.dump.tokudb.temp $(UNSETTOKUENV) ./tokudb_dump.bdb $@.bdb.temp > $@.dump.tokudb.temp
if ! $(DIFF) -q $@.dump.bdb.temp $@.dump.tokudb.temp; then echo "Test Failed!"; exit 1; fi if ! $(DIFF) -q $@.dump.bdb.temp $@.dump.tokudb.temp; then echo "Test Failed!"; exit 1; fi
test_bdb_tokudb: test_nodup:
rm -rf $@.*.temp rm -rf $@.*.temp
./tokudb_gen $(TEST_GEN_HEX_FLAGS) >$@.gen.temp ./tokudb_gen $(TEST_GEN_HEX_FLAGS) >$@.gen.temp
$(UNSETTOKUENV) $(BDB_LOAD) $@.bdb.temp <$@.gen.temp $(UNSETTOKUENV) $(BDB_LOAD) $@.bdb.temp <$@.gen.temp
$(UNSETTOKUENV) $(BDB_DUMP) $@.bdb.temp >$@.dump.bdb.temp $(UNSETTOKUENV) $(BDB_DUMP) $@.bdb.temp >$@.dump.bdb.temp
$(SETTOKUENV) ./tokudb_load $@.tdb.temp <$@.gen.temp
$(SETTOKUENV) ./tokudb_dump $@.tdb.temp >$@.dump.tdb.temp
if ! $(DIFF) -q $@.dump.bdb.temp $@.dump.tdb.temp; then echo "$@ failed"; exit 1; fi
$(SETTOKUENV) ./tokudb_load_static $@.tdb.temp <$@.gen.temp
$(SETTOKUENV) ./tokudb_dump_static $@.tdb.temp >$@.dump.tdb.temp
if ! $(DIFF) -q $@.dump.bdb.temp $@.dump.tdb.temp; then echo "$@ failed"; exit 1; fi
test_dupsort:
rm -rf $@.*.temp
./tokudb_gen $(TEST_GEN_HEX_FLAGS) -DS >$@.gen.temp
$(UNSETTOKUENV) $(BDB_LOAD) $@.bdb.temp <$@.gen.temp
$(UNSETTOKUENV) $(BDB_DUMP) $@.bdb.temp >$@.dump.bdb.temp
$(SETTOKUENV) ./tokudb_load $@.tdb.temp <$@.gen.temp
$(SETTOKUENV) ./tokudb_dump $@.tdb.temp >$@.dump.tdb.temp
if ! $(DIFF) -q $@.dump.bdb.temp $@.dump.tdb.temp; then echo "$@ failed"; exit 1; fi
$(SETTOKUENV) ./tokudb_load_static $@.tdb.temp <$@.gen.temp $(SETTOKUENV) ./tokudb_load_static $@.tdb.temp <$@.gen.temp
$(SETTOKUENV) ./tokudb_dump_static $@.tdb.temp >$@.dump.tdb.temp $(SETTOKUENV) ./tokudb_dump_static $@.tdb.temp >$@.dump.tdb.temp
if ! $(DIFF) -q $@.dump.bdb.temp $@.dump.tdb.temp; then echo "$@ failed"; exit 1; fi if ! $(DIFF) -q $@.dump.bdb.temp $@.dump.tdb.temp; then echo "$@ failed"; exit 1; fi
......
...@@ -46,7 +46,8 @@ bool set_seed = false; ...@@ -46,7 +46,8 @@ bool set_seed = false;
bool printableonly = false; bool printableonly = false;
bool leadingspace = true; bool leadingspace = true;
bool force_unique = true; bool force_unique = true;
bool duplicates = false;
bool dupsort = false;
int main (int argc, char *argv[]) { int main (int argc, char *argv[]) {
int ch; int ch;
...@@ -60,7 +61,7 @@ int main (int argc, char *argv[]) { ...@@ -60,7 +61,7 @@ int main (int argc, char *argv[]) {
strcpy(sort_delimiter, ""); strcpy(sort_delimiter, "");
while ((ch = getopt(argc, argv, "PpTo:r:m:M:n:uVhHfFd:s:")) != EOF) { while ((ch = getopt(argc, argv, "PpTo:r:m:M:n:uVhHfFd:s:DS")) != EOF) {
switch (ch) { switch (ch) {
case ('P'): { case ('P'): {
printableonly = true; printableonly = true;
...@@ -172,6 +173,8 @@ int main (int argc, char *argv[]) { ...@@ -172,6 +173,8 @@ int main (int argc, char *argv[]) {
printf("%s\n", db_version(NULL, NULL, NULL)); printf("%s\n", db_version(NULL, NULL, NULL));
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
case 'D': duplicates = true; break;
case 'S': dupsort = true; break;
case ('?'): case ('?'):
default: { default: {
return (usage()); return (usage());
...@@ -238,12 +241,15 @@ int main (int argc, char *argv[]) { ...@@ -238,12 +241,15 @@ int main (int argc, char *argv[]) {
return usage(); return usage();
} }
if (header) { if (header) {
printf("VERSION=3\n" printf("VERSION=3\n");
"format=%s\n" printf("format=%s\n", g.plaintext ? "print" : "bytevalue");
"type=btree\n" printf("type=btree\n");
//"db_pagesize=4096\n" //Don't write pagesize which would be useless. // printf("db_pagesize=%d\n", 4096); //Don't write pagesize which would be useless.
"HEADER=END\n", if (duplicates)
g.plaintext ? "print" : "bytevalue"); printf("duplicates=%d\n", duplicates);
if (dupsort)
printf("dupsort=%d\n", dupsort);
printf("HEADER=END\n");
} }
if (outputkeys) generate_keys(); if (outputkeys) generate_keys();
if (footer) printf("DATA=END\n"); if (footer) printf("DATA=END\n");
...@@ -257,7 +263,7 @@ int main (int argc, char *argv[]) { ...@@ -257,7 +263,7 @@ int main (int argc, char *argv[]) {
int usage() int usage()
{ {
fprintf(stderr, fprintf(stderr,
"usage: %s [-PpTuVhHfF] [-o output] [-r seed] [-m minsize] [-M limitsize]\n" "usage: %s [-PpTuVhHfFDS] [-o output] [-r seed] [-m minsize] [-M limitsize]\n"
" %*s[-n numpairs] [-d delimiter] [-s delimiter]\n", " %*s[-n numpairs] [-d delimiter] [-s delimiter]\n",
g.progname, (int)strlen(g.progname) + 1, ""); g.progname, (int)strlen(g.progname) + 1, "");
return EXIT_FAILURE; return EXIT_FAILURE;
......
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