Dear Amit, Sorry, I forgot to say one content.
> > But that is not a good reason for this operation to stop workers > > first. Instead, we should prohibit this operation if any worker is > > present. The reason is that there is always a chance that if any > > worker is alive, it can prepare a new transaction after we have > > checked for the presence of any prepared transactions. > > I used the function because it internally waits until all workers are exited. > But OK, I modified like you suggested (logicalrep_workers_find() is used). Based on the reason, after the above modification, test codes prior to v14 sometimes failed because backend could execute ALTER SUBSCRIPTION ... SET (two_phase). So I added lines in test codes to poll until workers are exited, e.g., ``` +# Alter subscription two_phase to false +$node_subscriber->safe_psql('postgres', + "ALTER SUBSCRIPTION tap_sub_copy DISABLE;"); +$node_subscriber->poll_query_until('postgres', + "SELECT count(*) = 0 FROM pg_stat_activity WHERE backend_type = 'logical replication worker'" +); +$node_subscriber->safe_psql( + 'postgres', " + ALTER SUBSCRIPTION tap_sub_copy SET (two_phase = false); + ALTER SUBSCRIPTION tap_sub_copy ENABLE;"); ``` Best Regards, Hayato Kuroda FUJITSU LIMITED https://www.fujitsu.com/