Skip to content

Commit 0ebd242

Browse files
committed
Run pgperltidy
This is required before the creation of a new branch. pgindent is clean, as well as is reformat-dat-files. perltidy version is v20230309, as documented in pgindent's README.
1 parent 66e9df9 commit 0ebd242

File tree

24 files changed

+369
-297
lines changed

24 files changed

+369
-297
lines changed

contrib/amcheck/t/006_verify_gin.pl

Lines changed: 37 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -54,20 +54,17 @@ sub invalid_entry_order_leaf_page_test
5454

5555
$node->stop;
5656

57-
my $blkno = 1; # root
57+
my $blkno = 1; # root
5858

5959
# produce wrong order by replacing aaaaa with ccccc
60-
string_replace_block(
61-
$relpath,
62-
'aaaaa',
63-
'ccccc',
64-
$blkno
65-
);
60+
string_replace_block($relpath, 'aaaaa', 'ccccc', $blkno);
6661

6762
$node->start;
6863

69-
my ($result, $stdout, $stderr) = $node->psql('postgres', qq(SELECT gin_index_check('$indexname')));
70-
my $expected = "index \"$indexname\" has wrong tuple order on entry tree page, block 1, offset 2, rightlink 4294967295";
64+
my ($result, $stdout, $stderr) =
65+
$node->psql('postgres', qq(SELECT gin_index_check('$indexname')));
66+
my $expected =
67+
"index \"$indexname\" has wrong tuple order on entry tree page, block 1, offset 2, rightlink 4294967295";
7168
like($stderr, qr/$expected/);
7269
}
7370

@@ -96,20 +93,17 @@ sub invalid_entry_order_inner_page_test
9693

9794
$node->stop;
9895

99-
my $blkno = 1; # root
96+
my $blkno = 1; # root
10097

10198
# we have rrrrrrrrr... and tttttttttt... as keys in the root, so produce wrong order by replacing rrrrrrrrrr....
102-
string_replace_block(
103-
$relpath,
104-
'rrrrrrrrrr',
105-
'zzzzzzzzzz',
106-
$blkno
107-
);
99+
string_replace_block($relpath, 'rrrrrrrrrr', 'zzzzzzzzzz', $blkno);
108100

109101
$node->start;
110102

111-
my ($result, $stdout, $stderr) = $node->psql('postgres', qq(SELECT gin_index_check('$indexname')));
112-
my $expected = "index \"$indexname\" has wrong tuple order on entry tree page, block 1, offset 2, rightlink 4294967295";
103+
my ($result, $stdout, $stderr) =
104+
$node->psql('postgres', qq(SELECT gin_index_check('$indexname')));
105+
my $expected =
106+
"index \"$indexname\" has wrong tuple order on entry tree page, block 1, offset 2, rightlink 4294967295";
113107
like($stderr, qr/$expected/);
114108
}
115109

@@ -129,7 +123,7 @@ sub invalid_entry_columns_order_test
129123

130124
$node->stop;
131125

132-
my $blkno = 1; # root
126+
my $blkno = 1; # root
133127

134128
# mess column numbers
135129
# root items order before: (1,aaa), (2,bbb)
@@ -139,26 +133,18 @@ sub invalid_entry_columns_order_test
139133

140134
my $find = qr/($attrno_1)(.)(aaa)/s;
141135
my $replace = $attrno_2 . '$2$3';
142-
string_replace_block(
143-
$relpath,
144-
$find,
145-
$replace,
146-
$blkno
147-
);
136+
string_replace_block($relpath, $find, $replace, $blkno);
148137

149138
$find = qr/($attrno_2)(.)(bbb)/s;
150139
$replace = $attrno_1 . '$2$3';
151-
string_replace_block(
152-
$relpath,
153-
$find,
154-
$replace,
155-
$blkno
156-
);
140+
string_replace_block($relpath, $find, $replace, $blkno);
157141

158142
$node->start;
159143

160-
my ($result, $stdout, $stderr) = $node->psql('postgres', qq(SELECT gin_index_check('$indexname')));
161-
my $expected = "index \"$indexname\" has wrong tuple order on entry tree page, block 1, offset 2, rightlink 4294967295";
144+
my ($result, $stdout, $stderr) =
145+
$node->psql('postgres', qq(SELECT gin_index_check('$indexname')));
146+
my $expected =
147+
"index \"$indexname\" has wrong tuple order on entry tree page, block 1, offset 2, rightlink 4294967295";
162148
like($stderr, qr/$expected/);
163149
}
164150

@@ -183,20 +169,17 @@ sub inconsistent_with_parent_key__parent_key_corrupted_test
183169

184170
$node->stop;
185171

186-
my $blkno = 1; # root
172+
my $blkno = 1; # root
187173

188174
# we have nnnnnnnnnn... as parent key in the root, so replace it with something smaller then child's keys
189-
string_replace_block(
190-
$relpath,
191-
'nnnnnnnnnn',
192-
'aaaaaaaaaa',
193-
$blkno
194-
);
175+
string_replace_block($relpath, 'nnnnnnnnnn', 'aaaaaaaaaa', $blkno);
195176

