diff --git a/HISTORY.md b/HISTORY.md index d210e90fa..fe5393f76 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,8 +1,13 @@ # Rocksdb Change Log +## Unreleased +### Bug Fixes +* Fix a data race that might cause crash when calling DB::GetCreationTimeOfOldestFile() by a small chance. The bug was introduced in 6.6 Release. + ## 6.7.2 (02/24/2020) ### Bug Fixes * Fixed a bug of IO Uring partial result handling introduced in 6.7.0. + ## 6.7.1 (02/13/2020) ### Bug Fixes * Fixed issue #6316 that can cause a corruption of the MANIFEST file in the middle when writing to it fails due to no disk space. diff --git a/db/db_impl/db_impl.cc b/db/db_impl/db_impl.cc index 9366d49d4..bc0496f7f 100644 --- a/db/db_impl/db_impl.cc +++ b/db/db_impl/db_impl.cc @@ -4495,13 +4495,21 @@ Status DBImpl::GetCreationTimeOfOldestFile(uint64_t* creation_time) { if (mutable_db_options_.max_open_files == -1) { uint64_t oldest_time = port::kMaxUint64; for (auto cfd : *versions_->GetColumnFamilySet()) { - uint64_t ctime; - cfd->current()->GetCreationTimeOfOldestFile(&ctime); - if (ctime < oldest_time) { - oldest_time = ctime; - } - if (oldest_time == 0) { - break; + if (!cfd->IsDropped()) { + uint64_t ctime; + { + SuperVersion* sv = GetAndRefSuperVersion(cfd); + Version* version = sv->current; + version->GetCreationTimeOfOldestFile(&ctime); + ReturnAndCleanupSuperVersion(cfd, sv); + } + + if (ctime < oldest_time) { + oldest_time = ctime; + } + if (oldest_time == 0) { + break; + } } } *creation_time = oldest_time;