From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Michael Paquier <michael.paquier@gmail.com>
Cc: PostgreSQL mailing lists <pgsql-hackers@postgresql.org>
Subject: Re: Increasing timeout of poll_query_until for TAP tests
Date: Tue, 2 Aug 2016 18:21:03 -0400
Message-ID: <20160802222103.GA602448@alvherre.pgsql> (raw)
In-Reply-To: <CAB7nPqSeW9nbBaUYMARF6COWCsfU6tJZC9mac8K8zRN5DrUCbA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
Michael Paquier wrote:
> Here using pg_xlog_replay_resume() is not the correct solution because
> this would cause the node to finish recovery before we want it to, and
> so is recovery_target_action = 'promote'. If we look at the test, it
> is doing the following when getting the TXID that is used as recovery
> target:
> $node_master->safe_psql('postgres',
> "INSERT INTO tab_int VALUES (generate_series(1001,2000))");
> my $recovery_txid =
> $node_master->safe_psql('postgres', "SELECT txid_current()");
> my $lsn2 =
> $node_master->safe_psql('postgres', "SELECT pg_current_xlog_location();");
> What I think we had better do is reverse the calls
> pg_current_xlog_location() and txid_current() so as we are sure that
> the LSN we track for replay is lower than the real target LSN. The
> same problem exists when defining the timestamp target.
>
> The patch attached does that,
Why not capture both items in a single select, such as in the attached
patch?
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackersAttachments:recovery-test-fixes-2.patch (text/x-diff, 1.2K) downloaddiff --git a/src/test/recovery/t/003_recovery_targets.pl b/src/test/recovery/t/003_recovery_targets.plindex 20b878e..3864e60 100644--- a/src/test/recovery/t/003_recovery_targets.pl+++ b/src/test/recovery/t/003_recovery_targets.pl@@ -66,17 +66,16 @@ $node_master->backup('my_backup');
# target TXID.
$node_master->safe_psql('postgres',
"INSERT INTO tab_int VALUES (generate_series(1001,2000))");
-my $recovery_txid =- $node_master->safe_psql('postgres', "SELECT txid_current()");-my $lsn2 =- $node_master->safe_psql('postgres', "SELECT pg_current_xlog_location();");+my $ret =+ $node_master->safe_psql('postgres', "SELECT pg_current_xlog_location(), txid_current();");+my ($lsn2, $recovery_txid) = split /\|/, $ret;
# More data, with recovery target timestamp
$node_master->safe_psql('postgres',
"INSERT INTO tab_int VALUES (generate_series(2001,3000))");
-my $recovery_time = $node_master->safe_psql('postgres', "SELECT now()");-my $lsn3 =- $node_master->safe_psql('postgres', "SELECT pg_current_xlog_location();");+$ret =+ $node_master->safe_psql('postgres', "SELECT pg_current_xlog_location(), now();");+my ($lsn3, $recovery_time) = split /\|/, $ret;
# Even more data, this time with a recovery target name
$node_master->safe_psql('postgres',
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: alvherre@2ndquadrant.com, michael.paquier@gmail.com
Subject: Re: Increasing timeout of poll_query_until for TAP tests
In-Reply-To: <20160802222103.GA602448@alvherre.pgsql>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox