diff --git a/db/db_impl.cc b/db/db_impl.cc index eb46811ae..153b605a8 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -1386,9 +1386,9 @@ Status DBImpl::WriteLevel0TableForRecovery(int job_id, ColumnFamilyData* cfd, mutex_.AssertHeld(); const uint64_t start_micros = env_->NowMicros(); FileMetaData meta; - meta.fd = FileDescriptor(versions_->NewFileNumber(), 0, 0); auto pending_outputs_inserted_elem = CaptureCurrentFileNumberInPendingOutputs(); + meta.fd = FileDescriptor(versions_->NewFileNumber(), 0, 0); ReadOptions ro; ro.total_order_seek = true; Arena arena; diff --git a/db/db_impl.h b/db/db_impl.h index e0d10e99e..f068fe084 100644 --- a/db/db_impl.h +++ b/db/db_impl.h @@ -494,10 +494,11 @@ class DBImpl : public DB { // Background process needs to call // auto x = CaptureCurrentFileNumberInPendingOutputs() + // auto file_num = versions_->NewFileNumber(); // // ReleaseFileNumberFromPendingOutputs(x) - // This will protect any temporary files created while is - // executing from being deleted. + // This will protect any file with number `file_num` or greater from being + // deleted while is running. // ----------- // This function will capture current file number and append it to // pending_outputs_. This will prevent any background process to delete any