@@ -756,13 +756,8 @@ impl Coordinator {
756
756
) ;
757
757
758
758
let builtin_table_updates = vec ! [ builtin_table_retraction, builtin_table_addition] ;
759
-
760
- self . builtin_table_update ( )
761
- . execute ( builtin_table_updates)
762
- . await
763
- . 0
764
- . instrument ( info_span ! ( "coord::message_cluster_event::table_updates" ) )
765
- . await ;
759
+ // Returns a Future that completes when the Builtin Table write is completed.
760
+ let builtin_table_completion = self . builtin_table_update ( ) . defer ( builtin_table_updates) ;
766
761
767
762
let cluster = self . catalog ( ) . get_cluster ( event. cluster_id ) ;
768
763
let replica = cluster. replica ( event. replica_id ) . expect ( "Replica exists" ) ;
@@ -771,12 +766,24 @@ impl Coordinator {
771
766
. get_cluster_replica_status ( event. cluster_id , event. replica_id ) ;
772
767
773
768
if old_replica_status != new_replica_status {
774
- self . broadcast_notice ( AdapterNotice :: ClusterReplicaStatusChanged {
769
+ let notifier = self . broadcast_notice_tx ( ) ;
770
+ let notice = AdapterNotice :: ClusterReplicaStatusChanged {
775
771
cluster : cluster. name . clone ( ) ,
776
772
replica : replica. name . clone ( ) ,
777
773
status : new_replica_status,
778
774
time : event. time ,
779
- } ) ;
775
+ } ;
776
+ // In a separate task, so we don't block the Coordinator, wait for the builtin
777
+ // table update to complete, and then notify active sessions.
778
+ mz_ore:: task:: spawn (
779
+ || format ! ( "cluster_event-{}-{}" , event. cluster_id, event. replica_id) ,
780
+ async move {
781
+ // Wait for the builtin table updates to complete.
782
+ builtin_table_completion. await ;
783
+ // Notify all sessions that were active at the time the cluster status changed.
784
+ ( notifier) ( notice)
785
+ } ,
786
+ ) ;
780
787
}
781
788
}
782
789
}
0 commit comments