From fda8142f29c479034b5471a363104ca18030a21e Mon Sep 17 00:00:00 2001 From: Igor Canadi Date: Wed, 13 Nov 2013 14:54:54 -0800 Subject: [PATCH] Delete log files in the correct dir Summary: Log files are stored in wal_dir, not dbname_ Test Plan: deletfile_test Reviewers: nkg- Reviewed By: nkg- CC: leveldb Differential Revision: https://reviews.facebook.net/D14067 --- db/db_impl.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/db/db_impl.cc b/db/db_impl.cc index 4a9652e33..46938e45c 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -562,7 +562,8 @@ void DBImpl::PurgeObsoleteFiles(DeletionState& state) { // evict from cache table_cache_->Evict(number); } - std::string fname = dbname_ + "/" + state.all_files[i]; + std::string fname = ((type == kLogFile) ? options_.wal_dir : dbname_) + + "/" + state.all_files[i]; Log(options_.info_log, "Delete type=%d #%lu", int(type), @@ -575,14 +576,14 @@ void DBImpl::PurgeObsoleteFiles(DeletionState& state) { ArchivedLogFileName(options_.wal_dir, number)); if (!st.ok()) { Log(options_.info_log, - "RenameFile logfile #%lu FAILED", - (unsigned long)number); + "RenameFile logfile #%lu FAILED -- %s\n", + (unsigned long)number, st.ToString().c_str()); } } else { st = env_->DeleteFile(fname); if (!st.ok()) { - Log(options_.info_log, "Delete type=%d #%lu FAILED\n", - int(type), (unsigned long)number); + Log(options_.info_log, "Delete type=%d #%lu FAILED -- %s\n", + int(type), (unsigned long)number, st.ToString().c_str()); } } }