Skip to content

Commit

Permalink
Move WAL-closing loop out of original loop (#5804)
Browse files Browse the repository at this point in the history
Summary:
Originally the loop of closing WAL in PurgeObsoleteFiles resides inside a loop
iterating over the candidate files. It should be moved out.

Test plan (devserver)
```
$COMPILE_WITH_ASAN=1 make -j32 all
$make check
```
Pull Request resolved: #5804

Differential Revision: D17374350

Pulled By: riversand963

fbshipit-source-id: 2bee7343fc0481d9a385a87c7676491522285c96
  • Loading branch information
riversand963 authored and facebook-github-bot committed Sep 18, 2019
1 parent 43a340b commit 6d072f2
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions db/db_impl/db_impl_files.cc
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,12 @@ void DBImpl::PurgeObsoleteFiles(JobContext& state, bool schedule_only) {
}
}

// Close WALs before trying to delete them.
for (const auto w : state.logs_to_free) {
// TODO: maybe check the return value of Close.
w->Close();
}

std::unordered_set<uint64_t> files_to_del;
for (const auto& candidate_file : candidate_files) {
const std::string& to_delete = candidate_file.file_name;
Expand Down Expand Up @@ -478,11 +484,6 @@ void DBImpl::PurgeObsoleteFiles(JobContext& state, bool schedule_only) {
}
#endif // !ROCKSDB_LITE

for (const auto w : state.logs_to_free) {
// TODO: maybe check the return value of Close.
w->Close();
}

Status file_deletion_status;
if (schedule_only) {
InstrumentedMutexLock guard_lock(&mutex_);
Expand Down

0 comments on commit 6d072f2

Please sign in to comment.