Skip to content

Commit

Permalink
chore: revert changes for request
Browse files Browse the repository at this point in the history
  • Loading branch information
zyy17 committed Jun 26, 2024
1 parent 2731e76 commit 4bf1673
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/mito2/src/compaction/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ impl CompactionTask for CompactionTaskImpl {
let notify = match self.handle_compaction().await {
Ok(edit) => BackgroundNotify::CompactionFinished(CompactionFinished {
region_id: self.compaction_region.region_id,
senders: Some(std::mem::take(&mut self.waiters)),
senders: std::mem::take(&mut self.waiters),
start_time: self.start_time,
edit,
}),
Expand Down
18 changes: 7 additions & 11 deletions src/mito2/src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ pub(crate) struct CompactionFinished {
/// Region id.
pub(crate) region_id: RegionId,
/// Compaction result senders.
pub(crate) senders: Option<Vec<OutputTx>>,
pub(crate) senders: Vec<OutputTx>,
/// Start time of compaction task.
pub(crate) start_time: Instant,
/// Region edit to apply.
Expand All @@ -705,10 +705,8 @@ impl CompactionFinished {
// only update compaction time on success
COMPACTION_ELAPSED_TOTAL.observe(self.start_time.elapsed().as_secs_f64());

if let Some(senders) = self.senders {
for sender in senders {
sender.send(Ok(0));
}
for sender in self.senders {
sender.send(Ok(0));
}

info!("Successfully compacted region: {}", self.region_id);
Expand All @@ -719,12 +717,10 @@ impl OnFailure for CompactionFinished {
/// Compaction succeeded but failed to update manifest or region's already been dropped.
fn on_failure(&mut self, err: Error) {
let err = Arc::new(err);
if let Some(senders) = &mut self.senders {
for sender in senders.drain(..) {
sender.send(Err(err.clone()).context(CompactRegionSnafu {
region_id: self.region_id,
}));
}
for sender in self.senders.drain(..) {
sender.send(Err(err.clone()).context(CompactRegionSnafu {
region_id: self.region_id,
}));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/mito2/src/schedule/remote_job_scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ impl Notifier for DefaultNotifier {
} else if let Some(region_edit) = result.region_edit {
BackgroundNotify::CompactionFinished(CompactionFinished {
region_id: result.region_id,
senders: None,
senders: vec![],
start_time: result.start_time,
edit: region_edit,
})
Expand Down

0 comments on commit 4bf1673

Please sign in to comment.