提交 a8b4a69d 编写于 作者: M Mayank Agarwal

Fixing error in ParseFileName causing DestroyDB to fail on archive directory

Summary:
This careless error was causing ASSERT_OK(DestroyDB) to fail in db_test.
Basically .. was being returned as a child of db/archive and ParseFileName returned false on that,
but 'type' was set to LogFile from earlier and not reset. The return of ParseFileName was not being checked to delete the log file or not.

Test Plan: make all check

Reviewers: dhruba, haobo, xjin, kailiu, nkg-

Reviewed By: nkg-

CC: leveldb

Differential Revision: https://reviews.facebook.net/D13413
上级 40a1e31f
......@@ -3308,8 +3308,8 @@ Status DestroyDB(const std::string& dbname, const Options& options) {
env->GetChildren(archivedir, &archiveFiles);
// Delete archival files.
for (size_t i = 0; i < archiveFiles.size(); ++i) {
ParseFileName(archiveFiles[i], &number, &type);
if (type == kLogFile) {
if (ParseFileName(archiveFiles[i], &number, &type) &&
type == kLogFile) {
Status del = env->DeleteFile(archivedir + "/" + archiveFiles[i]);
if (result.ok() && !del.ok()) {
result = del;
......
......@@ -257,7 +257,7 @@ class DBTest {
~DBTest() {
delete db_;
DestroyDB(dbname_, Options());
ASSERT_OK(DestroyDB(dbname_, Options()));
delete env_;
delete filter_policy_;
}
......@@ -378,7 +378,7 @@ class DBTest {
void Destroy(Options* options) {
delete db_;
db_ = nullptr;
DestroyDB(dbname_, *options);
ASSERT_OK(DestroyDB(dbname_, *options));
}
Status PureReopen(Options* options, DB** db) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册