@@ -351,16 +351,18 @@ struct NamespaceStoreInner<M: MakeNamespace> {
351351 make_namespace : M ,
352352 allow_lazy_creation : bool ,
353353 has_shutdown : AtomicBool ,
354+ snapshot_at_shutdown : bool ,
354355}
355356
356357impl < M : MakeNamespace > NamespaceStore < M > {
357- pub fn new ( make_namespace : M , allow_lazy_creation : bool ) -> Self {
358+ pub fn new ( make_namespace : M , allow_lazy_creation : bool , snapshot_at_shutdown : bool ) -> Self {
358359 Self {
359360 inner : Arc :: new ( NamespaceStoreInner {
360361 store : Default :: default ( ) ,
361362 make_namespace,
362363 allow_lazy_creation,
363364 has_shutdown : AtomicBool :: new ( false ) ,
365+ snapshot_at_shutdown,
364366 } ) ,
365367 }
366368 }
@@ -598,7 +600,7 @@ impl<M: MakeNamespace> NamespaceStore<M> {
598600 self . inner . has_shutdown . store ( true , Ordering :: Relaxed ) ;
599601 let mut lock = self . inner . store . write ( ) . await ;
600602 for ( name, ns) in lock. drain ( ) {
601- ns. shutdown ( ) . await ?;
603+ ns. shutdown ( self . inner . snapshot_at_shutdown ) . await ?;
602604 trace ! ( "shutdown namespace: `{}`" , name) ;
603605 }
604606 Ok ( ( ) )
@@ -645,9 +647,11 @@ impl<T: Database> Namespace<T> {
645647 Ok ( ( ) )
646648 }
647649
648- async fn shutdown ( mut self ) -> anyhow:: Result < ( ) > {
650+ async fn shutdown ( mut self , should_checkpoint : bool ) -> anyhow:: Result < ( ) > {
649651 self . tasks . shutdown ( ) . await ;
650- self . checkpoint ( ) . await ?;
652+ if should_checkpoint {
653+ self . checkpoint ( ) . await ?;
654+ }
651655 self . db . shutdown ( ) . await ?;
652656 Ok ( ( ) )
653657 }
0 commit comments