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.96) (envelope-from ) id 1vwCUV-0095TU-1W for pgsql-hackers@arkaria.postgresql.org; Sat, 28 Feb 2026 05:03:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vwCUT-009orW-0E for pgsql-hackers@arkaria.postgresql.org; Sat, 28 Feb 2026 05:03:45 +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.96) (envelope-from ) id 1vwCUS-009orK-2V for pgsql-hackers@lists.postgresql.org; Sat, 28 Feb 2026 05:03:44 +0000 Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vwCUP-00000001gEm-43Bs for pgsql-hackers@lists.postgresql.org; Sat, 28 Feb 2026 05:03:44 +0000 Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-3870cbd6c40so35502011fa.0 for ; Fri, 27 Feb 2026 21:03:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1772255020; cv=none; d=google.com; s=arc-20240605; b=ZC759M9gsJuJqPqsu+UOVpDIM87AgRwDrjY7QGUKDhqYsdZalzi0MaGSeVRGTMR+8D dIlc9GKp2q0uJpL9hJrxwPdf85al9hj5WSNXREsdf6TAjgeaNhmTzT6yE/Bldq1KPbvh TNLd67JiIg6/ZnBjgiiU91hXjyI094lbAvYGt7LvMGETsBva6L/+7UMsgiJD4e4MKAz2 cRU+ffmnZRHVP59dslan2uR9vvXes8t7svpZ7bAjqbMDTonGmxJesGf0g4d7GUEoi2OM n0iyJV30tAdJnYc6G8CyoRtqYMcIpU8DD+davuB7qex2l9cX3qWesiiwQs/GuTxxZGz6 SJ6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=ytQsVp+9iNoUBhsHAX5+sdc7++qFyDtxZbDwW7ljA7A=; fh=x4xgi4tdDukVB0fBuAIe3vORvD36rbbTBlhrrGN8QbM=; b=F9nLw3q+kOI0s3+iDVfJEDbCNM/KMYnq5tUn65Z4N/jDQA9WKePF/WqVvxDI8xRK2V 8f/oKWb5A9/hs6ejV9b3pYcKRb5WSmNDJNbDWaBcbYrfQribmdz0npkR13xKHl0RdFKx mVBYTxyNuEVlqAHcVRG/uYk3GV/bWFF+nOfwqMRDe63BP3xS5FMbMyGAapZHC5X6iYL9 T8NoFTBa+zlTg4CHCHpfRHWoCz6RObjVN3gxpWzU40Sq7WaxeFSe7K+Dry5BmWfobJG3 DehTp7Al2EHxNVjuDIgLFjyjfMI94y8awRzC9+xqBjxUHiN1P7/KrpVJ+w8/2yXHNJ7q XShQ==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772255020; x=1772859820; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ytQsVp+9iNoUBhsHAX5+sdc7++qFyDtxZbDwW7ljA7A=; b=WBSUhZNxEjJG/GQAype61wOEBkFzkhtiy7Aasxp0RzPiuGCvSTjwHMnkPJEI/lCT7l EWRl4qUqNLL/3fWBbC6k8w00WxjhSS/dY/ODHxVLDAM2wVGq0MmmBQc5fpqqZs3ouJQD Jv1qdRh910WSjC8xtTBSZIqkfjy+FD6STpgTgnxI6w9y0R1Y34kejF6m6h9ct84SqUFy X/ZkqHuHNVNhAlC33MX3DAnbwPV4XV0wzvVnttxV4zRS+Uu3SiK9oz0g38QFIOEEGT8n j3GSuenawzN7w6/GLZ5WGvcB35plmRkal0syQSti4Eey+wptaSKeOvuEjclyAmaA+FMm gesQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772255020; x=1772859820; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ytQsVp+9iNoUBhsHAX5+sdc7++qFyDtxZbDwW7ljA7A=; b=Zlq8XIgW+6BcX02ngKgeGRsm06BP2kJqEyjpQX5IQdhQJSDfhDSTRs3wMtpB9kqiYc xt1SmvEoRc5mHPK9k7RHoYgMwDAALwNzI31HWOO+gG2BQPTNo35OHRWFXwJr+NW/vqY8 v258qFigeePk46J+KZgqHzxAxTUMUPn18eS/QeauGxZsgucSQg6NbKGCdvWOlKtnsWY1 l05SGkRXULlUtK7XKnG6GijnQ1l5DBAIgPiYPFNEcTtgX0q0Vx6XaXsoAc2FwaoHaYlt i8r9cBHfnjB5JRT7V6T/ZH8raslYUKE/J/ahkTKR1d8Kr5a7U+7rnyOttDXFOH3hJ0Bl czIQ== X-Gm-Message-State: AOJu0YzePH1pk8q+/j9kgm2XQ9PXSfjDhAKWE6kmpmcqmTCFY0xNR8SB +PXtkiTdaioSfN4bywxxe+Ooc5DKqzLZww2xjQYDH6xbwVfhFV9AW/PbltBsszCMIaKBUEEtJxz TexfHYyNN6jvEFUU1veJzjz5VzkOjqfM= X-Gm-Gg: ATEYQzxEH6iwNSq4IX0mGJxnSA3bXfdvBfuT62aRaaKMGR1kRuharxgwXcR1Sbc9vqM 4iIzVshsTwuQW4mpvNKEVSXg14lEQ88bZFzDk5WnfFxZ5J18e4rQYz7BplVtCwjUJ4+Zja5jtG5 rsYaPxnfY3nVUxvzvYeXWD0fg/GvFaBKR5lMdNhOOjsaQuWFPNJdPziodHoOfkh8XoXA4juKSYL rPP4PM46MKJoHIEXi7dHvuJ/Dtv8OhptZbGpYsY3xk77GMoT/2ah1ZBNDxfbxIE8NA3y99XBTxn C/Q4oid37DX+GbAkbU3GchqedHoLehmcdr+C3RF3VuKQO2BaBA== X-Received: by 2002:a2e:a555:0:b0:37a:4bab:ca09 with SMTP id 38308e7fff4ca-389ff111e6dmr32764911fa.6.1772255019468; Fri, 27 Feb 2026 21:03:39 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Amit Kapila Date: Sat, 28 Feb 2026 10:33:28 +0530 X-Gm-Features: AaiRm51DcuoOt_08i5sHeA2kLfvaUi2KMhpUw_UA_Cnm5nxLSKqTBqR-_4EZcyQ Message-ID: Subject: Re: Fix slotsync worker busy loop causing repeated log messages To: Fujii Masao Cc: PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Feb 27, 2026 at 8:34=E2=80=AFPM Fujii Masao = wrote: > > Normally, the slotsync worker updates the standby slot using the primary'= s slot > state. However, when confirmed_flush_lsn matches but restart_lsn does not= , > the worker does not actually update the standby slot. Despite that, the c= urrent > code of update_local_synced_slot() appears to treat this situation as if > an update occurred. As a result, the worker sleeps only for the minimum > interval (200 ms) before retrying. In the next cycle, it again assumes > an update happened, and continues looping with the short sleep interval, > causing the repeated logical decoding log messages. Based on a quick anal= ysis, > this seems to be the root cause. > > I think update_local_synced_slot() should return false (i.e., no update > happened) when confirmed_flush_lsn is equal but restart_lsn differs betwe= en > primary and standby. > We expect that in such a case update_local_synced_slot() should advance local_slot's 'restart_lsn' via LogicalSlotAdvanceAndCheckSnapState(), otherwise, it won't go in the cheap code path next time. Normally, restart_lsn advancement should happen when we process XLOG_RUNNING_XACTS and call SnapBuildProcessRunningXacts(). In this particular case as both restart_lsn and confirmed_flush_lsn are the same (0/03000140), the machinery may not be processing XLOG_RUNNING_XACTS record. I have not debugged the exact case yet but you can try by emitting some more records on publisher, it should let the standby advance the slot. It is possible that we can do something like you are proposing to silence the LOG messages but we should know what is going on here. --=20 With Regards, Amit Kapila.