Commit a7120e70 authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

Print an error message for DB_PRIVATE missing, and make the test actually...

Print an error message for DB_PRIVATE missing, and make the test actually observe issue #209 (open works even when the dir doesn't exist but DB_CREATE is not specified).  Addresses #208, 209.

git-svn-id: file:///svn/tokudb@1262 c7de825b-a66e-492c-adef-691d508d4ae1
parent a1100335
...@@ -28,6 +28,9 @@ int main() { ...@@ -28,6 +28,9 @@ int main() {
int do_private; int do_private;
for (do_private=0; do_private<2; do_private++) { for (do_private=0; do_private<2; do_private++) {
#ifdef USE_TDB
if (do_private==0) continue; // See #208.
#endif
int private_flags = do_private ? DB_PRIVATE : 0; int private_flags = do_private ? DB_PRIVATE : 0;
system("rm -rf " DIR); system("rm -rf " DIR);
...@@ -42,6 +45,7 @@ int main() { ...@@ -42,6 +45,7 @@ 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);
if (r!=ENOENT) printf("%s:%d %d: %s\n", __FILE__, __LINE__, r,db_strerror(r));
assert(r==ENOENT); assert(r==ENOENT);
dbenv->close(dbenv,0); // free memory dbenv->close(dbenv,0); // free memory
} }
......
...@@ -53,6 +53,12 @@ struct __toku_db_env_internal { ...@@ -53,6 +53,12 @@ struct __toku_db_env_internal {
TOKULOGGER logger; TOKULOGGER logger;
}; };
// Probably this do_error (which is dumb and stupid) should do something consistent with do_env_err.
static void do_error (DB_ENV *dbenv, const char *string) {
if (dbenv->i->errfile)
fprintf(dbenv->i->errfile, "%s\n", string);
}
static void toku_db_env_err(const DB_ENV * env __attribute__ ((__unused__)), int error, const char *fmt, ...) { static void toku_db_env_err(const DB_ENV * env __attribute__ ((__unused__)), int error, const char *fmt, ...) {
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);
...@@ -272,6 +278,7 @@ static int toku_db_env_open(DB_ENV * env, const char *home, u_int32_t flags, int ...@@ -272,6 +278,7 @@ static int toku_db_env_open(DB_ENV * env, const char *home, u_int32_t flags, int
if (!(flags & DB_PRIVATE)) { if (!(flags & DB_PRIVATE)) {
fprintf(stderr, "tokudb requires DB_PRIVATE\n");
// This means that we don't have to do anything with shared memory. // This means that we don't have to do anything with shared memory.
// And that's good enough for mysql. // And that's good enough for mysql.
return EINVAL; return EINVAL;
...@@ -1266,11 +1273,6 @@ static int toku_db_open(DB * db, DB_TXN * txn, const char *fname, const char *db ...@@ -1266,11 +1273,6 @@ static int toku_db_open(DB * db, DB_TXN * txn, const char *fname, const char *db
return r; return r;
} }
static void do_error (DB_ENV *dbenv, const char *string) {
if (dbenv->i->errfile)
fprintf(dbenv->i->errfile, "%s\n", string);
}
static int toku_db_put_noassociate(DB * db, DB_TXN * txn, DBT * key, DBT * data, u_int32_t flags) { static int toku_db_put_noassociate(DB * db, DB_TXN * txn, DBT * key, DBT * data, u_int32_t flags) {
int r; int r;
......
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