Commit 528949b6 authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul Committed by Yoni Fogel

Fixes #2292. closes[t:2292]

git-svn-id: file:///svn/toku/tokudb@16859 c7de825b-a66e-492c-adef-691d508d4ae1
parent 5991c07b
......@@ -477,9 +477,10 @@ dump.bdb.1426: test1426.bdb$(BINSUF) test1426.bdbdump/dump.bdb.1426
endif
# test1426 is run by comparing the BDB output to the TDB output
# we use the -x flag (no transactions or recovery) in the dump program. (-x is not in the BDB version of dump, but it's in ours)
test1426.tdbrun: test1426.tdb$(BINSUF) dump.bdb.1426 $(PTHREAD_LOCAL)
(./test1426.tdb$(BINSUF) -q && \
$(TDBDUMP) -p -h dir.test1426.c.tdb main > dump.tdb.1426 && \
$(TDBDUMP) -x -p -h dir.test1426.c.tdb main > dump.tdb.1426 && \
diff -q -I db_pagesize=4096 dump.bdb.1426 dump.tdb.1426 ) \
$(MAYBEINVERTER) $(SUMMARIZE_CMD)
......
......@@ -9,7 +9,7 @@
#include <fcntl.h>
// |DB_INIT_TXN| DB_INIT_LOG | DB_RECOVER
const int envflags = DB_CREATE|DB_INIT_MPOOL|DB_INIT_LOCK |DB_THREAD |DB_PRIVATE|DB_INIT_LOG|DB_INIT_TXN;
const int envflags = DB_CREATE|DB_INIT_MPOOL|DB_INIT_LOCK |DB_THREAD |DB_PRIVATE;
DB_ENV *env;
DB *db;
......
......@@ -19,6 +19,7 @@ typedef struct {
bool header;
bool footer;
bool is_private;
bool recovery_and_txn;
char* progname;
char* homedir;
char* database;
......@@ -56,10 +57,11 @@ int test_main(int argc, char *argv[]) {
g.progname = argv[0];
g.header = true;
g.footer = true;
g.recovery_and_txn = true;
if (verify_library_version() != 0) goto error;
while ((ch = getopt(argc, argv, "d:f:h:klNP:ps:RrVT")) != EOF) {
while ((ch = getopt(argc, argv, "d:f:h:klNP:ps:RrVTx")) != EOF) {
switch (ch) {
case ('d'): {
PRINT_ERRORX("-%c option not supported.\n", ch);
......@@ -132,6 +134,10 @@ int test_main(int argc, char *argv[]) {
g.footer = false;
break;
}
case ('x'): {
g.recovery_and_txn = false;
break;
}
case ('?'):
default: {
g.exitcode = usage();
......@@ -225,7 +231,7 @@ cleanup:
int usage()
{
fprintf(stderr,
"usage: %s [-pVT] [-f output] [-h home] [-s database] db_file\n",
"usage: %s [-pVT] [-x] [-f output] [-h home] [-s database] db_file\n",
g.progname);
return EXIT_FAILURE;
}
......@@ -251,8 +257,10 @@ int create_init_env()
/* Open the dbenvironment. */
g.is_private = false;
//flags = DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | DB_USE_ENVIRON;
flags = DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL |DB_RECOVER; ///TODO: UNCOMMENT/IMPLEMENT | DB_USE_ENVIRON;
SET_BITS(flags, DB_INIT_TXN);
flags = DB_INIT_LOCK | DB_INIT_MPOOL; ///TODO: UNCOMMENT/IMPLEMENT | DB_USE_ENVIRON;
if (g.recovery_and_txn) {
SET_BITS(flags, DB_INIT_LOG | DB_INIT_TXN | DB_RECOVER);
}
/*
///TODO: UNCOMMENT/IMPLEMENT Notes: We require DB_PRIVATE
......@@ -420,10 +428,12 @@ int dump_pairs()
memset(&data, 0, sizeof(data));
DB_TXN* txn = NULL;
retval = g.dbenv->txn_begin(g.dbenv, NULL, &txn, 0);
if (retval) {
PRINT_ERROR(retval, "DB_ENV->txn_begin");
goto error;
if (g.recovery_and_txn) {
retval = g.dbenv->txn_begin(g.dbenv, NULL, &txn, 0);
if (retval) {
PRINT_ERROR(retval, "DB_ENV->txn_begin");
goto error;
}
}
if ((retval = db->cursor(db, txn, &dbc, 0)) != 0) {
......
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