-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only flush after recovery for retryable IOError #11880
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -453,7 +453,7 @@ Status DBImpl::ResumeImpl(DBRecoverContext context) { | |
if (shutdown_initiated_) { | ||
s = Status::ShutdownInProgress(); | ||
} | ||
if (s.ok()) { | ||
if (s.ok() && context.flush_after_recovery) { | ||
// Since we drop all non-recovery flush requests during recovery, | ||
// and new memtable may fill up during recovery, | ||
// schedule one more round of flush. | ||
|
@@ -472,14 +472,16 @@ Status DBImpl::ResumeImpl(DBRecoverContext context) { | |
// FlushAllColumnFamilies releases and re-acquires mutex. | ||
if (shutdown_initiated_) { | ||
s = Status::ShutdownInProgress(); | ||
} else { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you mean scheduling compaction in the else if block? We need to do that when context.flush_after_recovery is false too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ahh never mind. I missed the collapsed part of the code. I didn't see we were calling FlushAll() above between line 460 - 471 I originally meant line 456 would stay as if (s.ok()), but then you will trigger FlushAll() when You can disregard my comment above |
||
for (auto cfd : *versions_->GetColumnFamilySet()) { | ||
SchedulePendingCompaction(cfd); | ||
} | ||
MaybeScheduleFlushOrCompaction(); | ||
} | ||
} | ||
|
||
if (s.ok()) { | ||
for (auto cfd : *versions_->GetColumnFamilySet()) { | ||
SchedulePendingCompaction(cfd); | ||
} | ||
MaybeScheduleFlushOrCompaction(); | ||
} | ||
|
||
// Wake up any waiters - in this case, it could be the shutdown thread | ||
bg_cv_.SignalAll(); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this scenario be avoided if we check
shutdown_initiated_
here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be the same as the existing check in line 453 (in the same critical section). I don't think it would work since db mutex is released/re-acquired several times in
FlushAllColumnFamilies()
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, that's true. Its dropping the locking before scheduling the flush.