Skip to content

Commit

Permalink
typo
Browse files Browse the repository at this point in the history
  • Loading branch information
Li0k committed Sep 9, 2024
1 parent 7be2d3d commit e3f02c7
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ impl HummockManager {
let left_obj_id = left_last_sst.object_id;
let right_obj_id = right_first_sst.object_id;

// Since the sst key_range within a group is legal, we only need to check the ssts adjacent to the two groups.
if !can_concat(&[left_last_sst, right_first_sst]) {
return Err(Error::CompactionGroup(format!(
"invalid merge group_1 {} group_2 {} level_idx {} left_last_sst_id {} right_first_sst_id {} left_obj_id {} right_obj_id {}",
Expand Down
92 changes: 30 additions & 62 deletions src/storage/hummock_test/src/compactor_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2128,19 +2128,31 @@ pub(crate) mod tests {
let parent_group_id = 2;
let split_table_ids = vec![table_id_2.table_id()];

// compact
{
async fn compact_once(
group_id: CompactionGroupId,
level: usize,
hummock_manager_ref: HummockManagerRef,
compact_ctx: CompactorContext,
filter_key_extractor_manager: FilterKeyExtractorManager,
sstable_object_id_manager: Arc<SstableObjectIdManager>,
) {
// compact left group
let manual_compcation_option = ManualCompactionOption {
level: 0,
level,
..Default::default()
};
// 2. get compact task
let mut compact_task = hummock_manager_ref
.manual_get_compact_task(parent_group_id, manual_compcation_option)
let compact_task = hummock_manager_ref
.manual_get_compact_task(group_id, manual_compcation_option)
.await
.unwrap()
.unwrap();

if compact_task.is_none() {
return;
}

let mut compact_task = compact_task.unwrap();

let compaction_filter_flag =
CompactionFilterFlag::STATE_CLEAN | CompactionFilterFlag::TTL;
compact_task.compaction_filter_mask = compaction_filter_flag.bits();
Expand All @@ -2152,7 +2164,7 @@ pub(crate) mod tests {
// 3. compact
let (_tx, rx) = tokio::sync::oneshot::channel();
let ((result_task, task_stats), _) = compact(
compact_ctx.clone(),
compact_ctx,
compact_task.clone(),
rx,
Box::new(sstable_object_id_manager.clone()),
Expand All @@ -2171,6 +2183,17 @@ pub(crate) mod tests {
.unwrap();
}

// compact
compact_once(
parent_group_id,
0,
hummock_manager_ref.clone(),
compact_ctx.clone(),
filter_key_extractor_manager.clone(),
sstable_object_id_manager.clone(),
)
.await;

let new_cg_id = hummock_manager_ref
.split_compaction_group(parent_group_id, &split_table_ids, 0)
.await
Expand All @@ -2197,61 +2220,6 @@ pub(crate) mod tests {
.await;
epoch += millisec_interval_epoch;

async fn compact_once(
group_id: CompactionGroupId,
level: usize,
hummock_manager_ref: HummockManagerRef,
compact_ctx: CompactorContext,
filter_key_extractor_manager: FilterKeyExtractorManager,
sstable_object_id_manager: Arc<SstableObjectIdManager>,
) {
// compact left group
let manual_compcation_option = ManualCompactionOption {
level,
..Default::default()
};
// 2. get compact task
let compact_task = hummock_manager_ref
.manual_get_compact_task(group_id, manual_compcation_option)
.await
.unwrap();

if compact_task.is_none() {
return;
}

let mut compact_task = compact_task.unwrap();

let compaction_filter_flag =
CompactionFilterFlag::STATE_CLEAN | CompactionFilterFlag::TTL;
compact_task.compaction_filter_mask = compaction_filter_flag.bits();
compact_task.current_epoch_time = hummock_manager_ref
.get_current_version()
.await
.max_committed_epoch();

// 3. compact
let (_tx, rx) = tokio::sync::oneshot::channel();
let ((result_task, task_stats), _) = compact(
compact_ctx,
compact_task.clone(),
rx,
Box::new(sstable_object_id_manager.clone()),
filter_key_extractor_manager.clone(),
)
.await;

hummock_manager_ref
.report_compact_task(
result_task.task_id,
result_task.task_status,
result_task.sorted_output_ssts,
Some(to_prost_table_stats_map(task_stats)),
)
.await
.unwrap();
}

compact_once(
parent_group_id,
0,
Expand Down

0 comments on commit e3f02c7

Please sign in to comment.