Skip to content

Commit fccaf25

Browse files
committed
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
1 parent 8e1db29 commit fccaf25

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

src/test/subscription/t/100_bugs.pl

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@
6969

7070
pass('index predicates do not cause crash');
7171

72+
# We'll re-use these nodes below, so drop their replication state.
73+
# We don't bother to drop the tables though.
74+
$node_subscriber->safe_psql('postgres', "DROP SUBSCRIPTION sub1");
75+
$node_publisher->safe_psql('postgres', "DROP PUBLICATION pub1");
76+
7277
$node_publisher->stop('fast');
7378
$node_subscriber->stop('fast');
7479

@@ -81,9 +86,12 @@
8186
# identity set before accepting updates. If it did not it would cause
8287
# an error when an update was attempted.
8388

84-
$node_publisher = PostgreSQL::Test::Cluster->new('publisher2');
85-
$node_publisher->init(allows_streaming => 'logical');
86-
$node_publisher->start;
89+
$node_publisher->rotate_logfile();
90+
$node_publisher->start();
91+
92+
# Although we don't use node_subscriber in this test, keep its logfile
93+
# name in step with node_publisher for later tests.
94+
$node_subscriber->rotate_logfile();
8795

8896
$node_publisher->safe_psql('postgres',
8997
"CREATE PUBLICATION pub FOR ALL TABLES");
@@ -102,8 +110,12 @@
102110
'update to unlogged table without replica identity with FOR ALL TABLES publication'
103111
);
104112

113+
# Again, drop replication state but not tables.
114+
$node_publisher->safe_psql('postgres', "DROP PUBLICATION pub");
115+
105116
$node_publisher->stop('fast');
106117

118+
107119
# Bug #16643 - https://postgr.es/m/16643-eaadeb2a1a58d28c@postgresql.org
108120
#
109121
# Initial sync doesn't complete; the protocol was not being followed per
@@ -226,13 +238,12 @@
226238
# target table's relcache was not being invalidated. This leads to skipping
227239
# UPDATE/DELETE operations during apply on the subscriber side as the columns
228240
# required to search corresponding rows won't get logged.
229-
$node_publisher = PostgreSQL::Test::Cluster->new('publisher3');
230-
$node_publisher->init(allows_streaming => 'logical');
231-
$node_publisher->start;
232241

233-
$node_subscriber = PostgreSQL::Test::Cluster->new('subscriber3');
234-
$node_subscriber->init(allows_streaming => 'logical');
235-
$node_subscriber->start;
242+
$node_publisher->rotate_logfile();
243+
$node_publisher->start();
244+
245+
$node_subscriber->rotate_logfile();
246+
$node_subscriber->start();
236247

237248
$node_publisher->safe_psql('postgres',
238249
"CREATE TABLE tab_replidentity_index(a int not null, b int not null)");

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy