Commit 907df64d authored by Yoni Fogel's avatar Yoni Fogel

Closes #270

Closes #271
Bugfixes in tokudb_load:
Now supports -T (text) option along with other command line parameters
Now supports -T option without newline at end of file (i.e. last data item ends with end of file)


git-svn-id: file:///svn/tokudb@1651 c7de825b-a66e-492c-adef-691d508d4ae1
parent 1b6c9ebc
...@@ -70,7 +70,7 @@ TEST_GEN_HEX_FLAGS=-n $(TEST_GEN_HEX_NUMKEYS) -m $(TEST_GEN_HEX_LENGTHMIN) -M $( ...@@ -70,7 +70,7 @@ TEST_GEN_HEX_FLAGS=-n $(TEST_GEN_HEX_NUMKEYS) -m $(TEST_GEN_HEX_LENGTHMIN) -M $(
test_gen_hex: test_gen_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"
rm -f $@.*.temp rm -f $@.*.temp
./tokudb_gen $(TEST_GEN_HEX_FLAGS) > $@.gen.temp ./tokudb_gen $(TEST_GEN_HEX_FLAGS) > $@.gen.temp
$(UNSETTOKUENV) $(BDB_LOAD) $@.db.temp < $@.gen.temp $(UNSETTOKUENV) $(BDB_LOAD) $@.db.temp < $@.gen.temp
...@@ -81,9 +81,12 @@ test_gen_hex: ...@@ -81,9 +81,12 @@ test_gen_hex:
if ! $(DIFF) -q $@.load_dump.temp $@.gen_sorted.temp; then echo "Test Failed!"; exit 1; fi if ! $(DIFF) -q $@.load_dump.temp $@.gen_sorted.temp; then echo "Test Failed!"; exit 1; fi
rm $@.*.temp rm $@.*.temp
test_load: 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 #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"
rm -f $@.*.temp rm -f $@.*.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
...@@ -92,6 +95,26 @@ test_load: ...@@ -92,6 +95,26 @@ test_load:
$(SETTOKUENV) ./tokudb_dump $@.tokudb.temp > $@.dump.tokudb.temp $(SETTOKUENV) ./tokudb_dump $@.tokudb.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_GEN_TEXT_FLAGS=-n $(TEST_GEN_HEX_NUMKEYS) -m $(TEST_GEN_HEX_LENGTHMIN) -M $(TEST_GEN_HEX_LENGTHLIMIT) -r 5 -TP
test_load_text: test_load_text_noendline
#Generating $(TEST_GEN_HEX_NUMKEYS) keys. [$(TEST_GEN_HEX_LENGTHMIN),$(TEST_GEN_HEX_LENGTHLIMIT)) bytes + identifier overhead
@echo "Generating text input > db > text"
rm -f $@.*.temp
./tokudb_gen $(TEST_GEN_TEXT_FLAGS) > $@.gen.temp
$(UNSETTOKUENV) $(BDB_LOAD) -T -t btree $@.bdb.temp < $@.gen.temp
$(SETTOKUENV) ./tokudb_load -T -t btree $@.tokudb.temp < $@.gen.temp
$(UNSETTOKUENV) $(BDB_DUMP) -p $@.bdb.temp > $@.dump.bdb.temp
$(SETTOKUENV) ./tokudb_dump -p $@.tokudb.temp > $@.dump.tokudb.temp
if ! $(DIFF) -q $@.dump.bdb.temp $@.dump.tokudb.temp; then echo "Test Failed!"; exit 1; fi
test_load_text_noendline:
@echo "Testing no end of line at end of file."
rm -f $@.*.temp
echo -en "key\nvalue" > $@.gen.temp
./tokudb_load -T -t btree $@.tokudb.temp < $@.gen.temp
test_dump: test_dump:
#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"
......
...@@ -520,8 +520,6 @@ int apply_commandline_options() ...@@ -520,8 +520,6 @@ int apply_commandline_options()
DB* db = g.db; DB* db = g.db;
DB_ENV* dbenv = g.dbenv; DB_ENV* dbenv = g.dbenv;
assert(g.header);
for (index = 0; g.config_options[index]; index++) { for (index = 0; g.config_options[index]; index++) {
if (value) { if (value) {
/* Restore the field=value format. */ /* Restore the field=value format. */
...@@ -828,6 +826,10 @@ int read_keys() ...@@ -828,6 +826,10 @@ int read_keys()
g.linenumber++; g.linenumber++;
if (get_dbt(&key) != 0) goto error; if (get_dbt(&key) != 0) goto error;
if (g.eof) { if (g.eof) {
if (key.size == 0) {
//Last entry had no newline. Done.
break;
}
ERRORX("Line %"PRIu64": Key exists but value missing.", g.linenumber); ERRORX("Line %"PRIu64": Key exists but value missing.", g.linenumber);
goto error; goto error;
} }
......
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