Commit 34c35d87 authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

{{{ybt.c}}} was trying to {{{find_db_file}}} after closing the file. Now it...

{{{ybt.c}}} was trying to {{{find_db_file}}} after closing the file.  Now it finds the filename first, closes the db, and then unlinks the file.  Fixes #644.

git-svn-id: file:///svn/tokudb@3266 c7de825b-a66e-492c-adef-691d508d4ae1
parent 3d58de68
......@@ -2293,15 +2293,20 @@ static int toku_db_remove(DB * db, const char *fname, const char *dbname, u_int3
r = toku_brt_remove_subdb(db->i->brt, dbname, flags);
if (r!=0) { goto cleanup; }
}
r = toku_db_close(db, 0);
need_close = FALSE;
if (r!=0) { goto cleanup; }
if (!dbname) {
r = find_db_file(db->dbenv, fname, &full_name);
if (r!=0) { goto cleanup; }
assert(full_name);
r = toku_db_close(db, 0);
need_close = FALSE;
if (r!=0) { goto cleanup; }
if (unlink(full_name) != 0) { r = errno; goto cleanup; }
} else {
r = toku_db_close(db, 0);
need_close = FALSE;
if (r!=0) { goto cleanup; }
}
if (ltm && db_id) { toku_ltm_invalidate_lt(ltm, db_id); }
r = 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