@@ -221,6 +221,11 @@ where
221221 }
222222 }
223223
224+ fn cancel_stashed_command ( & mut self , id : TableId ) {
225+ self . finished_commands
226+ . retain ( |x| x. context . table_to_create ( ) != Some ( id) ) ;
227+ }
228+
224229 /// Before resolving the actors to be sent or collected, we should first record the newly
225230 /// created table and added actors into checkpoint control, so that `can_actor_send_or_collect`
226231 /// will return `true`.
@@ -964,6 +969,14 @@ where
964969 checkpoint_control. stash_command_to_finish ( command) ;
965970 }
966971
972+ if let Some ( command) = cancelled_command {
973+ checkpoint_control. cancel_command ( command) ;
974+ } else if let Some ( table_id) = node. command_ctx . table_to_cancel ( ) {
975+ // the cancelled command is possibly stashed in `finished_commands` and waiting
976+ // for checkpoint, we should also clear it.
977+ checkpoint_control. cancel_stashed_command ( table_id) ;
978+ }
979+
967980 let remaining = checkpoint_control. finish_commands ( checkpoint) . await ?;
968981 // If there are remaining commands (that requires checkpoint to finish), we force
969982 // the next barrier to be a checkpoint.
@@ -972,10 +985,6 @@ where
972985 self . scheduled_barriers . force_checkpoint_in_next_barrier ( ) ;
973986 }
974987
975- if let Some ( command) = cancelled_command {
976- checkpoint_control. cancel_command ( command) ;
977- }
978-
979988 node. timer . take ( ) . unwrap ( ) . observe_duration ( ) ;
980989 node. wait_commit_timer . take ( ) . unwrap ( ) . observe_duration ( ) ;
981990
0 commit comments