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 1wVos9-002D90-1U for pgsql-hackers@arkaria.postgresql.org; Sat, 06 Jun 2026 11:07:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wVos7-00FrZU-2s for pgsql-hackers@arkaria.postgresql.org; Sat, 06 Jun 2026 11:07:23 +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.96) (envelope-from ) id 1wVos7-00FrZL-1f for pgsql-hackers@lists.postgresql.org; Sat, 06 Jun 2026 11:07:23 +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.98.2) (envelope-from ) id 1wVos0-00000001Nq2-0WjE for pgsql-hackers@postgresql.org; Sat, 06 Jun 2026 11:07:17 +0000 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-490a76757e5so17801205e9.2 for ; Sat, 06 Jun 2026 04:07:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780744033; x=1781348833; darn=postgresql.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=uHw1E/E4voXMnOAk8wFb++76coOTdVlY+d+sdDkuxTc=; b=BSEhhLCdSR4fmltvuhs4GkvWEUggX0oW7AgfHw/Lq4RYeJs538iCxWla6dpi6GZHgs zSXkyQglbPrb2ZjG3ivnVrZ9YGeb1rFm40U/U0TDA5axVgpJRrUXO8S0fi78n+fK4Cj/ qbV+waGCqfpRt9TwyXU+vuU8fPf5zE8nSZ84yB2jWinvGWe9w8X5ri68S5PLO9pipppg BYAFKUGOMfEjMufnhcyBQSry0CbpEStFfp0Ta+mhmVkX3ptSEcRkvPOsZ7ZnTeYW598G v3VC0N3dL49nuFGGNAzyWW1X4iYUVWwgQpsZ1NtRBIVmX4DzukPq3Trhj8pY/jHQJ/+n x1JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780744033; x=1781348833; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=uHw1E/E4voXMnOAk8wFb++76coOTdVlY+d+sdDkuxTc=; b=T7IfJdpdsEs/3QVg45DoSiNcUVYB8/8+EBZKEX6m6J73ZrU1Gu7J+6xDJvEJ3D++2a wfddxNmxkNvkxUDm7EHHyd2WF0jxK3cxfvka/X4nsD5e3dDZ9Qw7HfCO78es06hg2TMV JB6vXvQkdWsxlhDF5yuiZrKWNKJn1FyoIFPi0ZlpKhYAVGeW23bM0+DjaQg4ogNY5RTs U0MmYpEWSp1S9bQ3/+dZYDOMvLW9v6TLRgVTMGZP/lXhbrkXjq5MJJAbWnJhq5LyEev5 CgwA9SWZ2zqjmfSDKB6FQHD7zkju8Ksc0F9CHQmfCz9k/gzNFTill8Rn3kINM+LUG3kL KuSg== X-Gm-Message-State: AOJu0YykszkuqW1Sp4TZqlYY50ta/lkP4Te2R+Y2UIT5NP/3otuzLJEJ GEIOoZOwj8yanj4YLpzFe97H3oXUJ9AymlSadU/oSUaUkRstOuRSdyu4 X-Gm-Gg: Acq92OGsUKEX7HB7RDlg1Lw628W7xZEXBexx0GIkujLUOjXUGjsEdQc76z42XWNnMV1 218ZdQB0Nz5yNs2Q1iauD5uB3Sk/zRMc1A32V7bPS8Y0ky4XwsGRrrZ1FMw+U/ff7Rf/SppIZza EdGU6Laa1tccuMfrryV18ckOUMHuY/9YkP7fuznfOIwCyq/kYfVqhygJvgfxzo1gJ4cTTg0KvtB h499ZOPhRhf4bdU7/hBvF3iKqkmfdT36LQBjExcddAkEwHOHyquRpp4NwNTefyQOTQLxVH0XI5H BQvreOOXABZG9LxF1koH7TEjFZnZGaSk0R5zpcfpyh0IXp136dwRrMAYi7VbVh++BxpCuMlViHb WOmvhVa2/0fZoEEmqLT5IgHtc/W0Z2kJFDyT/ln0jEDULSJmWZl236683UOkntqF0u6DWSDE7df SnXhZnCQTt/ZIl5Yc5sGaHfeDpXutbAXvAhrsI5smxb+aZG0Vc5brP7zCCMjgiARMLQMXAqyQvI RJHLpNSV1O8kvrfck53vw== X-Received: by 2002:a05:600c:1c1f:b0:490:b724:dbd6 with SMTP id 5b1f17b1804b1-490c2598382mr119362305e9.6.1780744032769; Sat, 06 Jun 2026 04:07:12 -0700 (PDT) Received: from bdtpg (ec2-15-237-197-144.eu-west-3.compute.amazonaws.com. [15.237.197.144]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-490bc3fcf5bsm265837265e9.9.2026.06.06.04.07.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jun 2026 04:07:12 -0700 (PDT) Date: Sat, 6 Jun 2026 11:07:11 +0000 From: Bertrand Drouvot To: Alexander Lakhin Cc: pgsql-hackers Subject: Re: t/035_standby_logical_decoding.pl might fail on attempt to read wrong timeline Message-ID: References: <7daef094-abf3-4672-bc23-3df4763b16a3@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <7daef094-abf3-4672-bc23-3df4763b16a3@gmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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 = RecoveryInProgress(); > >         if (am_cascading_walsender) >                 GetXLogReplayRecPtr(&currTLI); >         else >                 currTLI = GetWALInsertionTimeLine(); Yeah, it looks like there is a race condition here. I think we should check if the insertion timeline has already been set (like the walsummarizer is doing). I'll work on a fix early next week. Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com