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 1nNgQ7-0000MM-KY for pgsql-hackers@arkaria.postgresql.org; Fri, 25 Feb 2022 19:38:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nNgQ6-0005n7-EF for pgsql-hackers@arkaria.postgresql.org; Fri, 25 Feb 2022 19:38:26 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nNgQ6-0005my-2Y for pgsql-hackers@lists.postgresql.org; Fri, 25 Feb 2022 19:38:26 +0000 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nNgQ3-0005uU-FA for pgsql-hackers@lists.postgresql.org; Fri, 25 Feb 2022 19:38:24 +0000 Received: by mail-pf1-x431.google.com with SMTP id z16so5559811pfh.3 for ; Fri, 25 Feb 2022 11:38:23 -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:content-transfer-encoding:in-reply-to; bh=20x811p9K/yMbdx0pMxbLXv3iFTVLE0TyaTmzUfmRdw=; b=Ih74h01Zk/+ofWgxaaraN38IFFPUvTYO4ZDvMMkR2aFd68W+TVDQew9ZrYdACzSBNx sx8FbchG41AoI4tFwe3JnEqWIZt2PbQ81p+ZIdoAtioT4TfR7FaeubdV76fi8iA0RgnG j98qnew6+p3S/ZKdNmMZoQEuEKSwNejEFvbCM5wsDoZN4jH3GXcM7mbv1pyhH+yIbbER UMdwWr0TwNY5Np758NE/hCGkfNDfzMUJEH21nL/aGFllQPduEwNsL5/3JLFttVilUJu4 OtiYvwouyWUgo4aRbGFaXETIdgr5pWGpxa6VTSCgdaQxFYjkQPNVearXYLyG+k4Q/KS7 LVwQ== 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:content-transfer-encoding :in-reply-to; bh=20x811p9K/yMbdx0pMxbLXv3iFTVLE0TyaTmzUfmRdw=; b=f25Na6NDAAmsM4WhjtY8wOf0IDtN+gWmhvPXbWw2NqlV5cA4KjWTT+VS7WsVgt8Ehs EOPGdH40JV5plbd55nu3LfjBVtCAFFiNyhDgIVvq/gVYKFijvS+ijgBiO0UGnw5q0I3P 6LK1vFIk4DSsNLXEZIBSGb+1cj3vbWcMrwCOER5qbFa1OGZsaN9KANXErn5KIYPeSx0+ xWlvSn1F1o1KVMq2ny4dmZFHh2pmrWOAO01AOLSAIm/ZUKXq4aKfhdEO4RrIlo7tX+kj 2c6a/ZzzpRA4XhzWtK7lPRpSf8R3owpK/axM9C9qUsxPWsv4AdxBZIHBz1MDkchbA6KO wrwA== X-Gm-Message-State: AOAM533bbcsZf/KcrPhlIwJ7Db1KOUn+DF2xvCq6xZaG8LwY/8suQ1n8 eT8eou81pB1qmsPf5WMnOQY= X-Google-Smtp-Source: ABdhPJwZwqYgaqSev+5dqHOkS+Mwr4AMx+RsRgCNxsBqEk9bJha4Jgm6gNBN5pK39lyYfAxsEBnVEg== X-Received: by 2002:a63:50f:0:b0:343:92a5:be30 with SMTP id 15-20020a63050f000000b0034392a5be30mr7381149pgf.334.1645817901907; Fri, 25 Feb 2022 11:38:21 -0800 (PST) Received: from nathanxps13 ([50.54.155.70]) by smtp.gmail.com with ESMTPSA id e21-20020a635455000000b00372badd9063sm3611779pgm.11.2022.02.25.11.38.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Feb 2022 11:38:21 -0800 (PST) Date: Fri, 25 Feb 2022 11:38:19 -0800 From: Nathan Bossart To: Bharath Rupireddy Cc: SATYANARAYANA NARLAPURAM , PostgreSQL Hackers Subject: Re: Allow async standbys wait for sync replication (was: Disallow quorum uncommitted (with synchronous standbys) txns in logical replication subscribers) Message-ID: <20220225193819.GB662561@nathanxps13> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Feb 25, 2022 at 08:31:37PM +0530, Bharath Rupireddy wrote: > Thanks Satya and others for the inputs. Here's the v1 patch that > basically allows async wal senders to wait until the sync standbys > report their flush lsn back to the primary. Please let me know your > thoughts. I haven't had a chance to look too closely yet, but IIUC this adds a new function that waits for synchronous replication. This new function essentially spins until the synchronous LSN has advanced. I don't think it's a good idea to block sending any WAL like this. AFAICT it is possible that there will be a lot of synchronously replicated WAL that we can send, and it might just be the last several bytes that cannot yet be replicated to the asynchronous standbys. І believe this patch will cause the server to avoid sending _any_ WAL until the synchronous LSN advances. Perhaps we should instead just choose the SendRqstPtr based on the current synchronous LSN. Presumably there are other things we'd need to consider, but in general, I think we ought to send as much WAL as possible for a given call to XLogSendPhysical(). > I've done pgbench testing to see if the patch causes any problems. I > ran tests two times, there isn't much difference in the txns per > seconds (tps), although there's a delay in the async standby receiving > the WAL, after all, that's the feature we are pursuing. I'm curious what a longer pgbench run looks like when the synchronous replicas are in the same region. That is probably a more realistic use-case. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com