|
292 | 292 | 'update works with dropped subscriber column');
|
293 | 293 |
|
294 | 294 | # check that change of connection string and/or publication list causes
|
295 |
| -# restart of subscription workers. Not all of these are registered as tests |
296 |
| -# as we need to poll for a change but the test suite will fail none the less |
297 |
| -# when something goes wrong. |
| 295 | +# restart of subscription workers. We check the state along with |
| 296 | +# application_name to ensure that the walsender is (re)started. |
| 297 | +# |
| 298 | +# Not all of these are registered as tests as we need to poll for a change |
| 299 | +# but the test suite will fail none the less when something goes wrong. |
298 | 300 | my$oldpid =$node_publisher->safe_psql('postgres',
|
299 |
| -"SELECT pid FROM pg_stat_replication WHERE application_name = 'tap_sub';" |
| 301 | +"SELECT pid FROM pg_stat_replication WHERE application_name = 'tap_sub' AND state = 'streaming';" |
300 | 302 | );
|
301 | 303 | $node_subscriber->safe_psql('postgres',
|
302 | 304 | "ALTER SUBSCRIPTION tap_sub CONNECTION '$publisher_connstr sslmode=disable'"
|
303 | 305 | );
|
304 | 306 | $node_publisher->poll_query_until('postgres',
|
305 |
| -"SELECT pid !=$oldpid FROM pg_stat_replication WHERE application_name = 'tap_sub';" |
306 |
| -)ordie"Timed out while waiting for apply to restart"; |
| 307 | +"SELECT pid !=$oldpid FROM pg_stat_replication WHERE application_name = 'tap_sub' AND state = 'streaming';" |
| 308 | +)ordie"Timed out while waiting for apply to restart after changing CONNECTION"; |
307 | 309 |
|
308 | 310 | $oldpid =$node_publisher->safe_psql('postgres',
|
309 |
| -"SELECT pid FROM pg_stat_replication WHERE application_name = 'tap_sub';" |
| 311 | +"SELECT pid FROM pg_stat_replication WHERE application_name = 'tap_sub' AND state = 'streaming';" |
310 | 312 | );
|
311 | 313 | $node_subscriber->safe_psql('postgres',
|
312 | 314 | "ALTER SUBSCRIPTION tap_sub SET PUBLICATION tap_pub_ins_only WITH (copy_data = false)"
|
313 | 315 | );
|
314 | 316 | $node_publisher->poll_query_until('postgres',
|
315 |
| -"SELECT pid !=$oldpid FROM pg_stat_replication WHERE application_name = 'tap_sub';" |
316 |
| -)ordie"Timed out while waiting for apply to restart"; |
| 317 | +"SELECT pid !=$oldpid FROM pg_stat_replication WHERE application_name = 'tap_sub' AND state = 'streaming';" |
| 318 | +)ordie"Timed out while waiting for apply to restart after changing PUBLICATION"; |
317 | 319 |
|
318 | 320 | $node_publisher->safe_psql('postgres',
|
319 | 321 | "INSERT INTO tab_ins SELECT generate_series(1001,1100)");
|
|
361 | 363 |
|
362 | 364 | # check restart on rename
|
363 | 365 | $oldpid =$node_publisher->safe_psql('postgres',
|
364 |
| -"SELECT pid FROM pg_stat_replication WHERE application_name = 'tap_sub';" |
| 366 | +"SELECT pid FROM pg_stat_replication WHERE application_name = 'tap_sub' AND state = 'streaming';" |
365 | 367 | );
|
366 | 368 | $node_subscriber->safe_psql('postgres',
|
367 | 369 | "ALTER SUBSCRIPTION tap_sub RENAME TO tap_sub_renamed");
|
368 | 370 | $node_publisher->poll_query_until('postgres',
|
369 |
| -"SELECT pid !=$oldpid FROM pg_stat_replication WHERE application_name = 'tap_sub_renamed';" |
370 |
| -)ordie"Timed out while waiting for apply to restart"; |
| 371 | +"SELECT pid !=$oldpid FROM pg_stat_replication WHERE application_name = 'tap_sub_renamed' AND state = 'streaming';" |
| 372 | +)ordie"Timed out while waiting for apply to restart after renaming SUBSCRIPTION"; |
371 | 373 |
|
372 | 374 | # check all the cleanup
|
373 | 375 | $node_subscriber->safe_psql('postgres',"DROP SUBSCRIPTION tap_sub_renamed");
|
|