File tree 1 file changed +17
-0
lines changed
rust/worker/src/execution/orchestration
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,12 @@ pub struct CompactOrchestrator {
104
104
curr_max_offset_id : Arc < AtomicU32 > ,
105
105
max_compaction_size : usize ,
106
106
max_partition_size : usize ,
107
+ // Populated during compaction
108
+ writers : Option < (
109
+ RecordSegmentWriter ,
110
+ Box < DistributedHNSWSegmentWriter > ,
111
+ MetadataSegmentWriter < ' static > ,
112
+ ) > ,
107
113
}
108
114
109
115
#[ derive( Error , Debug ) ]
@@ -197,6 +203,7 @@ impl CompactOrchestrator {
197
203
curr_max_offset_id,
198
204
max_compaction_size,
199
205
max_partition_size,
206
+ writers : None ,
200
207
}
201
208
}
202
209
@@ -420,6 +427,10 @@ impl CompactOrchestrator {
420
427
) ,
421
428
Box < dyn ChromaError > ,
422
429
> {
430
+ if let Some ( writer) = & self . writers {
431
+ return Ok ( writer. clone ( ) ) ;
432
+ }
433
+
423
434
// Care should be taken to use the same writers across the compaction process
424
435
// Since the segment writers are stateful, we should not create new writers for each partition
425
436
// Nor should we create new writers across different tasks
@@ -543,6 +554,12 @@ impl CompactOrchestrator {
543
554
}
544
555
} ;
545
556
557
+ self . writers = Some ( (
558
+ record_segment_writer. clone ( ) ,
559
+ hnsw_segment_writer. clone ( ) ,
560
+ mt_segment_writer. clone ( ) ,
561
+ ) ) ;
562
+
546
563
Ok ( (
547
564
record_segment_writer,
548
565
hnsw_segment_writer,
You can’t perform that action at this time.
0 commit comments