Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions be/src/common/config.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -524,10 +524,10 @@ DEFINE_mDouble(compaction_promotion_ratio, "0.05");
DEFINE_mInt64(compaction_promotion_min_size_mbytes, "128");

// When output rowset of cumulative compaction total version count (end_version - start_version)
// exceed this config count, the rowset will be moved to base compaction
// NOTE: this config will work for unique key merge-on-write table only, to reduce version count
// related cost on delete bitmap more effectively.
DEFINE_mInt64(compaction_promotion_version_count, "1000");
// exceed this config count, the rowset will be moved to base compaction.
// NOTE: this config only works for unique key merge-on-write tables. The default maximum value
// disables version-count-based promotion while retaining the option to enable it when needed.
DEFINE_mInt64(compaction_promotion_version_count, "9223372036854775807");

// The lower bound size to do cumulative compaction. When total disk size of candidate rowsets is less than
// this size, size_based policy may not do to cumulative compaction. The unit is m byte.
Expand Down
6 changes: 3 additions & 3 deletions be/src/common/config.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -614,9 +614,9 @@ DECLARE_mDouble(compaction_promotion_ratio);
DECLARE_mInt64(compaction_promotion_min_size_mbytes);

// When output rowset of cumulative compaction total version count (end_version - start_version)
// exceed this config count, the rowset will be moved to base compaction
// NOTE: this config will work for unique key merge-on-write table only, to reduce version count
// related cost on delete bitmap more effectively.
// exceed this config count, the rowset will be moved to base compaction.
// NOTE: this config only works for unique key merge-on-write tables. The default maximum value
// disables version-count-based promotion while retaining the option to enable it when needed.
DECLARE_mInt64(compaction_promotion_version_count);

// The lower bound size to do cumulative compaction. When total disk size of candidate rowsets is less than
Expand Down
13 changes: 13 additions & 0 deletions be/test/cloud/cloud_cumulative_compaction_policy_test.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -212,6 +212,19 @@ TEST_F(TestCloudSizeBasedCumulativeCompactionPolicy, new_cumulative_point) {
EXPECT_EQ(policy.new_cumulative_point(&_tablet, output_rowset, version, 2), 6);
}

TEST_F(TestCloudSizeBasedCumulativeCompactionPolicy,
new_cumulative_point_does_not_promote_small_mow_rowset_with_default_version_limit) {
CloudTablet tablet(_engine, _tablet_meta);
tablet._tablet_meta->_enable_unique_key_merge_on_write = true;
tablet._base_size = kGiB;

CloudSizeBasedCumulativeCompactionPolicy policy;
RowsetSharedPtr output_rowset = create_rowset(Version(2, 1003), 1, false, kMiB);
Version last_delete_version {-1, -1};

EXPECT_EQ(2, policy.new_cumulative_point(&tablet, output_rowset, last_delete_version, 2));
}

TEST_F(TestCloudSizeBasedCumulativeCompactionPolicy,
pick_input_rowsets_notready_keeps_latest_versions) {
auto base_rowset = create_rowset(Version(0, 1), 1, false, kGiB);
Expand Down
23 changes: 23 additions & 0 deletions be/test/storage/compaction/cumulative_compaction_policy_test.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -1238,6 +1238,29 @@ TEST_F(TestSizeBasedCumulativeCompactionPolicy,
EXPECT_EQ(0, compaction_score);
}

TEST_F(TestSizeBasedCumulativeCompactionPolicy,
update_cumulative_point_does_not_promote_small_mow_rowset_with_default_version_limit) {
_tablet_meta->set_enable_unique_key_merge_on_write(true);
TabletSharedPtr tablet(
new Tablet(_engine, _tablet_meta, nullptr, CUMULATIVE_SIZE_BASED_POLICY));
ASSERT_TRUE(tablet->init().ok());
tablet->set_cumulative_layer_point(1);
tablet->set_cumulative_promotion_size(64L * kMiB);

RowsetMetaSharedPtr output_meta(new RowsetMeta());
init_rs_meta(output_meta, 1, 1002);
output_meta->set_total_disk_size(kMiB);
RowsetSharedPtr output_rowset;
ASSERT_TRUE(RowsetFactory::create_rowset(nullptr, "", output_meta, &output_rowset).ok());

std::vector<RowsetSharedPtr> input_rowsets;
Version last_delete_version {-1, -1};
tablet->_cumulative_compaction_policy->update_cumulative_point(
tablet.get(), input_rowsets, output_rowset, last_delete_version);

EXPECT_EQ(1, tablet->cumulative_layer_point());
}

TEST_F(TestSizeBasedCumulativeCompactionPolicy,
pick_input_rowsets_large_head_single_overlapping_tail_selected) {
std::vector<RowsetMetaSharedPtr> rs_metas;
Expand Down
Loading