mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Fix walsender error cleanup code
In commit 850196b610
I (Álvaro) failed to handle the case of walsender
shutting down on an error before setting up its 'xlogreader' pointer;
the error handling code dereferences the pointer, causing a crash.
Fix by testing the pointer before trying to dereference it.
Kyotaro authored the code fix; I adopted Nathan's test case to be used
by the TAP tests and added the necessary PostgresNode change.
Reported-by: Nathan Bossart <bossartn@amazon.com>
Author: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
Discussion: https://postgr.es/m/C04FC24E-903D-4423-B312-6910E4D846E5@amazon.com
This commit is contained in:
@ -1386,6 +1386,12 @@ the B<timed_out> parameter is also given.
|
||||
If B<timeout> is set and this parameter is given, the scalar it references
|
||||
is set to true if the psql call times out.
|
||||
|
||||
=item replication => B<value>
|
||||
|
||||
If set, add B<replication=value> to the conninfo string.
|
||||
Passing the literal value C<database> results in a logical replication
|
||||
connection.
|
||||
|
||||
=item extra_params => ['--single-transaction']
|
||||
|
||||
If given, it must be an array reference containing additional parameters to B<psql>.
|
||||
@ -1414,10 +1420,17 @@ sub psql
|
||||
|
||||
my $stdout = $params{stdout};
|
||||
my $stderr = $params{stderr};
|
||||
my $replication = $params{replication};
|
||||
my $timeout = undef;
|
||||
my $timeout_exception = 'psql timed out';
|
||||
my @psql_params =
|
||||
('psql', '-XAtq', '-d', $self->connstr($dbname), '-f', '-');
|
||||
my @psql_params = (
|
||||
'psql',
|
||||
'-XAtq',
|
||||
'-d',
|
||||
$self->connstr($dbname)
|
||||
. (defined $replication ? " replication=$replication" : ""),
|
||||
'-f',
|
||||
'-');
|
||||
|
||||
# If the caller wants an array and hasn't passed stdout/stderr
|
||||
# references, allocate temporary ones to capture them so we
|
||||
|
Reference in New Issue
Block a user