Commit a4c34d1e 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 67b23397
......@@ -6,6 +6,7 @@ BDB_LOAD=$(BDBDIR)/bin/db_load
DIFF=diff -I 'db_pagesize='
OPTFLAGS = -O2
CFLAGS = -std=gnu89 -W -Wall -Wno-unused -g $(OPTFLAGS) $(GCOV_FLAGS)
# vars to compile bins that handle tokudb using libdb.so
......@@ -61,9 +62,9 @@ coverage: $(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
......@@ -87,7 +88,6 @@ test_gen_hex:
test_load: test_load_hex test_load_text
test_load_hex:
#Generating $(TEST_GEN_HEX_NUMKEYS) keys. [$(TEST_GEN_HEX_LENGTHMIN),$(TEST_GEN_HEX_LENGTHLIMIT)) bytes + identifier overhead
@echo "Generating text input > db > text"
......@@ -129,11 +129,26 @@ test_dump:
$(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
test_bdb_tokudb:
test_nodup:
rm -rf $@.*.temp
./tokudb_gen $(TEST_GEN_HEX_FLAGS) >$@.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_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_dump_static $@.tdb.temp >$@.dump.tdb.temp
if ! $(DIFF) -q $@.dump.bdb.temp $@.dump.tdb.temp; then echo "$@ failed"; exit 1; fi
......
......@@ -46,7 +46,8 @@ bool set_seed = false;
bool printableonly = false;
bool leadingspace = true;
bool force_unique = true;
bool duplicates = false;
bool dupsort = false;
int main (int argc, char *argv[]) {
int ch;
......@@ -60,7 +61,7 @@ int main (int argc, char *argv[]) {
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) {
case ('P'): {
printableonly = true;
......@@ -172,6 +173,8 @@ int main (int argc, char *argv[]) {
printf("%s\n", db_version(NULL, NULL, NULL));
return EXIT_SUCCESS;
}
case 'D': duplicates = true; break;
case 'S': dupsort = true; break;
case ('?'):
default: {
return (usage());
......@@ -238,12 +241,15 @@ int main (int argc, char *argv[]) {
return usage();
}
if (header) {
printf("VERSION=3\n"
"format=%s\n"
"type=btree\n"
//"db_pagesize=4096\n" //Don't write pagesize which would be useless.
"HEADER=END\n",
g.plaintext ? "print" : "bytevalue");
printf("VERSION=3\n");
printf("format=%s\n", g.plaintext ? "print" : "bytevalue");
printf("type=btree\n");
// printf("db_pagesize=%d\n", 4096); //Don't write pagesize which would be useless.
if (duplicates)
printf("duplicates=%d\n", duplicates);
if (dupsort)
printf("dupsort=%d\n", dupsort);
printf("HEADER=END\n");
}
if (outputkeys) generate_keys();
if (footer) printf("DATA=END\n");
......@@ -257,7 +263,7 @@ error:
int usage()
{
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",
g.progname, (int)strlen(g.progname) + 1, "");
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