Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n7Aau-00061g-6m for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Jan 2022 06:25:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n7Aar-0000LS-Rc for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Jan 2022 06:25:17 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n7Aar-0000L5-Fu for pgsql-hackers@lists.postgresql.org; Tue, 11 Jan 2022 06:25:17 +0000 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1n7Aak-0008I4-Vz for pgsql-hackers@lists.postgresql.org; Tue, 11 Jan 2022 06:25:15 +0000 Received: by mail-pl1-x62f.google.com with SMTP id x15so15633723plg.1 for ; Mon, 10 Jan 2022 22:25:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=NSRlG5YSbiI74HR2dNZGTKVw1fbwh9JUo/NLg1cMnfs=; b=LLnTA6c6YJr6OtMa099A5Xctoy5CO4P1DOwQwMeJOUoWILgwIBHLjbwf/xb0mChv7K jaa1CHn0Hrs6iBSJIjxdzFG9uv9nE2H1Rp/kn8hqoklrwUy65Aw9N5MY4x1MQNDNO8Ce fqpeHAj734ydD65cWyH7zX3p8I1DQpq/42dca2S7wrODMhStOKVkVGGlTwhD9U3IpU0/ ah1vbJwS27408VEv7cVDS8hXwQEfYm4t+2NYWjFCq2+/Jrv4LWs1I62wzbmzYw4iw+di PaJ5Jkgu/Rm6Nx79rdB/JTvRtQlYJ1mWh9KqOEj4HV52Sy/LuaN/SWhiMPmnsgjMF7d9 Ngbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=NSRlG5YSbiI74HR2dNZGTKVw1fbwh9JUo/NLg1cMnfs=; b=ZmO8Gpnxq2LQDWfdA7jdm4JxJ+Hgy7RjJ16q9BI3blFLzES3bmqTElK9b45nScNqNK RyHhSR3KtpmJ7BMqBJiYWSsKqQnubhh8dnEoRrHJGEDk2lINKa/8ucM6DO0giG3qQwPL 9o/aIitrdbY5pKZ6Kb+xYNDL1AAvPGQSElJpmpuN45D7pTqUWEUp+H6CKJhlRJvqXul5 hkbu51sssk59JFvlXAVKa+rsEbfQOJXwcyqCL3A1XagEYjLRALKP034crAtKeUE3sy7j MAYV5W2HPibvLGfPkcfayxxR7YA+eJ+xz1UM5E2XiALwrjXQJJ/+GCO4G3cs48UFUvrj GDvQ== X-Gm-Message-State: AOAM530Y43q0THjg9r3q8ekYpUxS/IgNevGBalMhRwVzCirOvz9xmjdZ ALHRpNfztwWafL7ZMoFltQZzDP4E+7Y= X-Google-Smtp-Source: ABdhPJwo/lq+7Hq82mbraSzoJu+2hPpq6ahxYtZkqUgm2nhrdlKbpazDlceTtfoyjeE2sfD3a4yqig== X-Received: by 2002:a17:902:8492:b0:149:7c77:7254 with SMTP id c18-20020a170902849200b001497c777254mr3169572plo.19.1641882308517; Mon, 10 Jan 2022 22:25:08 -0800 (PST) Received: from jrouhaud (1-171-174-202.dynamic-ip.hinet.net. [1.171.174.202]) by smtp.gmail.com with ESMTPSA id y23sm5217953pfa.80.2022.01.10.22.25.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jan 2022 22:25:06 -0800 (PST) Date: Tue, 11 Jan 2022 14:25:02 +0800 From: Julien Rouhaud To: Tom Lane Cc: pgsql-hackers@lists.postgresql.org Subject: Re: Isn't wait_for_catchup slightly broken? Message-ID: <20220111062502.obh4gegzcaova5dk@jrouhaud> References: <2368336.1641843098@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2368336.1641843098@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Jan 10, 2022 at 02:31:38PM -0500, Tom Lane wrote: > > So I think we need to fix it to capture the target WAL position > at the start, as I've done in the attached patch. +1, it looks sensible to me. > In principle > this might make things a bit slower because of the extra > transaction required, but I don't notice any above-the-noise > difference on my own workstation. I'm wondering if the environments where this extra transaction could make a noticeable difference are also environments where doing that extra transaction can save some iteration(s), which would be at least as costly.