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 1rBAfI-009hg7-3r for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Dec 2023 09:27:28 +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 1rBAfD-00GAwO-LJ for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Dec 2023 09:27:23 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rBAfD-00GAwF-9X for pgsql-hackers@lists.postgresql.org; Thu, 07 Dec 2023 09:27:23 +0000 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rBAfA-00AXBk-EO for pgsql-hackers@postgresql.org; Thu, 07 Dec 2023 09:27:22 +0000 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-40c0a074e71so7548515e9.1 for ; Thu, 07 Dec 2023 01:27:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701941239; x=1702546039; darn=postgresql.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=HBYESbAn6SU082cvHwAVdblHfQ25G0NK5bLcUQfB+gM=; b=YcOmjttxNV+RQRUMfOfoNJmxiK3HAoCOIP+1FVhVBUZ6uxulkEpf+OKnBO2+oABi2Z i7IW022HbP32WA9jK4PARHXPAsNc4PQRA/LuBpKz0Usf/GrGGIgK6py+n8YkDMiBEY4v XwpEBoezhDYoCxGIKl8Lsbt01Jtbr027uchyiLEvUoyIYPfUzUjbc1bCCaTtwf1bsi04 u8O4nHGk8YKkOP45SvNWSW3uzfOrYxV43+T1d8EwxnoCmqFnEGH34PdIQ3xKZopZyYgQ X3OKK2ZgozfzwV/SIGzdycu2WqYkVehtk57R7KtQRNfMRitGvY5p1+aUBTXsMZ4nEwzj S1nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701941239; x=1702546039; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=HBYESbAn6SU082cvHwAVdblHfQ25G0NK5bLcUQfB+gM=; b=Pnz6SWc2h2MDsD7WgQHkS4WYB5kn3UHTXyFgKcE5g5pIha0kUdze+/n9VsVgxz4DHW lmqjoy/3hStmqi+ErtVhTLNTbP0GR1qfXgOhd6ERwK5o9065BtIgS4VimElAt/r2374l m8fLnD93fEQXJ68t/RTrAG1WasQn+npTPPoP0pqMEkqFQBrDgn/doL+BPI3VSm3yB1Py 70HBuxbfoBf9VO7/X9fyMV0uwuh8ip0cyyrCYDVpUNB77Vn//P57sjMh0JEjE/RWA2t+ wSa4vVPmSmooX6rSYSL2KNRcCTypraMLHdtv9hmcXcdqcZb/eYbfnlXWSc4Afub42hD/ 0Iig== X-Gm-Message-State: AOJu0YyZhFmKssu91Q5jtzeQzk313EvsBCbC618u5+F2OxXGvWDOptIE C/5dLObMZkXu2+kR52LZ16U= X-Google-Smtp-Source: AGHT+IG8rxAy2mqFLwLbp5ZvuJTefGqiLJv28H15MuZ1G2u0q30fAHu3XaT258oCPI5KlrRZUWJM4g== X-Received: by 2002:a05:600c:3b88:b0:40b:5e22:95e with SMTP id n8-20020a05600c3b8800b0040b5e22095emr1509547wms.77.1701941239052; Thu, 07 Dec 2023 01:27:19 -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 c17-20020a05600c0a5100b0040b4fca8620sm1330277wmq.37.2023.12.07.01.27.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 07 Dec 2023 01:27:18 -0800 (PST) Message-ID: <11813468-1a48-46e3-85b8-ce584b822b0b@gmail.com> Date: Thu, 7 Dec 2023 10:27:18 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Synchronizing slots from primary to standby Content-Language: en-US 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> <3b87d0ad-6d6b-4227-8e8f-06833b42a420@gmail.com> 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/7/23 10:07 AM, shveta malik wrote: > On Thu, Dec 7, 2023 at 1:19 PM Drouvot, Bertrand > wrote: >> 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? >> > > I am a bit confused. Do you mean as a TODO item? Otherwise the comment > will be opposite of the code we are writing. Sorry for the confusion: what I meant to say is that synchronization (should it be lagging) is not possible if the walreceiver is not started (as XLogRecPtrIsInvalid(WalRcv->latestWalEnd) would be true). More precisely here (in synchronize_slots()): /* The primary_slot_name is not set yet or WALs not received yet */ SpinLockAcquire(&WalRcv->mutex); if (!WalRcv || (WalRcv->slotname[0] == '\0') || XLogRecPtrIsInvalid(WalRcv->latestWalEnd)) { SpinLockRelease(&WalRcv->mutex); return naptime; } Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com