-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
Return Aborted when no valid input files are found for a CompactFile call #12633
Changes from 1 commit
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 | ||
---|---|---|---|---|
|
@@ -920,8 +920,9 @@ Status CompactionPicker::SanitizeCompactionInputFilesForAllLevels( | |||
// the smallest and largest key of the current compaction input | ||||
std::string smallestkey; | ||||
std::string largestkey; | ||||
bool valid_input_files_found = false; | ||||
// a flag for initializing smallest and largest key | ||||
bool is_first = false; | ||||
bool is_first = true; | ||||
const int kNotFound = -1; | ||||
|
||||
// For each level, it does the following things: | ||||
|
@@ -946,10 +947,11 @@ Status CompactionPicker::SanitizeCompactionInputFilesForAllLevels( | |||
} | ||||
first_included = std::min(first_included, static_cast<int>(f)); | ||||
last_included = std::max(last_included, static_cast<int>(f)); | ||||
if (is_first == false) { | ||||
if (is_first) { | ||||
smallestkey = current_files[f].smallestkey; | ||||
largestkey = current_files[f].largestkey; | ||||
is_first = true; | ||||
valid_input_files_found = true; | ||||
is_first = false; | ||||
} | ||||
} | ||||
if (last_included == kNotFound) { | ||||
|
@@ -1040,6 +1042,13 @@ Status CompactionPicker::SanitizeCompactionInputFilesForAllLevels( | |||
} | ||||
} | ||||
} | ||||
|
||||
if (!valid_input_files_found) { | ||||
return Status::Aborted( | ||||
"There are no valid input files found for the specified files."); | ||||
} | ||||
assert(!smallestkey.empty()); | ||||
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. I think empty user key is allowed. 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. I didn't quite get this, in the rocksdb/db/compaction/compaction_picker.cc Line 266 in 9bddac0
So I think it's better to not pass empty boundaries to that function yet. These user key boundaries come from the existing files' boundaries. At this point, they should either represent some file's actual range, or no valid files found and they are empty. So here we want to not check further if range overlap when it's empty. 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. Good catch! I didn't get that you meant |
||||
assert(!largestkey.empty()); | ||||
if (RangeOverlapWithCompaction(smallestkey, largestkey, output_level)) { | ||||
return Status::Aborted( | ||||
"A running compaction is writing to the same output level in an " | ||||
|
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.
Does checking
is_first
works here? Or renameis_first
tovalid_input_files_found
for better naming.