@@ -40,17 +40,21 @@ impl<IO: Io> Replicator<IO> {
4040 ///
4141 /// In a single replication step, the replicator guarantees that a minimal set of frames is
4242 /// sent to the replica.
43+ #[ tracing:: instrument( skip( self ) ) ]
4344 pub fn into_frame_stream ( mut self ) -> impl Stream < Item = Result < Box < Frame > > > + Send {
4445 async_stream:: try_stream! {
4546 loop {
4647 // First we decide up to what frame_no we want to replicate in this step. If we are
4748 // already up to date, wait for something to happen
49+ tracing:: debug!( next_frame_no = self . next_frame_no) ;
4850 let most_recent_frame_no = * self
4951 . new_frame_notifier
5052 . wait_for( |fno| * fno >= self . next_frame_no)
5153 . await
5254 . expect( "channel cannot be closed because we hold a ref to the sending end" ) ;
5355
56+ tracing:: debug!( most_recent_frame_no, "new frame_no available" ) ;
57+
5458 let mut commit_frame_no = 0 ;
5559 // we have stuff to replicate
5660 if most_recent_frame_no >= self . next_frame_no {
@@ -66,6 +70,7 @@ impl<IO: Io> Replicator<IO> {
6670
6771 let mut stream = stream. peekable( ) ;
6872
73+ tracing:: debug!( replicated_until, "replicating from current log" ) ;
6974 loop {
7075 let Some ( frame) = stream. next( ) . await else { break } ;
7176 let mut frame = frame. map_err( |e| Error :: CurrentSegment ( e. into( ) ) ) ?;
@@ -88,6 +93,7 @@ impl<IO: Io> Replicator<IO> {
8893 . stream_pages_from( replicated_until, self . next_frame_no, & mut seen) . await ;
8994 tokio:: pin!( stream) ;
9095
96+ tracing:: debug!( replicated_until, "replicating from tail" ) ;
9197 let mut stream = stream. peekable( ) ;
9298
9399 let should_replicate_from_storage = replicated_until != self . next_frame_no;
@@ -110,6 +116,7 @@ impl<IO: Io> Replicator<IO> {
110116 // Replicating from sealed segments was not enough, so we replicate from
111117 // durable storage
112118 if let Some ( replicated_until) = replicated_until {
119+ tracing:: debug!( "replicating from durable storage" ) ;
113120 let stream = self
114121 . shared
115122 . stored_segments
0 commit comments