Commit 1e96e2f4 authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

The test_db_env_open_nocreate.c test was complaining when it didn't

really have a right to.  It was creating the directory and then
calling {{{DB_ENV->open}}} without specifying {{{DB_CREATE}}} and then
complaining if the open was successful.

For BDB, the open is not successful because BDB has internal files it sets up.

TokuDB has no internal files (yet) because it only handles
{{{DB_PRIVATE}}} databases.  Hence creating the directory is enough to
make TokuDB happy.  And we're OK with that.

Addresses #209.


git-svn-id: file:///svn/tokudb@1263 c7de825b-a66e-492c-adef-691d508d4ae1
parent 276256b3
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0); #define CKERR(r) if (r!=0) fprintf(stderr, "%s:%d error %d %s\n", __FILE__, __LINE__, r, db_strerror(r)); assert(r==0);
int main() { int main() {
DB *db;
DB_ENV *dbenv; DB_ENV *dbenv;
int r; int r;
int do_private; int do_private;
...@@ -45,12 +44,20 @@ int main() { ...@@ -45,12 +44,20 @@ int main() {
r = db_env_create(&dbenv, 0); r = db_env_create(&dbenv, 0);
CKERR(r); CKERR(r);
r = dbenv->open(dbenv, DIR, private_flags|DB_INIT_MPOOL, 0); r = dbenv->open(dbenv, DIR, private_flags|DB_INIT_MPOOL, 0);
#ifdef USE_TDB
// TokuDB has no trouble opening an environment if the directory exists.
CKERR(r);
assert(r==0);
#else
if (r!=ENOENT) printf("%s:%d %d: %s\n", __FILE__, __LINE__, r,db_strerror(r)); if (r!=ENOENT) printf("%s:%d %d: %s\n", __FILE__, __LINE__, r,db_strerror(r));
assert(r==ENOENT); assert(r==ENOENT);
#endif
dbenv->close(dbenv,0); // free memory dbenv->close(dbenv,0); // free memory
} }
#ifndef USE_TDB
// Now make sure that if we have a non-private DB that we can tell if it opened or not. // Now make sure that if we have a non-private DB that we can tell if it opened or not.
DB *db;
system("rm -rf " DIR); system("rm -rf " DIR);
mkdir(DIR, 0777); mkdir(DIR, 0777);
r = db_env_create(&dbenv, 0); r = db_env_create(&dbenv, 0);
...@@ -60,12 +67,13 @@ int main() { ...@@ -60,12 +67,13 @@ int main() {
r=db_create(&db, dbenv, 0); r=db_create(&db, dbenv, 0);
CKERR(r); CKERR(r);
dbenv->close(dbenv,0); // free memory dbenv->close(dbenv,0); // free memory
write(1,"d",1);
r = db_env_create(&dbenv, 0); r = db_env_create(&dbenv, 0);
CKERR(r); CKERR(r);
r = dbenv->open(dbenv, DIR, DB_INIT_MPOOL, 0); r = dbenv->open(dbenv, DIR, DB_INIT_MPOOL, 0);
CKERR(r); CKERR(r);
dbenv->close(dbenv,0); // free memory dbenv->close(dbenv,0); // free memory
#endif
return 0; return 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