@@ -543,7 +543,7 @@ where
543543
544544 // --- data ---
545545 current_term : st. vote_ref ( ) . term ( ) ,
546- vote : st. io_state ( ) . log_progress . flushed ( ) . map ( |io_id| io_id. to_vote ( ) ) . unwrap_or_default ( ) ,
546+ vote : st. log_progress ( ) . flushed ( ) . map ( |io_id| io_id. to_vote ( ) ) . unwrap_or_default ( ) ,
547547 last_log_index : st. last_log_id ( ) . index ( ) ,
548548 last_applied : st. io_applied ( ) . cloned ( ) ,
549549 snapshot : st. io_snapshot_last_log_id ( ) . cloned ( ) ,
@@ -575,7 +575,7 @@ where
575575
576576 let server_metrics = RaftServerMetrics {
577577 id : self . id . clone ( ) ,
578- vote : st. io_state ( ) . log_progress . flushed ( ) . map ( |io_id| io_id. to_vote ( ) ) . unwrap_or_default ( ) ,
578+ vote : st. log_progress ( ) . flushed ( ) . map ( |io_id| io_id. to_vote ( ) ) . unwrap_or_default ( ) ,
579579 state : st. server_state ,
580580 current_leader,
581581 membership_config,
@@ -861,7 +861,7 @@ where
861861 tracing:: debug!(
862862 "RAFT_stats id={:<2} log_io: {}" ,
863863 self . id,
864- self . engine. state. io_state . log_progress
864+ self . engine. state. log_progress( )
865865 ) ;
866866
867867 // In each loop, it does not have to check rx_shutdown and flush metrics for every RaftMsg
@@ -1368,7 +1368,7 @@ where
13681368 }
13691369
13701370 Notification :: LocalIO { io_id } => {
1371- self . engine . state . io_state . log_progress . flush ( io_id. clone ( ) ) ;
1371+ self . engine . state . log_progress_mut ( ) . flush ( io_id. clone ( ) ) ;
13721372
13731373 match io_id {
13741374 IOId :: Log ( log_io_id) => {
@@ -1448,16 +1448,18 @@ where
14481448 func_name!( )
14491449 ) ;
14501450
1451- self . engine . state . io_state_mut ( ) . log_progress . flush ( io_id) ;
1451+ self . engine . state . log_progress_mut ( ) . flush ( io_id) ;
14521452
14531453 if let Some ( meta) = meta {
1454+ if let Some ( last) = & meta. last_log_id {
1455+ self . engine . state . apply_progress_mut ( ) . flush ( last. clone ( ) ) ;
1456+ }
14541457 let st = self . engine . state . io_state_mut ( ) ;
1455- st. update_applied ( meta. last_log_id . clone ( ) ) ;
14561458 st. update_snapshot ( meta. last_log_id ) ;
14571459 }
14581460 }
14591461 sm:: Response :: Apply ( res) => {
1460- self . engine . state . io_state_mut ( ) . update_applied ( Some ( res. last_applied . clone ( ) ) ) ;
1462+ self . engine . state . apply_progress_mut ( ) . flush ( res. last_applied ) ;
14611463 }
14621464 }
14631465 }
@@ -1613,7 +1615,7 @@ where
16131615 if let Some ( condition) = condition {
16141616 match condition {
16151617 Condition :: IOFlushed { io_id } => {
1616- let curr = self . engine . state . io_state ( ) . log_progress . flushed ( ) ;
1618+ let curr = self . engine . state . log_progress ( ) . flushed ( ) ;
16171619 if curr < Some ( & io_id) {
16181620 tracing:: debug!(
16191621 "io_id: {} has not yet flushed, currently flushed: {} postpone cmd: {}" ,
@@ -1625,7 +1627,7 @@ where
16251627 }
16261628 }
16271629 Condition :: LogFlushed { log_id } => {
1628- let curr = self . engine . state . io_state ( ) . log_progress . flushed ( ) ;
1630+ let curr = self . engine . state . log_progress ( ) . flushed ( ) ;
16291631 let curr = curr. and_then ( |x| x. last_log_id ( ) ) ;
16301632 if curr < log_id. as_ref ( ) {
16311633 tracing:: debug!(
@@ -1664,7 +1666,7 @@ where
16641666
16651667 match cmd {
16661668 Command :: UpdateIOProgress { io_id, .. } => {
1667- self . engine . state . io_state . log_progress . submit ( io_id. clone ( ) ) ;
1669+ self . engine . state . log_progress_mut ( ) . submit ( io_id. clone ( ) ) ;
16681670
16691671 let notify = Notification :: LocalIO { io_id : io_id. clone ( ) } ;
16701672
@@ -1689,13 +1691,13 @@ where
16891691 //
16901692 // The `submit` state must be updated before calling `append()`,
16911693 // because `append()` may call the callback before returning.
1692- self . engine . state . io_state . log_progress . submit ( io_id) ;
1694+ self . engine . state . log_progress_mut ( ) . submit ( io_id) ;
16931695
16941696 // Submit IO request, do not wait for the response.
16951697 self . log_store . append ( entries, callback) . await ?;
16961698 }
16971699 Command :: SaveVote { vote } => {
1698- self . engine . state . io_state_mut ( ) . log_progress . submit ( IOId :: new ( & vote) ) ;
1700+ self . engine . state . log_progress_mut ( ) . submit ( IOId :: new ( & vote) ) ;
16991701 self . log_store . save_vote ( & vote) . await ?;
17001702
17011703 let _ = self . tx_notification . send ( Notification :: LocalIO {
@@ -1758,7 +1760,7 @@ where
17581760 already_committed,
17591761 upto,
17601762 } => {
1761- self . engine . state . io_state . apply_progress . submit ( upto. clone ( ) ) ;
1763+ self . engine . state . apply_progress_mut ( ) . submit ( upto. clone ( ) ) ;
17621764 let first = self . engine . state . get_log_id ( already_committed. next_index ( ) ) . unwrap ( ) ;
17631765 self . apply_to_state_machine ( first, upto) . await ?;
17641766 }
@@ -1786,15 +1788,15 @@ where
17861788 self . heartbeat_handle . spawn_workers ( & mut self . network_factory , & self . tx_notification , nodes) . await ;
17871789 }
17881790 Command :: StateMachine { command } => {
1789- let io_id = command. get_submit_io ( ) ;
1791+ let io_id = command. get_log_progress ( ) ;
17901792
17911793 if let Some ( io_id) = io_id {
1792- self . engine . state . io_state . log_progress . submit ( io_id) ;
1794+ self . engine . state . log_progress_mut ( ) . submit ( io_id) ;
17931795 }
17941796
17951797 // If this command update the last-applied log id, mark it as submitted(to state machine).
17961798 if let Some ( log_id) = command. get_apply_progress ( ) {
1797- self . engine . state . io_state . apply_progress . submit ( log_id) ;
1799+ self . engine . state . apply_progress_mut ( ) . submit ( log_id) ;
17981800 }
17991801
18001802 // Just forward a state machine command to the worker.
0 commit comments