From: | Noah Misch <noah(at)leadboat(dot)com> |
---|---|
To: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> |
Cc: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Increasing timeout of poll_query_until for TAP tests |
Date: | 2018-01-01 05:52:27 |
Message-ID: | 20180101055227.GA2952815@rfd.leadboat.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, Aug 02, 2016 at 06:21:03PM -0400, Alvaro Herrera wrote:
> Michael Paquier wrote:
> > $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?
> -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;
Since now() is transaction_timestamp(), $recovery_time precedes or equals
$lsn3, and this didn't close the race. Using clock_timestamp() here would
work, as does using separate transactions like recovery-test-fixes.patch did.
I'll shortly push a fix for this and a similar ordering problem in the
standby_5 test, which first appeared subsequent to this thread.
From | Date | Subject | |
---|---|---|---|
Next Message | Beena Emerson | 2018-01-01 06:22:39 | Re: [HACKERS] Runtime Partition Pruning |
Previous Message | Craig Ringer | 2018-01-01 03:43:55 | Re: Contributing with code |