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

fix(storage): fix check compaction task opportunity #14675

Merged
merged 1 commit into from
Jan 22, 2024
Merged
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
34 changes: 16 additions & 18 deletions src/storage/src/hummock/compactor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -473,23 +473,7 @@ pub fn start_compactor(
sstable_object_id_manager.remove_watermark_object_id(tracker_id);
},
);
let enable_check_compaction_result = context.storage_opts.check_compaction_result;
let compact_result = compactor_runner::compact(context.clone(), compact_task, rx, Box::new(sstable_object_id_manager.clone()), filter_key_extractor_manager.clone()).await;
let need_check_task = !compact_result.0.sorted_output_ssts.is_empty() && compact_result.0.task_status() == TaskStatus::Success;

if enable_check_compaction_result && need_check_task {
match check_compaction_result(&compact_result.0, context.clone()).await {
Err(e) => {
tracing::warn!("Failed to check compaction task {} because: {:?}",compact_result.0.task_id, e);
},
Ok(true) => (),
Ok(false) => {
panic!("Failed to pass consistency check for result of compaction task:\n{:?}", compact_task_to_string(&compact_result.0));
}
}
}

compact_result
compactor_runner::compact(context.clone(), compact_task, rx, Box::new(sstable_object_id_manager.clone()), filter_key_extractor_manager.clone()).await
},
Err(err) => {
tracing::warn!("Failed to track pending SST object id. {:#?}", err);
Expand All @@ -500,12 +484,14 @@ pub fn start_compactor(
};
shutdown.lock().unwrap().remove(&task_id);

let enable_check_compaction_result = context.storage_opts.check_compaction_result;
let need_check_task = !compact_task.sorted_output_ssts.is_empty() && compact_task.task_status() == TaskStatus::Success;
if let Err(e) = request_sender.send(SubscribeCompactionEventRequest {
event: Some(RequestEvent::ReportTask(
ReportTask {
task_id: compact_task.task_id,
task_status: compact_task.task_status,
sorted_output_ssts: compact_task.sorted_output_ssts,
sorted_output_ssts: compact_task.sorted_output_ssts.clone(),
table_stats_change:to_prost_table_stats_map(table_stats),
}
)),
Expand All @@ -515,6 +501,18 @@ pub fn start_compactor(
.as_millis() as u64,
}) {
tracing::warn!("Failed to report task {task_id:?} . {e:?}");
if enable_check_compaction_result && need_check_task {
match check_compaction_result(&compact_task, context.clone()).await {
Err(e) => {
tracing::warn!("Failed to check compaction task {} because: {:?}",compact_task.task_id, e);
},
Ok(true) => (),
Ok(false) => {
panic!("Failed to pass consistency check for result of compaction task:\n{:?}", compact_task_to_string(&compact_task));
}
}
}

}
}
ResponseEvent::VacuumTask(vacuum_task) => {
Expand Down
Loading