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 1vHp9X-002Zg4-15 for pgsql-bugs@arkaria.postgresql.org; Sat, 08 Nov 2025 20:03:15 +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 1vHp9U-002siA-IB for pgsql-bugs@arkaria.postgresql.org; Sat, 08 Nov 2025 20:03:12 +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 1vHp9U-002si2-9c for pgsql-bugs@lists.postgresql.org; Sat, 08 Nov 2025 20:03:12 +0000 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vHp9S-0066uh-1y for pgsql-bugs@lists.postgresql.org; Sat, 08 Nov 2025 20:03:11 +0000 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-7b22ffa2a88so464869b3a.1 for ; Sat, 08 Nov 2025 12:03:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; t=1762632190; x=1763236990; darn=lists.postgresql.org; h=user-agent: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=2vkiWAc2wEVMbYVCnacPOVRObTVjRLi/FiN1mYMr51A=; b=DQTVq2XKxZ3JMICbdQe1BxHK9UgcdSpJpUu8XF0bL1LTVKtKQpOAitBYQmt3+r/pPR aOE8e7uCIwi91UU56471nQ4+a4Uo3F7EIHtZe+9rsI18RI4whg1cDB0yeKU38tdw+gMJ WMWJy1VWXMAk7IdKihBuwZw7rD6Lvh3Rhzto4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762632190; x=1763236990; h=user-agent: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=2vkiWAc2wEVMbYVCnacPOVRObTVjRLi/FiN1mYMr51A=; b=MuZ5h9j0JYNxsFsDgtICmw9w6aWk1bU38y7qI8HufOO42vN0tYs2Wqu9P1Ps9Taxtr 33wTK3pqAWf0XfkMqhQMnD/TExeJSMqJEGWIByjDEwPo+z0MgZgL/cunJHAGDjEJBTS4 fg59+rnAk+r+28RrIilTKo6fe2Mcb+QaRwJPkGU5M8uA/zz8zM4d06FwvmrP0/IHxovg h89b3z5a7/L4DB7MrrqHxocE/xCyraQPQ+THz7vtvtwefIsIrRQOibEH6PB9oyBe7ZE7 SFyGfkJ94m7y7CWe+Jeq+oeVit5Rf+duenDMlBdsMDARyBqp+FJ/eVE/mASe7LnnqULr 8wHA== X-Forwarded-Encrypted: i=1; AJvYcCWQGvpcNUGQqk5nq1q8YL5HdKtc9fhz+EfNpW38SaSa1u7XaJKE9kngr50pGydfAYSuKxJnzDhN4lse@lists.postgresql.org X-Gm-Message-State: AOJu0YxtGeLcjQxHyUu2hSFUcH55cSqaz5nAQivbFrlLnGNWQ0L+FFUL cbChXCFDY3OSwKJdqbreUxXGfmW6wSz598FTbEPAm/IN3XS0L1zKqbvpRrk2kpNJQw== X-Gm-Gg: ASbGncs7JULr54nmnW4a4RxR8aX5CDDX8/s0hjXkk96gZ3XlSuiYt3X8gvCVMKpzaw0 R3iLlfDja8DeLoAuJNnSbv7E0DbCHTk8xfHIYOmai0OSLHnmctcwacdetA7ops+4DKRs9/r3+wC 6bR1HhzEBqhN+2k2wKeI3SjdMoL42fcO+06eXV2EtU2sdIwzL3TPdNzU0El37jtZ2Z9yUNqAjGw mbwZPiqQbZsibpI0ClGAzM6dWKOs8WZf6JU5pgqewErzSAXlbDyVfEblYndX0jW949HDsvh+GDn yWjbRDDqN+ndXjFQsLK4dCCtW/AT1bQGcj2TMJKRAFuPHMLutEU/198KDhxhFSLEYW7ZZHLbV9C g4lD9ha9XAXhqh9PIA5tvMmHT/vyuF8mYxfLmrJS/yfAg3dA6Zf8laii697SmI4woHbYfStU9+p rermE4I1/SxLfVv93kWkI+6y/xB8lG7QPDkoJ1kGo= X-Google-Smtp-Source: AGHT+IHRCcGAzi3ttb+HwIsqbb1+wpsDPNq3HYu7cZVodPAhDBF5O0WnxUTgzweD7vr3UiNlCkZRew== X-Received: by 2002:a17:902:ef50:b0:295:57f6:768 with SMTP id d9443c01a7336-297e56c9e12mr40767205ad.33.1762632189668; Sat, 08 Nov 2025 12:03:09 -0800 (PST) Received: from google.com (c-73-15-160-255.hsd1.ca.comcast.net. [73.15.160.255]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-29651c92cddsm98648735ad.83.2025.11.08.12.03.08 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 08 Nov 2025 12:03:09 -0800 (PST) Date: Sat, 8 Nov 2025 12:03:07 -0800 From: Noah Misch To: Michael Paquier Cc: Xuneng Zhou , ryanzxg@gmail.com, pgsql-bugs@lists.postgresql.org, Euler Taveira Subject: Re: BUG #19093: Behavioral change in walreceiver termination between PostgreSQL 14.17 and 14.18 Message-ID: <20251108200307.c3.nmisch@google.com> References: <19093-c4fff49a608f82a0@postgresql.org> <20251027041241.ab.nmisch@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/2.2.12 (2023-09-09) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Oct 31, 2025 at 12:16:21PM +0900, Michael Paquier wrote: > On Fri, Oct 31, 2025 at 12:07:01AM +0800, Xuneng Zhou wrote: > > I’ve incorporated both tests and the assertion into the patch applied to master. > > For earlier stable branches, the test in > > 040_standby_failover_slots_sync.pl and the assertion for > > WAL receiver state checking are not included (if Noah agrees too). Please check. > > Thanks for doing that. I have extracted the test to check the "valid" > WAL receiver shutdown case, and applied that separately. > > Noah, what do you think? This just now got to the top of my queue. Given your commits, you may no longer need answers to these and other questions on the thread. If anything of $SUBJECT is still waiting on me, let me know. commit 17b2d5e wrote: > Fix unconditional WAL receiver shutdown during stream-archive transition > > Commit b4f584f9d2a1 (affecting v15~, later backpatched down to 13 as of > 3635a0a35aaf) introduced an unconditional WAL receiver shutdown when > switching from streaming to archive WAL sources. This causes problems > during a timeline switch, when a WAL receiver enters WALRCV_WAITING > state but remains alive, waiting for instructions. > This commit changes the WAL receiver behavior so as the shutdown becomes > conditional, with InstallXLogFileSegmentActive being always reset to > prevent the regression fixed by b4f584f9d2a1: only terminate the WAL > receiver when it is actively streaming (WALRCV_STREAMING, > WALRCV_STARTING, or WALRCV_RESTARTING). When in WALRCV_WAITING state, > just reset InstallXLogFileSegmentActive flag to allow archive > restoration without killing the process. WALRCV_STOPPED and > WALRCV_STOPPING are not reachable states in this code path. For the archives, I think the last sentence is incorrect about WALRCV_STOPPED. Observing WALRCV_STOPPED at this location was the original motivation for commit b4f584f9d2a1, per its report (https://www.postgresql.org/message-id/CAFiTN-sE3ry=ycMPVtC+Djw4Fd7gbUGVv_qqw6qfzp=JLvqT3g@mail.gmail.com). Commit 17b2d5e will handle that case fine, though.