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 1pXosI-000243-S6 for pgsql-hackers@arkaria.postgresql.org; Thu, 02 Mar 2023 19:45:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pXosH-0002LH-Mu for pgsql-hackers@arkaria.postgresql.org; Thu, 02 Mar 2023 19:45:57 +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 1pXosH-0002L3-Ai for pgsql-hackers@lists.postgresql.org; Thu, 02 Mar 2023 19:45:57 +0000 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pXosF-0004rO-1D for pgsql-hackers@postgresql.org; Thu, 02 Mar 2023 19:45:56 +0000 Received: by mail-pj1-x1036.google.com with SMTP id q31-20020a17090a17a200b0023750b69614so80619pja.5 for ; Thu, 02 Mar 2023 11:45:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20210112.gappssmtp.com; s=20210112; t=1677786354; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=Q7K6qWIVFgcvzBwtCpOz7nH5qZsBG91JJmaebMEYmjY=; b=O+FodNr+ZVc4esmTNCx9J1IJQB1g2ftMHS6ynhvJKfRcHRpTKJ52wP/qcVYF9h0kh8 8CPNjf8na/pLzX2RsD/AUGbszNAC26E4vEja76GOE7iMddpdIsqcKXho6fWXEkU+E84E lFAtKpPopgDNi41UepS0p/WSCj4dlMnt43HpVI/2hE/dcvbU6nyfYKX3gCUw0X+c2ON+ htNViKY3e/oqAh71E+jCyV2WCU4w6T0ZgVCS1b4qZdwm8i74SV7XCoOzQ+G5uPnsoINA KoHR+4hO1i01BjiqntbfvVOTx8r975/PMfjupv6ZzLKsg3KIa5FtswG3rhBO6T4vpH8x hv2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677786354; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Q7K6qWIVFgcvzBwtCpOz7nH5qZsBG91JJmaebMEYmjY=; b=FqQwEE/PZ6RjJcEDj/shXoZYtm3qZ0PgVXm39c/RJmAp5WMGPbtZbzms8aVA990bst 7PsOSqMQV2T1sc06x9W4B72VyNZJ/SzjPTjGLdKzH6LJlrIfY9DjClChSldiTNIxthDw BQgmIsehV+PYlacU6up5ys/K+NKKdck9eULCRJdJBrgWKMn3cErS8+e5WyRFT4nT9j7I 1pg18WJT6P9MY4aMWnf05a/NHoNePEaJc4t1lSW+nkAclp8cQojd0ve144CBw1P48yjE cdqneMw3DNISRkbYEt4YidwnKSiMBpKhLHJku5d42FeA49TbZlgLah/vGuqc04pwOWXC KVPw== X-Gm-Message-State: AO0yUKWvu/H2dDGt+XYfL5ryRjyZnVdOpo+DPLRhb5OAAruEtHopDlqy 3dCcYA/hJZJf/HFQIMsg6WJPDg== X-Google-Smtp-Source: AK7set/uDbXvsuzsbZuPJbDvMZsXi5mCoA9Eom6P5hUJ98/mBhJhsDuf0BbbyI8N70mEoLhqpG1lqg== X-Received: by 2002:a17:902:f70a:b0:19c:df17:7c99 with SMTP id h10-20020a170902f70a00b0019cdf177c99mr10283613plo.33.1677786354013; Thu, 02 Mar 2023 11:45:54 -0800 (PST) Received: from jeff-laptop.lan (c-73-231-146-4.hsd1.ca.comcast.net. [73.231.146.4]) by smtp.gmail.com with ESMTPSA id o14-20020a170902d4ce00b00189f2fdbdd0sm62555plg.234.2023.03.02.11.45.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Mar 2023 11:45:53 -0800 (PST) Message-ID: Subject: Re: Minimal logical decoding on standbys From: Jeff Davis To: "Drouvot, Bertrand" , Andres Freund Cc: Robert Haas , Thomas Munro , Alvaro Herrera , Ibrar Ahmed , Amit Khandekar , fabriziomello@gmail.com, tushar , Rahila Syed , pgsql-hackers Date: Thu, 02 Mar 2023 11:45:51 -0800 In-Reply-To: <8a7da0c2-b7fe-1c78-4e47-a16239bf4839@gmail.com> References: <1f2ad9fd-53ff-74cc-a602-72d45423bcab@gmail.com> <05c0c4f3-82eb-bc6d-c876-5a265c05927b@gmail.com> <20230106034036.2m4qnn7ep7b5ipet@awork3.anarazel.de> <490206c5-bcde-e558-628a-dc67dae4d439@gmail.com> <20230119024617.jzsgpcrgjdc6ysge@awork3.anarazel.de> <94d9d47e-72f4-393a-246e-e3fe8db7b741@gmail.com> <2d314c22b9e03415aa1c7d8fd1f698dae60effa7.camel@j-davis.com> <061eeb26-156e-6011-02b6-b4b1422e2aa6@gmail.com> <8a7da0c2-b7fe-1c78-4e47-a16239bf4839@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4-0ubuntu1 MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 2023-03-02 at 10:20 +0100, Drouvot, Bertrand wrote: > Right, but in our case, right after the wakeup (the one due to the CV > broadcast, > aka the one that will remove it from the wait queue) we'll exit the > loop due to: >=20 > " > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* check whether we're d= one */ > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (loc <=3D RecentFlush= Ptr) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = break; > " >=20 > as the CV broadcast means that a flush/replay occurred. But does it mean that the flush/replay advanced *enough* to be greater than or equal to loc? > - If it is awakened due to the CV broadcast, then we'll right after > exit the loop (see above) ... > I think that's not needed as we'd exit the loop right after we are > awakened by a CV broadcast. See the comment here: * If this process has been taken out of the wait list, then we know =20 * that it has been signaled by ConditionVariableSignal (or =20 * ConditionVariableBroadcast), so we should return to the caller. But * that doesn't guarantee that the exit condition is met, only that we * ought to check it. You seem to be arguing that in this case, it doesn't matter; that walreceiver knows what walsender is waiting for, and will never wake it up before it's ready. I don't think that's true, and even if it is, it needs explanation. >=20 > I agree that's a good idea and that it should/would work too. I just > wanted to highlight that in this particular > case that might not be necessary to build this new API. In this case it looks easier to add the right API than to be sure about whether it's needed or not. Regards, Jeff Davis