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 1rAW6O-0071cm-Qp for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Dec 2023 14:08:44 +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 1rAW6M-004L5g-Mw for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Dec 2023 14:08:42 +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 1rAW6M-004L4x-Cp for pgsql-hackers@lists.postgresql.org; Tue, 05 Dec 2023 14:08:42 +0000 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rAW6J-008vbZ-Jo for pgsql-hackers@postgresql.org; Tue, 05 Dec 2023 14:08:41 +0000 Received: by mail-pj1-x102d.google.com with SMTP id 98e67ed59e1d1-286b4a84044so1487917a91.1 for ; Tue, 05 Dec 2023 06:08:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701785319; x=1702390119; 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=UbSS/DKqy1EAEUpVs6LyUXHbYeCWgGdiFSKm7B4DfBA=; b=XYdMfEPAVv8VIinwh5BMOs5ZUxAlml8AiaLgtubPhapBKVZmhP+WERsxvODiafdF/N qlVAuNtLgNxFR2ceS3h7o9UY93Q9DBFZZ643WjrU4fOAanoc6njRvfneLvL8EiOpmbZ9 0T7mGseN0Vm4GVAB9SMwhf2R3XNPLgaoIv2FfWgC91huys+DCslHscIFsHMQbEOZ1JMN uTjI1Y6TUsQP/W9ts1MfUj8kDNExz/iFzyr1B4BHMeKk22yRlfopU/GbfdFen2mHmZWc wZzD/m5to+S5p6zMxBnXlbxoO9mYw2XnWiUNB/cCL2GV05Jcr3bmSI/KotiwLhzPnmli Oa1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701785319; x=1702390119; 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=UbSS/DKqy1EAEUpVs6LyUXHbYeCWgGdiFSKm7B4DfBA=; b=lkGYgWszwofyq+e2y3jUKUXayUgyCowFOKmqUbzvO6iZ9aLKIBctb9lScI6wh4/JRs gPx1CNGtDXkJP0sN3+vQ4i6KUa6oBD6LDV6PXAbM2Z1UgVZsqJftB9Fo18y0tIdoiKMs xlMRvaDftd893vRACDBoFn0ysW2AyqqJHF8rnDR0pNZOjqGx0IyoxnTls/rx64JtbF0X QVTFu7isjHFpLIxpw7SNMFYJHPcuiMwRJUjoFVlUOTyVS4u4q7FAYc1U2sJqRQGy9KU8 8pZPTY8C5t9ZIvTrdJCfjfQTZGNdJsOkAnlZAUYlHBOPRA9rj3jlp9dNXF29U82MS+L6 0MoA== X-Gm-Message-State: AOJu0YwjU6RA+NiDeE6MFnZsIep3MgfecPd/3ZIf74hqXlflGhpwUrNM 8y7SJafb+R+Q34xJh5u42c0= X-Google-Smtp-Source: AGHT+IEqseVBVTYf6MMt5lrdyPaadkG1WbJ8NOU8X8NeuizJpOxpV1FBU/FF/mjH9BWa9Bto8vw5eA== X-Received: by 2002:a17:90a:e018:b0:286:6cc1:5fb9 with SMTP id u24-20020a17090ae01800b002866cc15fb9mr1077309pjy.60.1701785318607; Tue, 05 Dec 2023 06:08:38 -0800 (PST) Received: from ?IPV6:2a01:cb11:192:7000:61d0:dfb3:acd8:ee11? ([2a01:cb11:192:7000:61d0:dfb3:acd8:ee11]) by smtp.gmail.com with ESMTPSA id d5-20020a17090a8d8500b002867adefbd4sm5400669pjo.48.2023.12.05.06.08.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 05 Dec 2023 06:08:37 -0800 (PST) Message-ID: Date: Tue, 5 Dec 2023 15:08:33 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Synchronizing slots from primary to standby Content-Language: en-US To: Amit Kapila , shveta malik Cc: 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: <65326908-f1ef-40ce-acc6-414801c30946@gmail.com> <1789e94e-8266-44d1-95e4-7f41abc27d0d@gmail.com> <828dcda4-50c2-4069-bdc3-9e8c90c943d7@gmail.com> <6694284d-c847-42df-8f76-6efa8eeeb0df@gmail.com> <2fdc471d-2eee-4c29-9f26-d7f5dcc8cd53@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/5/23 12:32 PM, Amit Kapila wrote: > On Tue, Dec 5, 2023 at 10:38 AM shveta malik wrote: >> >> On Mon, Dec 4, 2023 at 10:07 PM Drouvot, Bertrand >> wrote: >>>> >>> >>> Maybe another option could be to have the walreceiver a way to let the slot sync >>> worker knows that it (the walreceiver) was not able to start due to non existing >>> replication slot on the primary? (that way we'd avoid the slot sync worker having >>> to talk to the primary). >> >> Few points: >> 1) I think if we do it, we should do it in generic way i.e. slotsync >> worker should go to no-op if walreceiver is not able to start due to >> any reason and not only due to invalid primary_slot_name. >> 2) Secondly, slotsync worker needs to make sure it has synced the >> slots so far i.e. worker should not go to no-op immediately on seeing >> missing WalRcv process if there are pending slots to be synced. >> > > Won't it be better to just ping and check the validity of > 'primary_slot_name' at the start of slot-sync and if it is changed > anytime? I think it would be better to avoid adding dependency on > walreciever state as that sounds like needless complexity. I think the overall extra complexity is linked to the fact that we first want to ensure that the slots are in sync before shutting down the sync slot worker. I think than talking to the primary or relying on the walreceiver state is "just" what would trigger the decision to shutdown the sync slot worker. Relying on the walreceiver state looks better to me (as it avoids possibly useless round trips with the primary). Also the walreceiver could be down for multiple reasons, and I think there is no point of having a sync slot worker running if the slots are in sync and there is no walreceiver running (even if primary_slot_name is a valid one). That said, I'm also ok with the "ping primary" approach if others have another point of view and find it better. Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com