196177
$node->start;
197178

198-
my ($result, $stdout, $stderr) = $node->psql('postgres', qq(SELECT gin_index_check('$indexname')));
199-
my $expected = "index \"$indexname\" has inconsistent records on page 3 offset 3";
179+
my ($result, $stdout, $stderr) =
180+
$node->psql('postgres', qq(SELECT gin_index_check('$indexname')));
181+
my $expected =
182+
"index \"$indexname\" has inconsistent records on page 3 offset 3";
200183
like($stderr, qr/$expected/);
201184
}
202185

@@ -221,20 +204,17 @@ sub inconsistent_with_parent_key__child_key_corrupted_test
221204

222205
$node->stop;
223206

224-
my $blkno = 3; # leaf
207+
my $blkno = 3; # leaf
225208

226209
# we have nnnnnnnnnn... as parent key in the root, so replace child key with something bigger
227-
string_replace_block(
228-
$relpath,
229-
'nnnnnnnnnn',
230-
'pppppppppp',
231-
$blkno
232-
);
210+
string_replace_block($relpath, 'nnnnnnnnnn', 'pppppppppp', $blkno);
233211

234212
$node->start;
235213

236-
my ($result, $stdout, $stderr) = $node->psql('postgres', qq(SELECT gin_index_check('$indexname')));
237-
my $expected = "index \"$indexname\" has inconsistent records on page 3 offset 3";
214+
my ($result, $stdout, $stderr) =
215+
$node->psql('postgres', qq(SELECT gin_index_check('$indexname')));
216+
my $expected =
217+
"index \"$indexname\" has inconsistent records on page 3 offset 3";
238218
like($stderr, qr/$expected/);
239219
}
240220

@@ -254,24 +234,21 @@ sub inconsistent_with_parent_key__parent_key_corrupted_posting_tree_test
254234

255235
$node->stop;
256236

257-
my $blkno = 2; # posting tree root
237+
my $blkno = 2; # posting tree root
258238

259239
# we have a posting tree for 'aaaaa' key with the root at 2nd block
260240
# and two leaf pages 3 and 4. replace 4th page's high key with (1,1)
261241
# so that there are tid's in leaf page that are larger then the new high key.
262242
my $find = pack('S*', 0, 4, 0) . '....';
263243
my $replace = pack('S*', 0, 4, 0, 1, 1);
264-
string_replace_block(
265-
$relpath,
266-
$find,
267-
$replace,
268-
$blkno
269-
);
244+
string_replace_block($relpath, $find, $replace, $blkno);
270245

271246
$node->start;
272247

273-
my ($result, $stdout, $stderr) = $node->psql('postgres', qq(SELECT gin_index_check('$indexname')));
274-
my $expected = "index \"$indexname\": tid exceeds parent's high key in postingTree leaf on block 4";
248+
my ($result, $stdout, $stderr) =
249+
$node->psql('postgres', qq(SELECT gin_index_check('$indexname')));
250+
my $expected =
251+
"index \"$indexname\": tid exceeds parent's high key in postingTree leaf on block 4";
275252
like($stderr, qr/$expected/);
276253
}
277254

src/bin/initdb/t/001_initdb.pl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@
7676
'checksums are enabled in control file');
7777

7878
command_ok([ 'initdb', '--sync-only', $datadir ], 'sync only');
79-
command_ok([ 'initdb', '--sync-only', '--no-sync-data-files', $datadir ], '--no-sync-data-files');
79+
command_ok([ 'initdb', '--sync-only', '--no-sync-data-files', $datadir ],
80+
'--no-sync-data-files');
8081
command_fails([ 'initdb', $datadir ], 'existing data directory');
8182

8283
if ($supports_syncfs)

src/bin/pg_basebackup/t/030_pg_recvlogical.pl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@
147147
'slot with failover created');
148148

149149
my $result = $node->safe_psql('postgres',
150-
"SELECT failover FROM pg_catalog.pg_replication_slots WHERE slot_name = 'test'");
150+
"SELECT failover FROM pg_catalog.pg_replication_slots WHERE slot_name = 'test'"
151+
);
151152
is($result, 't', "failover is enabled for the new slot");
152153

153154
done_testing();

src/bin/pg_combinebackup/t/010_hardlink.pl

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
'--pgdata' => $backup1path,
5757
'--no-sync',
5858
'--checkpoint' => 'fast',
59-
'--wal-method' => 'none'
59+
'--wal-method' => 'none'
6060
],
6161
"full backup");
6262

