Skip to content
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

feat(meta): do not split small table from default group #16919

Closed
wants to merge 8 commits into from
Closed
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
13 changes: 10 additions & 3 deletions src/common/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,9 @@ pub struct MetaConfig {
#[serde(default = "default::meta::split_group_size_limit")]
pub split_group_size_limit: u64,

#[serde(default = "default::meta::max_group_size")]
pub max_group_size: u64,

#[serde(default = "default::meta::cut_table_size_limit")]
pub cut_table_size_limit: u64,

Expand Down Expand Up @@ -1262,11 +1265,15 @@ pub mod default {
}

pub fn move_table_size_limit() -> u64 {
10 * 1024 * 1024 * 1024 // 10GB
192 * 1024 * 1024 * 1024 // 192GB
}

pub fn split_group_size_limit() -> u64 {
64 * 1024 * 1024 * 1024 // 64GB
256 * 1024 * 1024 * 1024 // 256GB
}

pub fn max_group_size() -> u64 {
1024 * 1024 * 1024 * 1024 // 1TB
}

pub fn partition_vnode_count() -> u32 {
Expand Down Expand Up @@ -1796,7 +1803,7 @@ pub mod default {
const DEFAULT_MAX_SPACE_RECLAIM_BYTES: u64 = 512 * 1024 * 1024; // 512MB;
const DEFAULT_LEVEL0_STOP_WRITE_THRESHOLD_SUB_LEVEL_NUMBER: u64 = 300;
const DEFAULT_MAX_COMPACTION_FILE_COUNT: u64 = 100;
const DEFAULT_MIN_SUB_LEVEL_COMPACT_LEVEL_COUNT: u32 = 3;
const DEFAULT_MIN_SUB_LEVEL_COMPACT_LEVEL_COUNT: u32 = 4;
const DEFAULT_MIN_OVERLAPPING_SUB_LEVEL_COMPACT_LEVEL_COUNT: u32 = 12;
const DEFAULT_TOMBSTONE_RATIO_PERCENT: u32 = 40;
const DEFAULT_EMERGENCY_PICKER: bool = true;
Expand Down
3 changes: 2 additions & 1 deletion src/config/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ This page is automatically generated by `./risedev generate-example-config`
| full_gc_interval_sec | Interval of automatic hummock full GC. | 86400 |
| hummock_version_checkpoint_interval_sec | Interval of hummock version checkpoint. | 30 |
| hybrid_partition_vnode_count | Count of partitions of tables in default group and materialized view group. The meta node will decide according to some strategy whether to cut the boundaries of the file according to the vnode alignment. Each partition contains aligned data of `VirtualNode::COUNT / hybrid_partition_vnode_count` consecutive virtual-nodes of one state table. Set it zero to disable this feature. | 4 |
| max_group_size | | 1099511627776 |
| max_heartbeat_interval_secs | Maximum allowed heartbeat interval in seconds. | 60 |
| meta_leader_lease_secs | | 30 |
| min_delta_log_num_for_hummock_version_checkpoint | The minimum delta log number a new checkpoint should compact, otherwise the checkpoint attempt is rejected. | 10 |
| min_sst_retention_time_sec | Objects within `min_sst_retention_time_sec` won't be deleted by hummock full GC, even they are dangling. | 86400 |
| min_table_split_write_throughput | If the size of one table is smaller than `min_table_split_write_throughput`, we would not split it to an single group. | 4194304 |
| move_table_size_limit | | 10737418240 |
| move_table_size_limit | | 137438953472 |
| node_num_monitor_interval_sec | | 10 |
| parallelism_control_batch_size | The number of streaming jobs per scaling operation. | 10 |
| parallelism_control_trigger_first_delay_sec | The first delay of parallelism control. | 30 |
Expand Down
5 changes: 3 additions & 2 deletions src/config/example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ periodic_space_reclaim_compaction_interval_sec = 3600
periodic_ttl_reclaim_compaction_interval_sec = 1800
periodic_tombstone_reclaim_compaction_interval_sec = 600
periodic_split_compact_group_interval_sec = 10
move_table_size_limit = 10737418240
split_group_size_limit = 68719476736
move_table_size_limit = 137438953472
split_group_size_limit = 274877906944
max_group_size = 1099511627776
cut_table_size_limit = 1073741824
do_not_config_object_storage_lifecycle = false
partition_vnode_count = 16
Expand Down
1 change: 1 addition & 0 deletions src/meta/node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ pub fn start(opts: MetaNodeOpts) -> Pin<Box<dyn Future<Output = ()> + Send>> {
.meta
.periodic_split_compact_group_interval_sec,
split_group_size_limit: config.meta.split_group_size_limit,
max_group_size: config.meta.max_group_size,
min_table_split_size: config.meta.move_table_size_limit,
table_write_throughput_threshold: config.meta.table_write_throughput_threshold,
min_table_split_write_throughput: config.meta.min_table_split_write_throughput,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use std::cell::RefCell;
use std::sync::Arc;

use itertools::Itertools;
Expand All @@ -29,10 +28,6 @@ use crate::hummock::compaction::picker::TrivialMovePicker;
use crate::hummock::compaction::{create_overlap_strategy, CompactionDeveloperConfig};
use crate::hummock::level_handler::LevelHandler;

std::thread_local! {
static LOG_COUNTER: RefCell<usize> = const { RefCell::new(0) };
}

pub struct LevelCompactionPicker {
target_level: usize,
config: Arc<CompactionConfig>,
Expand Down Expand Up @@ -159,7 +154,7 @@ impl LevelCompactionPicker {
// half quota.
std::cmp::max(
self.config.max_bytes_for_level_base,
self.config.max_compaction_bytes / 2,
self.config.max_compaction_bytes,
),
1,
// The maximum number of sub_level compact level per task
Expand Down Expand Up @@ -257,23 +252,6 @@ impl LevelCompactionPicker {
ValidationRuleType::ToBase,
stats,
) {
if l0.total_file_size > target_level.total_file_size * 8 {
let log_counter = LOG_COUNTER.with_borrow_mut(|counter| {
*counter += 1;
*counter
});

// reduce log
if log_counter % 100 == 0 {
tracing::warn!("skip task with level count: {}, file count: {}, select size: {}, target size: {}, target level size: {}",
result.input_levels.len(),
result.total_file_count,
result.select_input_size,
result.target_input_size,
target_level.total_file_size,
);
}
}
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,17 +179,11 @@ impl CompactionTaskValidationRule for BaseCompactionTaskValidationRule {
fn validate(&self, input: &CompactionInput, stats: &mut LocalPickerStatistic) -> bool {
if input.total_file_count >= self.config.level0_max_compact_file_number
|| input.input_levels.len() >= MAX_COMPACT_LEVEL_COUNT
|| input.select_input_size >= self.config.max_compaction_bytes
{
return true;
}

// The size of target level may be too large, we shall skip this compact task and wait
// the data in base level compact to lower level.
if input.target_input_size > self.config.max_compaction_bytes {
stats.skip_by_count_limit += 1;
return false;
}

if input.select_input_size < input.target_input_size {
stats.skip_by_write_amp_limit += 1;
return false;
Expand Down
12 changes: 2 additions & 10 deletions src/meta/src/hummock/compaction/picker/intra_compaction_picker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,16 +159,6 @@ impl IntraCompactionPicker {
let mut select_input_size = 0;
let mut total_file_count = 0;
for input in l0_select_tables_vec {
let mut max_level_size = 0;
for level_select_table in &input.sstable_infos {
let level_select_size = level_select_table
.iter()
.map(|sst| sst.file_size)
.sum::<u64>();

max_level_size = std::cmp::max(max_level_size, level_select_size);
}

let mut select_level_inputs = Vec::with_capacity(input.sstable_infos.len());
for level_select_sst in input.sstable_infos {
if level_select_sst.is_empty() {
Expand Down Expand Up @@ -239,6 +229,8 @@ impl IntraCompactionPicker {
continue;
}

assert!(l0.sub_levels[idx + 1].sub_level_id != l0.sub_levels[idx].sub_level_id);

let trivial_move_picker = TrivialMovePicker::new(0, 0, overlap_strategy.clone());

let select_sst = trivial_move_picker.pick_trivial_move_sst(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ impl TierCompactionPicker {
target_level: 0,
target_sub_level_id: level.sub_level_id,
select_input_size: compaction_bytes,
target_input_size: 0,
total_file_count: compact_file_count,
vnode_partition_count,
..Default::default()
};

if !self.compaction_task_validator.valid_compact_task(
Expand Down
Loading
Loading