diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2022-11-16 12:35:25 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2022-11-16 12:35:25 -0500 |
commit | fccaf259f22f4aedc02033516c561ca86903077d (patch) | |
tree | 74dc395d3c24b0035338f8292c8539a0bc75cdf5 /src | |
parent | 8e1db29cdbbd218ab6ba53eea56624553c3bef8c (diff) | |
download | postgresql-fccaf259f22f4aedc02033516c561ca86903077d.tar.gz postgresql-fccaf259f22f4aedc02033516c561ca86903077d.zip |
Shave some cycles off subscription/t/100_bugs.pl tests.
We can re-use the clusters set up for this test script's first test,
instead of generating new ones. On my machine this is good for
about a 20% reduction in this script's runtime, from ~6.5 sec to
~5.2 sec.
This idea could be taken further, but it'd require a much more invasive
patch. These cases are easy because the Perl variable names were
already being re-used.
Anton A. Melnikov
Discussion: https://postgr.es/m/eb7aa992-c2d7-6ce7-4942-0c784231a362@inbox.ru
Diffstat (limited to 'src')
-rw-r--r-- | src/test/subscription/t/100_bugs.pl | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/src/test/subscription/t/100_bugs.pl b/src/test/subscription/t/100_bugs.pl index 6247aa77301..7b3cd66be57 100644 --- a/src/test/subscription/t/100_bugs.pl +++ b/src/test/subscription/t/100_bugs.pl @@ -69,6 +69,11 @@ $node_publisher->wait_for_catchup('sub1'); pass('index predicates do not cause crash'); +# We'll re-use these nodes below, so drop their replication state. +# We don't bother to drop the tables though. +$node_subscriber->safe_psql('postgres', "DROP SUBSCRIPTION sub1"); +$node_publisher->safe_psql('postgres', "DROP PUBLICATION pub1"); + $node_publisher->stop('fast'); $node_subscriber->stop('fast'); @@ -81,9 +86,12 @@ $node_subscriber->stop('fast'); # identity set before accepting updates. If it did not it would cause # an error when an update was attempted. -$node_publisher = PostgreSQL::Test::Cluster->new('publisher2'); -$node_publisher->init(allows_streaming => 'logical'); -$node_publisher->start; +$node_publisher->rotate_logfile(); +$node_publisher->start(); + +# Although we don't use node_subscriber in this test, keep its logfile +# name in step with node_publisher for later tests. +$node_subscriber->rotate_logfile(); $node_publisher->safe_psql('postgres', "CREATE PUBLICATION pub FOR ALL TABLES"); @@ -102,8 +110,12 @@ is( $node_publisher->psql( 'update to unlogged table without replica identity with FOR ALL TABLES publication' ); +# Again, drop replication state but not tables. +$node_publisher->safe_psql('postgres', "DROP PUBLICATION pub"); + $node_publisher->stop('fast'); + # Bug #16643 - https://postgr.es/m/16643-eaadeb2a1a58d28c@postgresql.org # # Initial sync doesn't complete; the protocol was not being followed per @@ -226,13 +238,12 @@ $node_sub->stop('fast'); # target table's relcache was not being invalidated. This leads to skipping # UPDATE/DELETE operations during apply on the subscriber side as the columns # required to search corresponding rows won't get logged. -$node_publisher = PostgreSQL::Test::Cluster->new('publisher3'); -$node_publisher->init(allows_streaming => 'logical'); -$node_publisher->start; -$node_subscriber = PostgreSQL::Test::Cluster->new('subscriber3'); -$node_subscriber->init(allows_streaming => 'logical'); -$node_subscriber->start; +$node_publisher->rotate_logfile(); +$node_publisher->start(); + +$node_subscriber->rotate_logfile(); +$node_subscriber->start(); $node_publisher->safe_psql('postgres', "CREATE TABLE tab_replidentity_index(a int not null, b int not null)"); |