Skip to content

Commit a00a435

Browse files
committed
Fix bug
1 parent bfa2c3a commit a00a435

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

rust/worker/src/execution/orchestration/compact.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,12 @@ pub struct CompactOrchestrator {
104104
curr_max_offset_id: Arc<AtomicU32>,
105105
max_compaction_size: usize,
106106
max_partition_size: usize,
107+
// Populated during compaction
108+
writers: Option<(
109+
RecordSegmentWriter,
110+
Box<DistributedHNSWSegmentWriter>,
111+
MetadataSegmentWriter<'static>,
112+
)>,
107113
}
108114

109115
#[derive(Error, Debug)]
@@ -197,6 +203,7 @@ impl CompactOrchestrator {
197203
curr_max_offset_id,
198204
max_compaction_size,
199205
max_partition_size,
206+
writers: None,
200207
}
201208
}
202209

@@ -420,6 +427,10 @@ impl CompactOrchestrator {
420427
),
421428
Box<dyn ChromaError>,
422429
> {
430+
if let Some(writer) = &self.writers {
431+
return Ok(writer.clone());
432+
}
433+
423434
// Care should be taken to use the same writers across the compaction process
424435
// Since the segment writers are stateful, we should not create new writers for each partition
425436
// Nor should we create new writers across different tasks
@@ -543,6 +554,12 @@ impl CompactOrchestrator {
543554
}
544555
};
545556

557+
self.writers = Some((
558+
record_segment_writer.clone(),
559+
hnsw_segment_writer.clone(),
560+
mt_segment_writer.clone(),
561+
));
562+
546563
Ok((
547564
record_segment_writer,
548565
hnsw_segment_writer,

0 commit comments

Comments
 (0)