File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,10 +57,20 @@ pub struct SharedWal<IO: Io> {
5757}
5858
5959impl < IO : Io > SharedWal < IO > {
60+ #[ tracing:: instrument( skip( self ) , fields( namespace = self . namespace. as_str( ) ) ) ]
6061 pub fn shutdown ( & self ) -> Result < ( ) > {
62+ tracing:: info!( "started namespace shutdown" ) ;
6163 self . shutdown . store ( true , Ordering :: SeqCst ) ;
62- let mut tx = Transaction :: Read ( self . begin_read ( u64:: MAX ) ) ;
63- self . upgrade ( & mut tx) ?;
64+ // fixme: for infinite loop
65+ let mut tx = loop {
66+ let mut tx = Transaction :: Read ( self . begin_read ( u64:: MAX ) ) ;
67+ match self . upgrade ( & mut tx) {
68+ Ok ( _) => break tx,
69+ Err ( Error :: BusySnapshot ) => continue ,
70+ Err ( e) => return Err ( e) ,
71+ }
72+ } ;
73+
6474 {
6575 let mut tx = tx. as_write_mut ( ) . unwrap ( ) . lock ( ) ;
6676 tx. commit ( ) ;
@@ -69,6 +79,7 @@ impl<IO: Io> SharedWal<IO> {
6979 // The current segment will not be used anymore. It's empty, but we still seal it so that
7080 // the next startup doesn't find an unsealed segment.
7181 self . current . load ( ) . seal ( ) ?;
82+ tracing:: info!( "namespace shutdown" ) ;
7283 Ok ( ( ) )
7384 }
7485
You can’t perform that action at this time.
0 commit comments