File tree Expand file tree Collapse file tree 4 files changed +13
-8
lines changed
Expand file tree Collapse file tree 4 files changed +13
-8
lines changed Original file line number Diff line number Diff line change 109109 }
110110
111111 // now that we have loaded the records, check for redos and handle them
112- while ( engine . CountRedoRecords ( ) > 0 )
112+ for ( string redo = engine . GetRedoRecord ( ) ;
113+ redo != null ;
114+ redo = engine . GetRedoRecord ( ) )
113115 {
114- // get the next redo record
115- string redo = engine . GetRedoRecord ( ) ;
116-
117116 try
118117 {
119118 // process the redo record
Original file line number Diff line number Diff line change @@ -116,6 +116,9 @@ TaskScheduler taskScheduler
116116 } while ( pendingFutures . Count >= MaximumBacklog ) ;
117117
118118 // check if there are no redo records right now
119+ // NOTE: we do NOT want to call countRedoRecords() in a loop that
120+ // is processing redo records, we call it here AFTER we believe
121+ // have processed all pending redos to confirm still zero
119122 if ( engine . CountRedoRecords ( ) == 0 )
120123 {
121124 OutputRedoStatistics ( ) ;
Original file line number Diff line number Diff line change @@ -98,10 +98,10 @@ public static void main(String[] args) {
9898 }
9999
100100 // now that we have loaded the records, check for redos and handle them
101- while ( engine .countRedoRecords () > 0 ) {
102- // get the next redo record
103- String redo = engine .getRedoRecord ();
104-
101+ for ( String redo = engine .getRedoRecord ();
102+ redo != null ;
103+ redo = engine .getRedoRecord ())
104+ {
105105 try {
106106 // process the redo record
107107 engine .processRedoRecord (redo , SZ_NO_FLAGS );
Original file line number Diff line number Diff line change @@ -103,6 +103,9 @@ public static void main(String[] args) {
103103 } while (pendingFutures .size () >= MAXIMUM_BACKLOG );
104104
105105 // check if there are no redo records right now
106+ // NOTE: we do NOT want to call countRedoRecords() in a loop that
107+ // is processing redo records, we call it here AFTER we believe
108+ // have processed all pending redos to confirm still zero
106109 if (engine .countRedoRecords () == 0 ) {
107110 outputRedoStatistics ();
108111 System .out .println ();
You can’t perform that action at this time.
0 commit comments