mirror of
https://github.com/postgres/postgres.git
synced 2025-06-03 00:02:26 -04:00
002_pg_upgrade.pl: rename some variables for clarity
This renames %node_params to %old_node_params, @initdb_params to @old_initdb_params, and adds separate @new_initdb_params and %new_node_params rather than reusing the former in confusing ways. Extracted from a larger patch from the same author. Author: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com> Discussion: https://postgr.es/m/CAExHW5sDm+aGb7A4EXK=X9rkrmSPDgc03EdADt=wWkdMO=XPSA@mail.gmail.com
This commit is contained in:
parent
ea5d3f5233
commit
abe56227b2
@ -128,7 +128,7 @@ my $oldnode =
|
|||||||
PostgreSQL::Test::Cluster->new('old_node',
|
PostgreSQL::Test::Cluster->new('old_node',
|
||||||
install_path => $ENV{oldinstall});
|
install_path => $ENV{oldinstall});
|
||||||
|
|
||||||
my %node_params = ();
|
my %old_node_params = ();
|
||||||
|
|
||||||
# To increase coverage of non-standard segment size and group access without
|
# To increase coverage of non-standard segment size and group access without
|
||||||
# increasing test runtime, run these tests with a custom setting.
|
# increasing test runtime, run these tests with a custom setting.
|
||||||
@ -194,34 +194,34 @@ else
|
|||||||
my %encodings = ('UTF-8' => 6, 'SQL_ASCII' => 0);
|
my %encodings = ('UTF-8' => 6, 'SQL_ASCII' => 0);
|
||||||
my $original_encoding = $encodings{$original_enc_name};
|
my $original_encoding = $encodings{$original_enc_name};
|
||||||
|
|
||||||
my @initdb_params = @custom_opts;
|
my @old_initdb_params = @custom_opts;
|
||||||
|
|
||||||
push @initdb_params, ('--encoding', $original_enc_name);
|
push @old_initdb_params, ('--encoding', $original_enc_name);
|
||||||
push @initdb_params, ('--lc-collate', $original_datcollate);
|
push @old_initdb_params, ('--lc-collate', $original_datcollate);
|
||||||
push @initdb_params, ('--lc-ctype', $original_datctype);
|
push @old_initdb_params, ('--lc-ctype', $original_datctype);
|
||||||
|
|
||||||
# add --locale-provider, if supported
|
# add --locale-provider, if supported
|
||||||
my %provider_name = ('b' => 'builtin', 'i' => 'icu', 'c' => 'libc');
|
my %provider_name = ('b' => 'builtin', 'i' => 'icu', 'c' => 'libc');
|
||||||
if ($oldnode->pg_version >= 15)
|
if ($oldnode->pg_version >= 15)
|
||||||
{
|
{
|
||||||
push @initdb_params,
|
push @old_initdb_params,
|
||||||
('--locale-provider', $provider_name{$original_provider});
|
('--locale-provider', $provider_name{$original_provider});
|
||||||
if ($original_provider eq 'b')
|
if ($original_provider eq 'b')
|
||||||
{
|
{
|
||||||
push @initdb_params, ('--builtin-locale', $original_datlocale);
|
push @old_initdb_params, ('--builtin-locale', $original_datlocale);
|
||||||
}
|
}
|
||||||
elsif ($original_provider eq 'i')
|
elsif ($original_provider eq 'i')
|
||||||
{
|
{
|
||||||
push @initdb_params, ('--icu-locale', $original_datlocale);
|
push @old_initdb_params, ('--icu-locale', $original_datlocale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Since checksums are now enabled by default, and weren't before 18,
|
# Since checksums are now enabled by default, and weren't before 18,
|
||||||
# pass '-k' to initdb on old versions so that upgrades work.
|
# pass '-k' to initdb on old versions so that upgrades work.
|
||||||
push @initdb_params, '-k' if $oldnode->pg_version < 18;
|
push @old_initdb_params, '-k' if $oldnode->pg_version < 18;
|
||||||
|
|
||||||
$node_params{extra} = \@initdb_params;
|
$old_node_params{extra} = \@old_initdb_params;
|
||||||
$oldnode->init(%node_params);
|
$oldnode->init(%old_node_params);
|
||||||
$oldnode->start;
|
$oldnode->start;
|
||||||
|
|
||||||
my $result;
|
my $result;
|
||||||
@ -322,7 +322,7 @@ SKIP:
|
|||||||
get_dump_for_comparison($oldnode, 'regression', 'src_dump', 1);
|
get_dump_for_comparison($oldnode, 'regression', 'src_dump', 1);
|
||||||
|
|
||||||
# Setup destination database cluster
|
# Setup destination database cluster
|
||||||
$dstnode->init(%node_params);
|
$dstnode->init(%old_node_params);
|
||||||
# Stabilize stats for comparison.
|
# Stabilize stats for comparison.
|
||||||
$dstnode->append_conf('postgresql.conf', 'autovacuum = off');
|
$dstnode->append_conf('postgresql.conf', 'autovacuum = off');
|
||||||
$dstnode->start;
|
$dstnode->start;
|
||||||
@ -358,17 +358,16 @@ SKIP:
|
|||||||
# Initialize a new node for the upgrade.
|
# Initialize a new node for the upgrade.
|
||||||
my $newnode = PostgreSQL::Test::Cluster->new('new_node');
|
my $newnode = PostgreSQL::Test::Cluster->new('new_node');
|
||||||
|
|
||||||
# Reset to original parameters.
|
|
||||||
@initdb_params = @custom_opts;
|
|
||||||
|
|
||||||
# The new cluster will be initialized with different locale settings,
|
# The new cluster will be initialized with different locale settings,
|
||||||
# but these settings will be overwritten with those of the original
|
# but these settings will be overwritten with those of the original
|
||||||
# cluster.
|
# cluster.
|
||||||
push @initdb_params, ('--encoding', 'SQL_ASCII');
|
my %new_node_params = %old_node_params;
|
||||||
push @initdb_params, ('--locale-provider', 'libc');
|
my @new_initdb_params = @custom_opts;
|
||||||
|
push @new_initdb_params, ('--encoding', 'SQL_ASCII');
|
||||||
$node_params{extra} = \@initdb_params;
|
push @new_initdb_params, ('--locale-provider', 'libc');
|
||||||
$newnode->init(%node_params);
|
$new_node_params{extra} = \@new_initdb_params;
|
||||||
|
$newnode->init(%new_node_params);
|
||||||
|
|
||||||
# Stabilize stats for comparison.
|
# Stabilize stats for comparison.
|
||||||
$newnode->append_conf('postgresql.conf', 'autovacuum = off');
|
$newnode->append_conf('postgresql.conf', 'autovacuum = off');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user