Skip to content

Commit 4668d68

Browse files
Amit Kapilapull[bot]
authored andcommitted
Use shorter file names in the upgrade logical slots test.
The longer file names exceeded the Windows path limit on buildfarm animal fairywren. Diagnosed-by: Hou Zhijie Author: Hayato Kuroda Reviewed-by: Bharath Rupireddy Discussion: http://postgr.es/m/OS0PR01MB57160DF709ACD02248DB830C94DDA@OS0PR01MB5716.jpnprd01.prod.outlook.com
1 parent 5c6fa11 commit 4668d68

File tree

2 files changed

+44
-44
lines changed

2 files changed

+44
-44
lines changed

src/bin/pg_upgrade/check.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1554,7 +1554,7 @@ check_old_cluster_for_valid_slots(bool live_check)
15541554

15551555
snprintf(output_path, sizeof(output_path), "%s/%s",
15561556
log_opts.basedir,
1557-
"invalid_logical_replication_slots.txt");
1557+
"invalid_logical_slots.txt");
15581558

15591559
for (int dbnum = 0; dbnum < old_cluster.dbarr.ndbs; dbnum++)
15601560
{

src/bin/pg_upgrade/t/003_upgrade_logical_replication_slots.pl renamed to src/bin/pg_upgrade/t/003_logical_slots.pl

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -15,41 +15,41 @@
1515
my $mode = $ENV{PG_TEST_PG_UPGRADE_MODE} || '--copy';
1616

1717
# Initialize old cluster
18-
my $old_publisher = PostgreSQL::Test::Cluster->new('old_publisher');
19-
$old_publisher->init(allows_streaming => 'logical');
18+
my $oldpub = PostgreSQL::Test::Cluster->new('oldpub');
19+
$oldpub->init(allows_streaming => 'logical');
2020

2121
# Initialize new cluster
22-
my $new_publisher = PostgreSQL::Test::Cluster->new('new_publisher');
23-
$new_publisher->init(allows_streaming => 'logical');
22+
my $newpub = PostgreSQL::Test::Cluster->new('newpub');
23+
$newpub->init(allows_streaming => 'logical');
2424

25-
# Setup a pg_upgrade command. This will be used anywhere.
25+
# Setup a common pg_upgrade command to be used by all the test cases
2626
my @pg_upgrade_cmd = (
2727
'pg_upgrade', '--no-sync',
28-
'-d', $old_publisher->data_dir,
29-
'-D', $new_publisher->data_dir,
30-
'-b', $old_publisher->config_data('--bindir'),
31-
'-B', $new_publisher->config_data('--bindir'),
32-
'-s', $new_publisher->host,
33-
'-p', $old_publisher->port,
34-
'-P', $new_publisher->port,
28+
'-d', $oldpub->data_dir,
29+
'-D', $newpub->data_dir,
30+
'-b', $oldpub->config_data('--bindir'),
31+
'-B', $newpub->config_data('--bindir'),
32+
'-s', $newpub->host,
33+
'-p', $oldpub->port,
34+
'-P', $newpub->port,
3535
$mode);
3636

3737
# ------------------------------
3838
# TEST: Confirm pg_upgrade fails when the new cluster has wrong GUC values
3939

4040
# Preparations for the subsequent test:
4141
# 1. Create two slots on the old cluster
42-
$old_publisher->start;
43-
$old_publisher->safe_psql(
42+
$oldpub->start;
43+
$oldpub->safe_psql(
4444
'postgres', qq[
4545
SELECT pg_create_logical_replication_slot('test_slot1', 'test_decoding');
4646
SELECT pg_create_logical_replication_slot('test_slot2', 'test_decoding');
4747
]);
48-
$old_publisher->stop();
48+
$oldpub->stop();
4949

5050
# 2. Set 'max_replication_slots' to be less than the number of slots (2)
5151
# present on the old cluster.
52-
$new_publisher->append_conf('postgresql.conf', "max_replication_slots = 1");
52+
$newpub->append_conf('postgresql.conf', "max_replication_slots = 1");
5353

5454
# pg_upgrade will fail because the new cluster has insufficient
5555
# max_replication_slots
@@ -62,12 +62,12 @@
6262
[qr//],
6363
'run of pg_upgrade where the new cluster has insufficient max_replication_slots'
6464
);
65-
ok( -d $new_publisher->data_dir . "/pg_upgrade_output.d",
65+
ok( -d $newpub->data_dir . "/pg_upgrade_output.d",
6666
"pg_upgrade_output.d/ not removed after pg_upgrade failure");
6767

6868
# Set 'max_replication_slots' to match the number of slots (2) present on the
6969
# old cluster. Both slots will be used for subsequent tests.
70-
$new_publisher->append_conf('postgresql.conf', "max_replication_slots = 2");
70+
$newpub->append_conf('postgresql.conf', "max_replication_slots = 2");
7171

7272

7373
# ------------------------------
@@ -82,14 +82,14 @@
8282
#
8383
# 3. Emit a non-transactional message. This will cause test_slot2 to detect the
8484
# unconsumed WAL record.
85-
$old_publisher->start;
86-
$old_publisher->safe_psql(
85+
$oldpub->start;
86+
$oldpub->safe_psql(
8787
'postgres', qq[
8888
CREATE TABLE tbl AS SELECT generate_series(1, 10) AS a;
8989
SELECT pg_replication_slot_advance('test_slot2', pg_current_wal_lsn());
9090
SELECT count(*) FROM pg_logical_emit_message('false', 'prefix', 'This is a non-transactional message');
9191
]);
92-
$old_publisher->stop;
92+
$oldpub->stop;
9393

9494
# pg_upgrade will fail because there are slots still having unconsumed WAL
9595
# records
@@ -111,12 +111,12 @@
111111
# contains a milliseconds timestamp. File::Find::find must be used.
112112
find(
113113
sub {
114-
if ($File::Find::name =~ m/invalid_logical_replication_slots\.txt/)
114+
if ($File::Find::name =~ m/invalid_logical_slots\.txt/)
115115
{
116116
$slots_filename = $File::Find::name;
117117
}
118118
},
119-
$new_publisher->data_dir . "/pg_upgrade_output.d");
119+
$newpub->data_dir . "/pg_upgrade_output.d");
120120

121121
# Check the file content. Both slots should be reporting that they have
122122
# unconsumed WAL records.
@@ -135,58 +135,58 @@
135135

136136
# Preparations for the subsequent test:
137137
# 1. Setup logical replication (first, cleanup slots from the previous tests)
138-
my $old_connstr = $old_publisher->connstr . ' dbname=postgres';
138+
my $old_connstr = $oldpub->connstr . ' dbname=postgres';
139139

140-
$old_publisher->start;
141-
$old_publisher->safe_psql(
140+
$oldpub->start;
141+
$oldpub->safe_psql(
142142
'postgres', qq[
143143
SELECT * FROM pg_drop_replication_slot('test_slot1');
144144
SELECT * FROM pg_drop_replication_slot('test_slot2');
145145
CREATE PUBLICATION regress_pub FOR ALL TABLES;
146146
]);
147147

148148
# Initialize subscriber cluster
149-
my $subscriber = PostgreSQL::Test::Cluster->new('subscriber');
150-
$subscriber->init();
149+
my $sub = PostgreSQL::Test::Cluster->new('sub');
150+
$sub->init();
151151

152-
$subscriber->start;
153-
$subscriber->safe_psql(
152+
$sub->start;
153+
$sub->safe_psql(
154154
'postgres', qq[
155155
CREATE TABLE tbl (a int);
156156
CREATE SUBSCRIPTION regress_sub CONNECTION '$old_connstr' PUBLICATION regress_pub WITH (two_phase = 'true')
157157
]);
158-
$subscriber->wait_for_subscription_sync($old_publisher, 'regress_sub');
158+
$sub->wait_for_subscription_sync($oldpub, 'regress_sub');
159159

160160
# 2. Temporarily disable the subscription
161-
$subscriber->safe_psql('postgres', "ALTER SUBSCRIPTION regress_sub DISABLE");
162-
$old_publisher->stop;
161+
$sub->safe_psql('postgres', "ALTER SUBSCRIPTION regress_sub DISABLE");
162+
$oldpub->stop;
163163

164164
# pg_upgrade should be successful
165165
command_ok([@pg_upgrade_cmd], 'run of pg_upgrade of old cluster');
166166

167167
# Check that the slot 'regress_sub' has migrated to the new cluster
168-
$new_publisher->start;
169-
my $result = $new_publisher->safe_psql('postgres',
168+
$newpub->start;
169+
my $result = $newpub->safe_psql('postgres',
170170
"SELECT slot_name, two_phase FROM pg_replication_slots");
171171
is($result, qq(regress_sub|t), 'check the slot exists on new cluster');
172172

173173
# Update the connection
174-
my $new_connstr = $new_publisher->connstr . ' dbname=postgres';
175-
$subscriber->safe_psql(
174+
my $new_connstr = $newpub->connstr . ' dbname=postgres';
175+
$sub->safe_psql(
176176
'postgres', qq[
177177
ALTER SUBSCRIPTION regress_sub CONNECTION '$new_connstr';
178178
ALTER SUBSCRIPTION regress_sub ENABLE;
179179
]);
180180

181181
# Check whether changes on the new publisher get replicated to the subscriber
182-
$new_publisher->safe_psql('postgres',
182+
$newpub->safe_psql('postgres',
183183
"INSERT INTO tbl VALUES (generate_series(11, 20))");
184-
$new_publisher->wait_for_catchup('regress_sub');
185-
$result = $subscriber->safe_psql('postgres', "SELECT count(*) FROM tbl");
186-
is($result, qq(20), 'check changes are replicated to the subscriber');
184+
$newpub->wait_for_catchup('regress_sub');
185+
$result = $sub->safe_psql('postgres', "SELECT count(*) FROM tbl");
186+
is($result, qq(20), 'check changes are replicated to the sub');
187187

188188
# Clean up
189-
$subscriber->stop();
190-
$new_publisher->stop();
189+
$sub->stop();
190+
$newpub->stop();
191191

192192
done_testing();

0 commit comments

Comments
 (0)