|
|
@ -1248,12 +1248,12 @@ Compaction* UniversalCompactionPicker::PickCompactionUniversalReadAmp( |
|
|
|
cf_name.c_str(), file_num_buf, loop); |
|
|
|
cf_name.c_str(), file_num_buf, loop); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Check if the suceeding files need compaction.
|
|
|
|
// Check if the succeeding files need compaction.
|
|
|
|
for (unsigned int i = loop + 1; |
|
|
|
for (unsigned int i = loop + 1; |
|
|
|
candidate_count < max_files_to_compact && i < sorted_runs.size(); |
|
|
|
candidate_count < max_files_to_compact && i < sorted_runs.size(); |
|
|
|
i++) { |
|
|
|
i++) { |
|
|
|
const SortedRun* suceeding_sr = &sorted_runs[i]; |
|
|
|
const SortedRun* succeeding_sr = &sorted_runs[i]; |
|
|
|
if (suceeding_sr->being_compacted) { |
|
|
|
if (succeeding_sr->being_compacted) { |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
// Pick files if the total/last candidate file size (increased by the
|
|
|
|
// Pick files if the total/last candidate file size (increased by the
|
|
|
@ -1263,14 +1263,14 @@ Compaction* UniversalCompactionPicker::PickCompactionUniversalReadAmp( |
|
|
|
// kCompactionStopStyleSimilarSize, it's simply the size of the last
|
|
|
|
// kCompactionStopStyleSimilarSize, it's simply the size of the last
|
|
|
|
// picked file.
|
|
|
|
// picked file.
|
|
|
|
double sz = candidate_size * (100.0 + ratio) / 100.0; |
|
|
|
double sz = candidate_size * (100.0 + ratio) / 100.0; |
|
|
|
if (sz < static_cast<double>(suceeding_sr->size)) { |
|
|
|
if (sz < static_cast<double>(succeeding_sr->size)) { |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
if (ioptions_.compaction_options_universal.stop_style == |
|
|
|
if (ioptions_.compaction_options_universal.stop_style == |
|
|
|
kCompactionStopStyleSimilarSize) { |
|
|
|
kCompactionStopStyleSimilarSize) { |
|
|
|
// Similar-size stopping rule: also check the last picked file isn't
|
|
|
|
// Similar-size stopping rule: also check the last picked file isn't
|
|
|
|
// far larger than the next candidate file.
|
|
|
|
// far larger than the next candidate file.
|
|
|
|
sz = (suceeding_sr->size * (100.0 + ratio)) / 100.0; |
|
|
|
sz = (succeeding_sr->size * (100.0 + ratio)) / 100.0; |
|
|
|
if (sz < static_cast<double>(candidate_size)) { |
|
|
|
if (sz < static_cast<double>(candidate_size)) { |
|
|
|
// If the small file we've encountered begins a run of similar-size
|
|
|
|
// If the small file we've encountered begins a run of similar-size
|
|
|
|
// files, we'll pick them up on a future iteration of the outer
|
|
|
|
// files, we'll pick them up on a future iteration of the outer
|
|
|
@ -1278,9 +1278,9 @@ Compaction* UniversalCompactionPicker::PickCompactionUniversalReadAmp( |
|
|
|
// by the last-resort read amp strategy which disregards size ratios.
|
|
|
|
// by the last-resort read amp strategy which disregards size ratios.
|
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
candidate_size = suceeding_sr->compensated_file_size; |
|
|
|
candidate_size = succeeding_sr->compensated_file_size; |
|
|
|
} else { // default kCompactionStopStyleTotalSize
|
|
|
|
} else { // default kCompactionStopStyleTotalSize
|
|
|
|
candidate_size += suceeding_sr->compensated_file_size; |
|
|
|
candidate_size += succeeding_sr->compensated_file_size; |
|
|
|
} |
|
|
|
} |
|
|
|
candidate_count++; |
|
|
|
candidate_count++; |
|
|
|
} |
|
|
|
} |
|
|
|