Commit 248a377a authored by Rich Prohaska's avatar Rich Prohaska

get tokudb_dump -s working

get tokudb_dump working with dupsort databases



git-svn-id: file:///svn/tokudb@1928 c7de825b-a66e-492c-adef-691d508d4ae1
parent 9129c12c
......@@ -21,7 +21,7 @@ int dbdump(char *dbfile, char *dbname) {
#else
Db db(0, DB_CXX_NO_EXCEPTIONS);
#endif
r = db.open(0, dbfile, dbname, DB_BTREE, DB_UNKNOWN, 0777);
r = db.open(0, dbfile, dbname, DB_UNKNOWN, 0, 0777);
if (r != 0) {
printf("cant open %s:%s\n", dbfile, dbname);
#if USE_ENV
......
......@@ -23,7 +23,7 @@ int dbdump(char *dbfile, char *dbname) {
Db db(0, 0);
#endif
try {
r = db.open(0, dbfile, dbname, DB_BTREE, 0, 0777);
r = db.open(0, dbfile, dbname, DB_UNKNOWN, 0, 0777);
assert(r==0);
} catch (DbException e) {
printf("Cannot open %s:%s due to error %d\n", dbfile, dbname, e.get_errno());
......
......@@ -39,15 +39,17 @@ void walk(DB *db) {
if (val.data) free(val.data);
}
void test_insert_zero_length(int n, int dup_mode) {
void test_insert_zero_length(int n, int dup_mode, const char *dbname) {
if (verbose) printf("test_insert_zero_length:%d %d\n", n, dup_mode);
DB_ENV * const null_env = 0;
DB *db;
DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test_insert.brt";
int r;
char fname[strlen(DIR) + strlen("/") + strlen(dbname) + 1];
sprintf(fname, "%s/%s", DIR, dbname);
unlink(fname);
/* create the dup database file */
......@@ -74,15 +76,17 @@ void test_insert_zero_length(int n, int dup_mode) {
r = db->close(db, 0); assert(r == 0);
}
void test_insert_zero_length_keys(int n, int dup_mode) {
void test_insert_zero_length_keys(int n, int dup_mode, const char *dbname) {
if (verbose) printf("test_insert_zero_length_keys:%d %d\n", n, dup_mode);
DB_ENV * const null_env = 0;
DB *db;
DB_TXN * const null_txn = 0;
const char * const fname = DIR "/" "test_insert.brt";
int r;
char fname[strlen(DIR) + strlen("/") + strlen(dbname) + 1];
sprintf(fname, "%s/%s", DIR, dbname);
unlink(fname);
/* create the dup database file */
......@@ -116,9 +120,9 @@ int main(int argc, const char *argv[]) {
system("rm -rf " DIR);
mkdir(DIR, 0777);
test_insert_zero_length(32, 0);
test_insert_zero_length_keys(32, 0);
test_insert_zero_length_keys(32, DB_DUP+DB_DUPSORT);
test_insert_zero_length(32, 0, "test0");
test_insert_zero_length_keys(32, 0, "test0keys");
test_insert_zero_length_keys(32, DB_DUP+DB_DUPSORT, "test0keys_dupsort");
return 0;
}
......@@ -1625,7 +1625,7 @@ static int toku_db_open(DB * db, DB_TXN * txn, const char *fname, const char *db
int is_db_excl = flags & DB_EXCL; flags&=~DB_EXCL;
int is_db_create = flags & DB_CREATE; flags&=~DB_CREATE;
int is_db_rdonly = flags & DB_RDONLY; flags&=~DB_RDONLY;
int is_db_unknown = flags & DB_UNKNOWN; flags&=~DB_UNKNOWN;
int is_db_unknown = dbtype == DB_UNKNOWN;
if (flags & ~DB_THREAD) return EINVAL; // unknown flags
if (is_db_excl && !is_db_create) return EINVAL;
......
......@@ -118,7 +118,7 @@ int main(int argc, char *argv[]) {
}
case ('s'): {
g.subdatabase = optarg;
goto error;
break;
}
case ('V'): {
printf("%s\n", db_version(NULL, NULL, NULL));
......@@ -178,7 +178,7 @@ int main(int argc, char *argv[]) {
g.exitcode = EXIT_FAILURE;
fprintf(stderr, "%s: %s: dbenv->close\n", g.progname, db_strerror(retval));
}
if (g.subdatabase) free(g.subdatabase);
// if (g.subdatabase) free(g.subdatabase);
resend_signals();
return g.exitcode;
......
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