chaoyli commented on a change in pull request #2558: [Compaction] Support
compact only one rowset
URL: https://github.com/apache/incubator-doris/pull/2558#discussion_r361355813
##########
File path: be/src/olap/cumulative_compaction.cpp
##########
@@ -67,57 +67,54 @@ OLAPStatus CumulativeCompaction::pick_rowsets_to_compact()
{
std::vector<RowsetSharedPtr> candidate_rowsets;
_tablet->pick_candicate_rowsets_to_cumulative_compaction(&candidate_rowsets);
- if (candidate_rowsets.size() <= 1) {
+ if (candidate_rowsets.empty()) {
return OLAP_ERR_CUMULATIVE_NO_SUITABLE_VERSIONS;
}
std::sort(candidate_rowsets.begin(), candidate_rowsets.end(),
Rowset::comparator);
RETURN_NOT_OK(check_version_continuity(candidate_rowsets));
std::vector<RowsetSharedPtr> transient_rowsets;
- size_t num_overlapping_segments = 0;
+ size_t compaction_score = 0;
// the last delete version we meet when traversing candidate_rowsets
Version last_delete_version { -1, -1 };
- // traverse rowsets from begin to penultimate rowset.
- // Because VersionHash will calculated from chosen rowsets.
- // If ultimate singleton rowset is chosen, VersionHash
- // will be different from the value recorded in FE.
- // So the ultimate singleton rowset is revserved.
- for (size_t i = 0; i < candidate_rowsets.size() - 1; ++i) {
+ for (size_t i = 0; i < candidate_rowsets.size(); ++i) {
RowsetSharedPtr rowset = candidate_rowsets[i];
if (_tablet->version_for_delete_predicate(rowset->version())) {
last_delete_version = rowset->version();
- if (num_overlapping_segments >=
config::min_cumulative_compaction_num_singleton_deltas) {
+ if (!transient_rowsets.empty()) {
+ // we meet a delete version, and there were other versions
before.
+ // we should compact those version before handling them over
to base compaction
_input_rowsets = transient_rowsets;
break;
}
+
+ // we meet a delete version, and no othher versions before, skip
it and continue
Review comment:
other
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]