Skip to content

Commit

Permalink
catch another ? in compaction worker, #87
Browse files Browse the repository at this point in the history
  • Loading branch information
marvin-j97 committed Dec 7, 2024
1 parent f4b745c commit 5c02628
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/compaction/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ fn merge_segments(

let start = Instant::now();

let mut segment_writer = MultiWriter::new(
let Ok(segment_writer) = MultiWriter::new(
opts.segment_id_generator.clone(),
payload.target_size,
crate::segment::writer::Options {
Expand All @@ -252,8 +252,19 @@ fn merge_segments(
data_block_size: opts.config.data_block_size,
index_block_size: opts.config.index_block_size,
},
)?
.use_compression(opts.config.compression);
) else {
log::error!("Compaction failed");

// IMPORTANT: Show the segments again, because compaction failed
opts.levels
.write()
.expect("lock is poisoned")
.show_segments(payload.segment_ids.iter().copied());

return Ok(());
};

let mut segment_writer = segment_writer.use_compression(opts.config.compression);

#[cfg(feature = "bloom")]
{
Expand Down

0 comments on commit 5c02628

Please sign in to comment.