Fix WriteLevel0TableForRecovery file delete protection
Summary: The call to ``` CaptureCurrentFileNumberInPendingOutputs() ``` should be before ``` versions_->NewFileNumber() ``` Right now we are not actually protecting the file from being deleted Test Plan: make check Reviewers: sdong, anthony, yhchiang Reviewed By: yhchiang Subscribers: dhruba Differential Revision: https://reviews.facebook.net/D54645
This commit is contained in:
parent
451678c8c9
commit
dfe96c72c3
@ -1386,9 +1386,9 @@ Status DBImpl::WriteLevel0TableForRecovery(int job_id, ColumnFamilyData* cfd,
|
|||||||
mutex_.AssertHeld();
|
mutex_.AssertHeld();
|
||||||
const uint64_t start_micros = env_->NowMicros();
|
const uint64_t start_micros = env_->NowMicros();
|
||||||
FileMetaData meta;
|
FileMetaData meta;
|
||||||
meta.fd = FileDescriptor(versions_->NewFileNumber(), 0, 0);
|
|
||||||
auto pending_outputs_inserted_elem =
|
auto pending_outputs_inserted_elem =
|
||||||
CaptureCurrentFileNumberInPendingOutputs();
|
CaptureCurrentFileNumberInPendingOutputs();
|
||||||
|
meta.fd = FileDescriptor(versions_->NewFileNumber(), 0, 0);
|
||||||
ReadOptions ro;
|
ReadOptions ro;
|
||||||
ro.total_order_seek = true;
|
ro.total_order_seek = true;
|
||||||
Arena arena;
|
Arena arena;
|
||||||
|
@ -494,10 +494,11 @@ class DBImpl : public DB {
|
|||||||
|
|
||||||
// Background process needs to call
|
// Background process needs to call
|
||||||
// auto x = CaptureCurrentFileNumberInPendingOutputs()
|
// auto x = CaptureCurrentFileNumberInPendingOutputs()
|
||||||
|
// auto file_num = versions_->NewFileNumber();
|
||||||
// <do something>
|
// <do something>
|
||||||
// ReleaseFileNumberFromPendingOutputs(x)
|
// ReleaseFileNumberFromPendingOutputs(x)
|
||||||
// This will protect any temporary files created while <do something> is
|
// This will protect any file with number `file_num` or greater from being
|
||||||
// executing from being deleted.
|
// deleted while <do something> is running.
|
||||||
// -----------
|
// -----------
|
||||||
// This function will capture current file number and append it to
|
// This function will capture current file number and append it to
|
||||||
// pending_outputs_. This will prevent any background process to delete any
|
// pending_outputs_. This will prevent any background process to delete any
|
||||||
|
Loading…
x
Reference in New Issue
Block a user