File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -339,6 +339,7 @@ where
339339 ) ) ,
340340 shutdown : false . into ( ) ,
341341 checkpoint_notifier : self . checkpoint_notifier . clone ( ) ,
342+ max_segment_size : 1000 . into ( ) ,
342343 } ) ;
343344
344345 self . opened
Original file line number Diff line number Diff line change @@ -51,6 +51,8 @@ pub struct SharedWal<IO: Io> {
5151 pub ( crate ) stored_segments : Box < dyn ReplicateFromStorage > ,
5252 pub ( crate ) shutdown : AtomicBool ,
5353 pub ( crate ) checkpoint_notifier : mpsc:: Sender < CheckpointMessage > ,
54+ /// maximum size the segment is allowed to grow
55+ pub ( crate ) max_segment_size : AtomicUsize ,
5456}
5557
5658impl < IO : Io > SharedWal < IO > {
@@ -264,7 +266,9 @@ impl<IO: Io> SharedWal<IO> {
264266 }
265267
266268 // TODO: use config for max log size
267- if tx. is_commited ( ) && current. count_committed ( ) > 1000 {
269+ if tx. is_commited ( )
270+ && current. count_committed ( ) > self . max_segment_size . load ( Ordering :: Relaxed )
271+ {
268272 self . swap_current ( & tx) ?;
269273 }
270274
You can’t perform that action at this time.
0 commit comments