Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rB98p-009c9E-2e for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Dec 2023 07:49:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rB98m-00FYxe-PA for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Dec 2023 07:49:48 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rB98m-00FYxW-FP for pgsql-hackers@lists.postgresql.org; Thu, 07 Dec 2023 07:49:48 +0000 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rB98j-009DBD-UZ for pgsql-hackers@postgresql.org; Thu, 07 Dec 2023 07:49:47 +0000 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-40bda47c489so6917765e9.3 for ; Wed, 06 Dec 2023 23:49:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701935384; x=1702540184; darn=postgresql.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=U4YZEk9CIVoqWlg7aZsmgcMUXwi+0ZjVXFPN4n095jU=; b=U7eHrvMVF9xszg3EEmVy0JIPcdJRJuZoEdk7bDxgS0L6iXE8BZgt7xiXeoErlS2ULv uEnjGPG0d2GSrVGRBKwbCgmHMvY1ZoDn2z1OFDDyHWtfuP/55jwfwjZcZOqw/oWW/42/ i4eURzxPkRs0pliODdZnZN00TtIA3DjIXRHwZIOhtrz4EE/TQfgPjW9w7cxOUxeppP6l 47ibQLaqmTaO+KajLOXMkny0CfjvLEIkoG6OTNgINWpw9HsuIL6j6K3VAEnKl9WKVNqV SDqVazN6akcIlME+kz1abAv9psxGKnXcrnSFm5R3cp6BhhhBoNdKaT75M5edHIx5Kh/R oQ/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701935384; x=1702540184; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=U4YZEk9CIVoqWlg7aZsmgcMUXwi+0ZjVXFPN4n095jU=; b=e1x01WA7GFFDhloFwdVC6sePebqYWW7BkZXB4KoYjaHnrSIZ5Puxey0QLaxgkHdRs6 xOlbj3jKiA4/i6Crs0CucF3vMmxFPXZXvCpucnkX04wzOsLu+7OqVnQeJFO9On1yyI78 OrDFR5p9vtbM1wrPiU/mtM6yqYunyzB7VJlG0M/U5eTRYZLCMgMO4UrAJKuA6TZzGGP7 W/xXps7r0CE5Zh/jzbMrKnOFc/pEmHaXv47yYav2jkkgLIECkFvkJBMwpe2glWDrW5ba bRNc7k8aU8+1Qe/6zZyW0e3ajHUzUXsgvD+CcXh0sxduFxCM3S+SeeLr997WyVmMq3Gd 0bxA== X-Gm-Message-State: AOJu0Yz5t8Do/oe71rQsWQP8u+uqM6fzMH6IZ5P290JeOIVp15ovXoSm bW0/5uS6Gc7z8RVBEm1tfGk= X-Google-Smtp-Source: AGHT+IHSgmLNuaF6LWNu6Zy3TUAv2qI20ycuA6OMjIvTsACdBBVI1+qi2wwk3BwgUSpsnP7FGS8gcg== X-Received: by 2002:a05:600c:4a12:b0:40b:5e21:d338 with SMTP id c18-20020a05600c4a1200b0040b5e21d338mr1379674wmp.65.1701935384255; Wed, 06 Dec 2023 23:49:44 -0800 (PST) Received: from ?IPV6:2a01:cb11:192:7000:a0c2:3d14:518:c3b7? ([2a01:cb11:192:7000:a0c2:3d14:518:c3b7]) by smtp.gmail.com with ESMTPSA id u21-20020a05600c139500b00405d9a950a2sm1030092wmf.28.2023.12.06.23.49.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 06 Dec 2023 23:49:43 -0800 (PST) Message-ID: <3b87d0ad-6d6b-4227-8e8f-06833b42a420@gmail.com> Date: Thu, 7 Dec 2023 08:49:42 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Synchronizing slots from primary to standby To: shveta malik Cc: Amit Kapila , Nisha Moond , "Zhijie Hou (Fujitsu)" , Peter Smith , "Hayato Kuroda (Fujitsu)" , Bharath Rupireddy , Peter Eisentraut , Bruce Momjian , Ashutosh Sharma , Andres Freund , pgsql-hackers , Ajin Cherian , Alvaro Herrera References: <828dcda4-50c2-4069-bdc3-9e8c90c943d7@gmail.com> <6694284d-c847-42df-8f76-6efa8eeeb0df@gmail.com> <2fdc471d-2eee-4c29-9f26-d7f5dcc8cd53@gmail.com> Content-Language: en-US From: "Drouvot, Bertrand" In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 12/6/23 11:58 AM, shveta malik wrote: > On Wed, Dec 6, 2023 at 3:00 PM Drouvot, Bertrand > wrote: >> >> Hi, >> >> On 12/6/23 7:18 AM, shveta malik wrote: >>> On Wed, Dec 6, 2023 at 10:56 AM Amit Kapila wrote: >>>> >>>> I feel that is indirectly relying on the fact that the primary won't >>>> advance logical slots unless physical standby has consumed data. >>> >>> Yes, that is the basis of this discussion. >> >> Yes. >> >>> But now on rethinking, if >>> the user has not set 'standby_slot_names' on primary at first pace, >>> then even if walreceiver on standby is down, slots on primary will >>> keep on advancing >> >> Oh right, good point. >> >>> and thus we need to sync. >> >> Yes and I think our current check "XLogRecPtrIsInvalid(WalRcv->latestWalEnd)" >> in synchronize_slots() prevents us to do so (as I think WalRcv->latestWalEnd >> would be invalid for a non started walreceiver). >> > > But I think we do not need to deal with the case that walreceiver is > not started at all on standby. It is always started. Walreceiver not > getting started or down for long is a rare scenario. We have other > checks too for 'latestWalEnd' in slotsync worker and I think we should > retain those as is. > Agree to not deal with the walreceiver being down for now (we can still improve that part later if we encounter the case in the real world). Might be worth to add comments in the code (around the WalRcv->latestWalEnd checks) that no "lagging" sync are possible if the walreceiver is not started though? Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com