Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit87d90ac

Browse files
committed
Improve pg_amcheck's TAP test 003_check.pl.
Disable autovacuum, because we don't want it to run againstintentionally corrupted tables. Also, before corrupting the tables,run pg_amcheck and ensure that it passes. Otherwise, if somethingunexpected happens when we check the corrupted tables, it's not soclear whether it would have also happened before we corruptedthem.Mark DilgerDiscussion:http://postgr.es/m/AA5506CE-7D2A-42E4-A51D-358635E3722D@enterprisedb.com
1 parentea80138 commit87d90ac

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

‎src/bin/pg_amcheck/t/003_check.pl

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
use PostgresNode;
55
use TestLib;
6-
use Test::Moretests=>60;
6+
use Test::Moretests=>63;
77

88
my ($node,$port,%corrupt_page,%remove_relation);
99

@@ -117,6 +117,7 @@ ()
117117
# Test set-up
118118
$node = get_new_node('test');
119119
$node->init;
120+
$node->append_conf('postgresql.conf','autovacuum=off');
120121
$node->start;
121122
$port =$node->port;
122123

@@ -308,11 +309,6 @@ ()
308309
# Leave 'db3' uncorrupted
309310
#
310311

311-
# Perform the corruptions we planned above using only a single database restart.
312-
#
313-
perform_all_corruptions();
314-
315-
316312
# Standard first arguments to TestLib functions
317313
my@cmd = ('pg_amcheck','--quiet','-p',$port);
318314

@@ -322,6 +318,22 @@ ()
322318
my$missing_file_re =qr/could not open file ".*": No such file or directory/;
323319
my$index_missing_relation_fork_re =qr/index ".*" lacks a main relation fork/;
324320

321+
# We have created test databases with tables populated with data, but have not
322+
# yet corrupted anything. As such, we expect no corruption and verify that
323+
# none is reported
324+
#
325+
$node->command_checks_all(
326+
[@cmd,'-d','db1','-d','db2','-d','db3' ],
327+
0,
328+
[$no_output_re ],
329+
[$no_output_re ],
330+
'pg_amcheck prior to corruption');
331+
332+
# Perform the corruptions we planned above using only a single database restart.
333+
#
334+
perform_all_corruptions();
335+
336+
325337
# Checking databases with amcheck installed and corrupt relations, pg_amcheck
326338
# command itself should return exit status = 2, because tables and indexes are
327339
# corrupt, not exit status = 1, which would mean the pg_amcheck command itself

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp