From 34c35d87313bca9ee430165f63ff405828d67f63 Mon Sep 17 00:00:00 2001 From: "Bradley C. Kuszmaul" <bradley@tokutek.com> Date: Fri, 4 Apr 2008 13:36:16 +0000 Subject: [PATCH] {{{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 --- src/ydb.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/ydb.c b/src/ydb.c index bb2db97665..f139bfbbc9 100644 --- a/src/ydb.c +++ b/src/ydb.c @@ -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; -- 2.30.9