Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eVt1g-0000sI-Ka for pgsql-hackers@arkaria.postgresql.org; Mon, 01 Jan 2018 05:52:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eVt1e-0005em-Ow for pgsql-hackers@arkaria.postgresql.org; Mon, 01 Jan 2018 05:52:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eVt1e-0005ec-A9 for pgsql-hackers@lists.postgresql.org; Mon, 01 Jan 2018 05:52:42 +0000 Received: from mail-pf0-x22f.google.com ([2607:f8b0:400e:c00::22f]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eVt1W-0001Wu-64 for pgsql-hackers@postgresql.org; Mon, 01 Jan 2018 05:52:41 +0000 Received: by mail-pf0-x22f.google.com with SMTP id l24so24393251pfj.6 for ; Sun, 31 Dec 2017 21:52:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=NK81EuV+26xscZY0CQyWAs1eM08Ax9A7gi8KaYbNomo=; b=augcjrEh9fpvFQ4OGrKQt9CfJC4YWYXV6zBOLy4+cqFKrEbH4c3z34Hl20+Z6XJ924 35fvytJL5Xa3YE90DrvURyEqKvk4O651L44kUIG9nWVD2Gnvkh6MbID8hLnhWQWMdlEb D8JP0DQ1DTDBIW7wlssVWBZ6QmhqtBis+Mhek= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=NK81EuV+26xscZY0CQyWAs1eM08Ax9A7gi8KaYbNomo=; b=KXalDx8S9zdWZrUlk6YvmsetKnoZa3KdTuSgMJW81DaQOy3NPsYamlM+FakKpD9bOn LPUVjnDYlI5giehTssY36NnjSdexL7khW4BiPbJeFvsOPxzgDQBEnYYz82BguwymkPmq tdYMC0QmanMuRUoRisUGqbJ4b+VQZK5GoHn69tAjjTNU3afzkP++dyPS3/ZeggGJG/tf Edmsr2mmvJFuNKTCZPDwtmXaIdBQRvMpZjP4U268mSmXPMwy5PAQ7wC6tR2RmRf5CpsI SCeSD/p1XwxYAm+DAIwOtK0qaVKvkm/ATv0qTPveu++KoxfSP73hIIko49KZlizvDFrg pD6w== X-Gm-Message-State: AKGB3mJdwqLF9eQFes5b+FfcAYwJayEPhzaZPsC5DrrsWuaCCLZuEPnj +dzEhz1fY1wMwyMhHNrDNioYlw== X-Google-Smtp-Source: ACJfBouUG313tkdMY7ByUMWbWpBDaaeKX/JuwT67Ap40wqt/t5snsqHSvgsCbFi1tBbehKNv/nIpcw== X-Received: by 10.101.74.66 with SMTP id a2mr10985789pgu.341.1514785951346; Sun, 31 Dec 2017 21:52:31 -0800 (PST) Received: from rfd.leadboat.com (c-73-158-248-138.hsd1.ca.comcast.net. [73.158.248.138]) by smtp.gmail.com with ESMTPSA id f1sm3063570pgo.46.2017.12.31.21.52.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 31 Dec 2017 21:52:29 -0800 (PST) Date: Sun, 31 Dec 2017 21:52:27 -0800 From: Noah Misch To: Alvaro Herrera Cc: Michael Paquier , PostgreSQL mailing lists Subject: Re: Increasing timeout of poll_query_until for TAP tests Message-ID: <20180101055227.GA2952815@rfd.leadboat.com> References: <20160802222103.GA602448@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160802222103.GA602448@alvherre.pgsql> User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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.