mirror of
https://github.com/postgres/postgres.git
synced 2025-08-05 07:41:25 +03:00
Allow TAP tests to force checksums off when calling init()
TAP tests can write $node->init(no_data_checksums => 1); to initialize a cluster explicitly without checksums. Currently, this is the default, but this change allows running all tests with checksums enabled, like PG_TEST_INITDB_EXTRA_OPTS=--data-checksums meson test ... And this also prepares the tests for when we switch the default to checksums enabled. The pg_checksums tests need to disable checksums so it can test its own functionality of enabling checksums. The amcheck/pg_amcheck tests need to disable checksums because they manually introduce corruption that they want to detect, but with checksums enabled, the checksum verification will fail before they even get to their work. Author: Greg Sabino Mullane <greg@turnstep.com> Reviewed-by: Nathan Bossart <nathandbossart@gmail.com> Reviewed-by: Peter Eisentraut <peter@eisentraut.org> Discussion: https://www.postgresql.org/message-id/flat/CAKAnmmKwiMHik5AHmBEdf5vqzbOBbcwEPHo4-PioWeAbzwcTOQ@mail.gmail.com
This commit is contained in:
@@ -15,7 +15,7 @@ my $node;
|
|||||||
# Test set-up
|
# Test set-up
|
||||||
#
|
#
|
||||||
$node = PostgreSQL::Test::Cluster->new('test');
|
$node = PostgreSQL::Test::Cluster->new('test');
|
||||||
$node->init;
|
$node->init(no_data_checksums => 1);
|
||||||
$node->append_conf('postgresql.conf', 'autovacuum=off');
|
$node->append_conf('postgresql.conf', 'autovacuum=off');
|
||||||
$node->start;
|
$node->start;
|
||||||
$node->safe_psql('postgres', q(CREATE EXTENSION amcheck));
|
$node->safe_psql('postgres', q(CREATE EXTENSION amcheck));
|
||||||
|
@@ -120,7 +120,7 @@ sub perform_all_corruptions()
|
|||||||
|
|
||||||
# Test set-up
|
# Test set-up
|
||||||
$node = PostgreSQL::Test::Cluster->new('test');
|
$node = PostgreSQL::Test::Cluster->new('test');
|
||||||
$node->init;
|
$node->init(no_data_checksums => 1);
|
||||||
$node->append_conf('postgresql.conf', 'autovacuum=off');
|
$node->append_conf('postgresql.conf', 'autovacuum=off');
|
||||||
$node->start;
|
$node->start;
|
||||||
$port = $node->port;
|
$port = $node->port;
|
||||||
|
@@ -181,7 +181,7 @@ my $aborted_xid;
|
|||||||
# autovacuum workers visiting the table could crash the backend.
|
# autovacuum workers visiting the table could crash the backend.
|
||||||
# Disable autovacuum so that won't happen.
|
# Disable autovacuum so that won't happen.
|
||||||
my $node = PostgreSQL::Test::Cluster->new('test');
|
my $node = PostgreSQL::Test::Cluster->new('test');
|
||||||
$node->init;
|
$node->init(no_data_checksums => 1);
|
||||||
$node->append_conf('postgresql.conf', 'autovacuum=off');
|
$node->append_conf('postgresql.conf', 'autovacuum=off');
|
||||||
$node->append_conf('postgresql.conf', 'max_prepared_transactions=10');
|
$node->append_conf('postgresql.conf', 'max_prepared_transactions=10');
|
||||||
|
|
||||||
|
@@ -88,7 +88,7 @@ sub check_relation_corruption
|
|||||||
|
|
||||||
# Initialize node with checksums disabled.
|
# Initialize node with checksums disabled.
|
||||||
my $node = PostgreSQL::Test::Cluster->new('node_checksum');
|
my $node = PostgreSQL::Test::Cluster->new('node_checksum');
|
||||||
$node->init();
|
$node->init(no_data_checksums => 1);
|
||||||
my $pgdata = $node->data_dir;
|
my $pgdata = $node->data_dir;
|
||||||
|
|
||||||
# Control file should know that checksums are disabled.
|
# Control file should know that checksums are disabled.
|
||||||
|
@@ -586,6 +586,8 @@ On Windows, we use SSPI authentication to ensure the same (by pg_regress
|
|||||||
WAL archiving can be enabled on this node by passing the keyword parameter
|
WAL archiving can be enabled on this node by passing the keyword parameter
|
||||||
has_archiving => 1. This is disabled by default.
|
has_archiving => 1. This is disabled by default.
|
||||||
|
|
||||||
|
Data checksums can be forced off by passing no_data_checksums => 1.
|
||||||
|
|
||||||
postgresql.conf can be set up for replication by passing the keyword
|
postgresql.conf can be set up for replication by passing the keyword
|
||||||
parameter allows_streaming => 'logical' or 'physical' (passing 1 will also
|
parameter allows_streaming => 'logical' or 'physical' (passing 1 will also
|
||||||
suffice for physical replication) depending on type of replication that
|
suffice for physical replication) depending on type of replication that
|
||||||
@@ -618,6 +620,12 @@ sub init
|
|||||||
push @{ $params{extra} }, shellwords($initdb_extra_opts_env);
|
push @{ $params{extra} }, shellwords($initdb_extra_opts_env);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# This should override user-supplied initdb options.
|
||||||
|
if ($params{no_data_checksums})
|
||||||
|
{
|
||||||
|
push @{ $params{extra} }, '--no-data-checksums';
|
||||||
|
}
|
||||||
|
|
||||||
mkdir $self->backup_dir;
|
mkdir $self->backup_dir;
|
||||||
mkdir $self->archive_dir;
|
mkdir $self->archive_dir;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user