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 1wVqZk-002E7c-0I for pgsql-hackers@arkaria.postgresql.org; Sat, 06 Jun 2026 12:56:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wVqZh-00G24i-1l for pgsql-hackers@arkaria.postgresql.org; Sat, 06 Jun 2026 12:56:29 +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 1wVqZh-00G24R-0o for pgsql-hackers@lists.postgresql.org; Sat, 06 Jun 2026 12:56:29 +0000 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wVqZe-00000001afk-1aSE for pgsql-hackers@postgresql.org; Sat, 06 Jun 2026 12:56:28 +0000 Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-beb7f26ed62so320562266b.0 for ; Sat, 06 Jun 2026 05:56:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1780750583; cv=none; d=google.com; s=arc-20240605; b=Hg1h/svMatHRTn4Ix9CSvNC9aBj7GOusdPGgD395rXPrFFTL+szl0sxpb+MyBh3lWW bgw721Dbi8GKH0Yk83k/bxUi+Xtbka4xXKViexBhuZtwOuQ8P15cXOXSzx0YuQY0C55A va1xvdxnFfxBCCAD24cGG7ipR2uIafo5fSiwqWhdblKQNmaQOH0+2F9o0RKT902nblgH 77eVScbK/AQTrP4HAA1ZyHElyfguJ8eG1SYhX7IUeU4S/detm/hb7mxJCu10ZxfFZ4xt bsiUDm497TyVGPjeG8R9Zt1XBIK1W2ZBaxDVqlEhp8OzC3Ag5qS5XSRI27ns1WhPTsoy HjJQ== 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=3wSFTKfDSYZ5JyLEinjX7QiBzE3cIkvOaxZKzl+d4dY=; fh=oELOTKOSBKuawTFdOcVUrbCnqSkT9CCw1TlxsUuK65Q=; b=SRdORN51ksYo9LevFf/QsQG+PDb8Bx1oD8aXX5gjhaia9Z5b0N7n1X8JBG2GpqM62s US/RY8fjPUThlMgAHBaDUu7aCXVsZo0EEFODx6Sh3TxcwqjeFsBDC/BTUkE+Aziw3vU8 wre21nvhBPbQ/JE4cx/ShV7iDhiqKUAISps4WfUwkhtaJO5dgw/a2HcDkwuwTq7E42OU 5rJdbjiSPE9dSCAbl7hUz8NO5PEoXmaz2hU5T9TECAdsMKQoG8Qciu5wa15djMZEGTaX Y2YljiDc6VDMxC/bi9cJEIoP5r2ibUNtguEDq+nOh4kvVpTS2J/UqlbqteF8h/Wf65w4 +PMA==; darn=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=20251104; t=1780750583; x=1781355383; darn=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=3wSFTKfDSYZ5JyLEinjX7QiBzE3cIkvOaxZKzl+d4dY=; b=M6NWoYrmynm5Uz7WmUL1Zyz/+10vs+LXfEis4vKEjH0hQE7zTZF8glAU+v3UPFx/0Z puJihsFf10IMLTWC1MyvNc7xbxgzRFUDoBjbPSzEorW7BTOi4CWuq2zvjcAVt7Ha7b/w tX/ivG86h4CLbbv3Nq6+itaSF+WhUVoOua2dmJKFVpEYoiSJhIk7nfJir+n5w9uljtfx 6bxbL1uB4dGPECFvuvi5R5VwIHxOu7mCLwblxlKDw5aLKVVMwwxrAeo4hGJ3rla1GI8H mjRY6RaqveZn6lAgPhfJtU8xXwKat7TPb2g+H5xktlfJkpnU99hYm+f87Bd8irxUv8Km R9EA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780750583; x=1781355383; 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=3wSFTKfDSYZ5JyLEinjX7QiBzE3cIkvOaxZKzl+d4dY=; b=l8xePrW70LT4YL76wFzZ0hIYKXi9FAcXIUy65OHRNkpX4pGB1AVB+oMsw5a6+mjLK3 Y2eJV+J6hKFKHLVRq6f0ypBmqEWyc0nUGCPGl0ptx1kXg9w6mOQIA0uTJFasCC0cb3kR B8L890Z8FObeneVbWsQlgg4g6BDNLEQdGLv4eYCEuJPqOZwiU2CEKG+6UIACujiDF7Nw Vbp6Vl9G7KVrHmpPoMRsInnIcNtwxJ8VmNQqpObT1LbnUicYfuf6cgM+va/5+Dc8wJ3G r6WlceaZtCZbM0izuHYT8mSiC+T8imv9paxptQsTGr6UTUjq98qRJ86LndH+VdajtWzw SWgA== X-Forwarded-Encrypted: i=1; AFNElJ+00Dg5KXhcWi5cYBCfCtRV8K8kjTIpIpEsA7nSzQfYC9Kc5klVZZVNhs0kwXU3Os7jc9QqDkNVG1PRDhUU@postgresql.org X-Gm-Message-State: AOJu0Yyfr2CRkPU2LPMvv8jJ8kiORW5YAL9dHDPyjf2kN2Q8gRaIItT7 CAb7gxW3LfGuMl9+kUEHSOEP/Ew2NVisHal/oD66rxuanyMZgO36EvlZgkXVPlxat3RlCTHCoVP IJeduGO9UA85/7Y0hjXdOyf5KUr2Nyyi06EwC X-Gm-Gg: Acq92OEH8BaRXfWkTpMjBTw6E5qdSkg2oTP1aCj+8MeZgmz7YQsV+uRl4JkKvQU2So4 vKzVeljIS25OM1DwWf79v/6L/JU2xn5vcI5TopBZNnBHx5Mj5mwUJmlWaNLFBBfhF1OW3ZZ/w2E 5Wa9D4FS6yygtvXJTcLKgP6K8FFj5rJoNM2OqFcGnofoFAYZDFAG2pp4os7v5xQehK60y/2ffFj ppgQLz+QsRzF+hXusGrlV77hmPxYamoJPYl++UhNmi76P3qn2HlpqiyG6sx7RHBpSxUBlRV+3us U3QLY2/FJaaXdf4GGinQeMbskbS5/yZYGXxyULbxOfNR/UMHAf9P2NB8U5q18eivFpUsJ45xL5q 5yMV/IuTgTdQDU7YzIFzlIZxcO8ExLSWA60IDdD3d7FqSwA96 X-Received: by 2002:a17:907:3f20:b0:bd9:a087:730d with SMTP id a640c23a62f3a-bf36fd9d3a6mr425518966b.8.1780750583095; Sat, 06 Jun 2026 05:56:23 -0700 (PDT) MIME-Version: 1.0 References: <7daef094-abf3-4672-bc23-3df4763b16a3@gmail.com> In-Reply-To: From: Xuneng Zhou Date: Sat, 6 Jun 2026 20:56:10 +0800 X-Gm-Features: AVVi8CeGOnyMdxS4yNLaZf7rM8Kpf29KZf3TI7od02qk-T_T5QiOoFwvpb-2vvo Message-ID: Subject: Re: t/035_standby_logical_decoding.pl might fail on attempt to read wrong timeline To: Bertrand Drouvot Cc: Alexander Lakhin , pgsql-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 Hi Bertrand, On Sat, Jun 6, 2026 at 7:07=E2=80=AFPM Bertrand Drouvot wrote: > > Hi Alexander, > > On Sat, Jun 06, 2026 at 12:00:00PM +0300, Alexander Lakhin wrote: > > Hello hackers, > > > > That is, walsender requested WAL segment for timeline 1, while in a > > successful run, it reads WAL for timeline 2. > > > > I've managed to reproduce this failure with: > > Thanks for the report and the repro! > > > As far as I can see, the timeline is chosen in logical_read_xlog_page() > > depending on the recovery state: > > am_cascading_walsender =3D RecoveryInProgress(); > > > > if (am_cascading_walsender) > > GetXLogReplayRecPtr(&currTLI); > > else > > currTLI =3D GetWALInsertionTimeLine(); > > Yeah, it looks like there is a race condition here. I think we should che= ck if > the insertion timeline has already been set (like the walsummarizer is do= ing). > > I'll work on a fix early next week. This looks like the right direction to fix. We may want to apply similar logic to read_local_xlog_page_guts as well. Although the failure is reported in walsender, SQL logical decoding uses the local WAL reader and has the same recovery/TLI pattern. -- Regards, Xuneng Zhou HighGo Software Co., Ltd.