mirror of
https://github.com/google/leveldb.git
synced 2025-06-07 09:52:42 +08:00
Reset grandparents overlapped bytes after current output has been finished due to file size limitation
If current ouput is finished due to file size limitation, possibilities exist that we hit grandparents overlapped bytes limitation after writing fewer entries. So we need to restart grandparents overlapped bytes if we start building a new output for reasons other than overlapped bytes with grandparents. This commit adds code to restart grandparents overlapped counting after current output has been successfully finished due to file size limitation. I think the best place to restart grandparents overlapped counting should be DBImpl::OpenCompactionOutputFile, thus we don't need to remember to do this every time after we stop or start a output.
This commit is contained in:
parent
9521545b06
commit
27445141b2
@ -992,6 +992,7 @@ Status DBImpl::DoCompactionWork(CompactionState* compact) {
|
||||
if (!status.ok()) {
|
||||
break;
|
||||
}
|
||||
compact->compaction->RestartOverlappedBytes();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -353,6 +353,10 @@ class Compaction {
|
||||
// before processing "internal_key".
|
||||
bool ShouldStopBefore(const Slice& internal_key);
|
||||
|
||||
// Reset overlapped bytes with grandparents. Should be called if we start
|
||||
// building a new output for other reasons(eg. file size limitation).
|
||||
void RestartOverlappedBytes() { overlapped_bytes_ = 0; }
|
||||
|
||||
// Release the input version for the compaction, once the compaction
|
||||
// is successful.
|
||||
void ReleaseInputs();
|
||||
|
Loading…
Reference in New Issue
Block a user