@@ -74,7 +74,7 @@
7474
'--pgdata' => $backup2path,
7575
'--no-sync',
7676
'--checkpoint' => 'fast',
77-
'--wal-method' => 'none',
77+
'--wal-method' => 'none',
7878
'--incremental' => $backup1path . '/backup_manifest'
7979
],
8080
"incremental backup");
@@ -112,45 +112,45 @@
112112
# of the given data file.
113113
sub check_data_file
114114
{
115-
my ($data_file, $last_segment_nlinks) = @_;
116-
117-
my @data_file_segments = ($data_file);
118-
119-
# Start checking for additional segments
120-
my $segment_number = 1;
121-
122-
while (1)
123-
{
124-
my $next_segment = $data_file . '.' . $segment_number;
125-
126-
# If the file exists and is a regular file, add it to the list
127-
if (-f $next_segment)
128-
{
129-
push @data_file_segments, $next_segment;
130-
$segment_number++;
131-
}
132-
# Stop the loop if the file doesn't exist
133-
else
134-
{
135-
last;
136-
}
137-
}
138-
139-
# All segments of the given data file should contain 2 hard links, except
140-
# for the last one, which should match the given number of links.
141-
my $last_segment = pop @data_file_segments;
142-
143-
for my $segment (@data_file_segments)
144-
{
145-
# Get the file's stat information of each segment
146-
my $nlink_count = get_hard_link_count($segment);
147-
ok($nlink_count == 2, "File '$segment' has 2 hard links");
148-
}
149-
150-
# Get the file's stat information of the last segment
151-
my $nlink_count = get_hard_link_count($last_segment);
152-
ok($nlink_count == $last_segment_nlinks,
153-
"File '$last_segment' has $last_segment_nlinks hard link(s)");
115+
my ($data_file, $last_segment_nlinks) = @_;
116+
117+
my @data_file_segments = ($data_file);
118+
119+
# Start checking for additional segments
120+
my $segment_number = 1;
121+
122+
while (1)
123+
{
124+
my $next_segment = $data_file . '.' . $segment_number;
125+
126+
# If the file exists and is a regular file, add it to the list
127+
if (-f $next_segment)
128+
{
129+
push @data_file_segments, $next_segment;
130+
$segment_number++;
131+
}
132+
# Stop the loop if the file doesn't exist
133+
else
134+
{
135+
last;
136+
}
137+
}
138+
139+
# All segments of the given data file should contain 2 hard links, except
140+
# for the last one, which should match the given number of links.
141+
my $last_segment = pop @data_file_segments;
142+
143+
for my $segment (@data_file_segments)
144+
{
145+
# Get the file's stat information of each segment
146+
my $nlink_count = get_hard_link_count($segment);
147+
ok($nlink_count == 2, "File '$segment' has 2 hard links");
148+
}
149+
150+
# Get the file's stat information of the last segment
151+
my $nlink_count = get_hard_link_count($last_segment);
152+
ok($nlink_count == $last_segment_nlinks,
153+
"File '$last_segment' has $last_segment_nlinks hard link(s)");
154154
}
155155

156156

@@ -159,11 +159,11 @@ sub check_data_file
159159
# that file.
160160
sub get_hard_link_count
161161
{
162-
my ($file) = @_;
162+
my ($file) = @_;
163163

164-
# Get file stats
165-
my @stats = stat($file);
166-
my $nlink = $stats[3]; # Number of hard links
164+
# Get file stats
165+
my @stats = stat($file);
166+
my $nlink = $stats[3]; # Number of hard links
167167

168-
return $nlink;
168+
return $nlink;
169169
}

src/bin/pg_dump/t/001_basic.pl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,17 +240,20 @@
240240
command_fails_like(
241241
[ 'pg_restore', '--exclude-database=foo', '--globals-only', '-d', 'xxx' ],
242242
qr/\Qpg_restore: error: option --exclude-database cannot be used together with -g\/--globals-only\E/,
243-
'pg_restore: option --exclude-database cannot be used together with -g/--globals-only');
243+
'pg_restore: option --exclude-database cannot be used together with -g/--globals-only'
244+
);
244245

245246
command_fails_like(
246247
[ 'pg_restore', '--exclude-database=foo', '-d', 'xxx', 'dumpdir' ],
247248
qr/\Qpg_restore: error: option --exclude-database can be used only when restoring an archive created by pg_dumpall\E/,
248-
'When option --exclude-database is used in pg_restore with dump of pg_dump');
249+
'When option --exclude-database is used in pg_restore with dump of pg_dump'
250+
);
249251

250252
command_fails_like(
251253
[ 'pg_restore', '--globals-only', '-d', 'xxx', 'dumpdir' ],
252254
qr/\Qpg_restore: error: option -g\/--globals-only can be used only when restoring an archive created by pg_dumpall\E/,
253-
'When option --globals-only is not used in pg_restore with dump of pg_dump');
255+
'When option --globals-only is not used in pg_restore with dump of pg_dump'
256+
);
254257

255258
# also fails for -r and -t, but it seems pointless to add more tests for those.
256259
command_fails_like(

src/bin/pg_dump/t/002_pg_dump.pl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@
368368
'--data-only',
369369
'--superuser' => 'test_superuser',
370370
'--disable-triggers',
371-
'--verbose', # no-op, just make sure it works
371+
'--verbose', # no-op, just make sure it works
372372
'postgres',
373373
],
374374
},
@@ -810,8 +810,7 @@
810810
dump_cmd => [
811811
'pg_dump', '--no-sync',
812812
"--file=$tempdir/no_schema.sql", '--no-schema',
813-
'--with-statistics',
814-
'postgres',
813+
'--with-statistics', 'postgres',
815814
],
816815
},);
817816

0 commit comments

Comments
 (0)