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 1wAdte-000Ax2-0O for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Apr 2026 01:09:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wAdtb-002w70-1e for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Apr 2026 01:09:24 +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 1wAdtb-002w6s-0i for pgsql-hackers@lists.postgresql.org; Thu, 09 Apr 2026 01:09:24 +0000 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wAdta-0000000062e-0QtK for pgsql-hackers@postgresql.org; Thu, 09 Apr 2026 01:09:23 +0000 Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-66e129e457dso265908a12.1 for ; Wed, 08 Apr 2026 18:09:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1775696961; cv=none; d=google.com; s=arc-20240605; b=hnGeWdNVDIPnOwIjICdnK4wDcdUdw3grlhzIjyv07MItOcZpxx1FQunD1QmcvGJ9qU trB/UDN++HFeezOyA4rasur3DoasaUIX6ZtkhQEtPMD1mI9upzsDs0x17WOJleF5enjP 9CQonha9rrkQL0UyaS/uQH2mk+GBMUShaMPB1waFklq05XHU50mgg7qKJ+KJDuqfxKGD vH5D6nwc57lSoKsREHBFSxHMBl2Y6wCMvJ3yyJVpZ0MX4ffQpnZWaYffvC9FG/Dd0qDE HGGSu+QlGB/eCy0uuoy9ix1wYeXRGuylepVcyAMk6xg3I1rlcDMri7H/3Ax4hX0LyQL2 AQOQ== 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=omMUIty4kQp2yF7e0WB6DokXxsldEoWtm2jRsMh9XSc=; fh=fy3DNkR9mCPGnnOKUUMjtzhctwWc8EpsssVb0oY6ulQ=; b=OwGwl1Z4H0nYbdV39qY/y1xFaRX36WjK0771s62e2YptHwZJTePUw3TzaF4Dz5Orbd +q+yu7y87zsf23ro83Aummejss/C24D3qjo2BT2TUZMaybxhE50FAC4YBFKSChozFzfp u3FATklgkpsNE3PpCdQmSpeITMYGBxdZHjV4TCp0iIZoy4bW1xgIJ5vkQjKHO4Vt1iIt djDyvcGNqAw4NtI+5pj55bhIrQPyXiW4sO8+wJKDHaC18yErA9OSxO4kLf4ZlnP1h+XD yYGwatKRia6EO/nseWOBPgmZL8qO2QbSAtRLEzXwhStZvsSvFgra+P0Xv1w2Rx0RkN7i MfQQ==; 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=1775696961; x=1776301761; 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=omMUIty4kQp2yF7e0WB6DokXxsldEoWtm2jRsMh9XSc=; b=GZj8Kc2bVXB+uo/pc2/iFIQIeI6mmh8hvZENn3r7t8VVpLtyeche5lggujcbYrF/qX mIILHPhr5F8ctKaiDcFW4tCWA/Ob9CtntCja6IA/0wWD0FAVaxrad1kWBkNrvCxOCigc AnFuwJT+8gTnaXPyilP9Ho754TByBnCBtG8LcfQChEuXmpqy/0DYLABgltDZD/XM9cLR QJ1QVtbfniOXN4xp85feYBQwO8azhJTzPncLcSlnfnIe3AnjKdH/OMCb+sr6npRxgMJt D5qUt7EJGFWExpCdIbxNshVn2csbBshfd2OwSjxyyv3jGnEsAFXWY357G0Rj/oVcDaYu vvqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775696961; x=1776301761; 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=omMUIty4kQp2yF7e0WB6DokXxsldEoWtm2jRsMh9XSc=; b=GtstrbdzeonlPZihBAXSFBpxbA8DZSdmp2N9+lnpbk6myHbnj0XkLN3jk6ctkbfJ4O PLOKi3K8i5lCqQ905cHdPZ/ZVtlxcXI1Zi/DMZeB/rEdYMEMgWbSUQUfqvbu4DLdGQbQ Nk2rO7UulWvhL3FwEFO7aStTnfZ0uapXeCSck5HJCtIGnnhlyUiuzmUhMTuNlJkw0k8M ocSQm0pA5wikSR7wKLgXiX2Tq+Mydw9yTw+EstGZvuxt3NZlPABZ+k94+EJRn6a4ceim qrdW2v0ZWuPcXTNeJGUasOQMdG/18OrDlRZrLv9usgbxaxRclH86xdjgHElrSDLuq3xo 4xAQ== X-Forwarded-Encrypted: i=1; AJvYcCU1Vtd/z67C1WmZn5f4W3TTaQTQi+GvrJEVgsq7P3i3A1RoL3rSiH0rmz7Ws1pYrIwC/KP7wtq6Lp/rrfwD@postgresql.org X-Gm-Message-State: AOJu0YzqS24x09pcp6X/eZKnqgLTpQQ+awVrpqqDJE/f0Dvc/ntj09hJ l6gK9UtQXhDATX6RMYV/J5P9qi8QjCriVpS45j8AhugkuEUHPKigDJFbNvwtOEf3YEcQEPfmXTK 8BS0MOZkAazsmrvwVaHP8VBxOhNOEkU2btL1I7PlB+A== X-Gm-Gg: AeBDietTIzlkkuDFg6rYkWgspvZq/149EEwTqDfkOjGYMGzSMsnrkM1FV7ZqSggkg/T RGdbXGM4ACNPh7cIfGj43q/9Ey96pTEDZqJntpgvPuksSr3MVrPCATfOYtxnHe+NQjbWpzdjy6c mgjTpN72/VAWvvfmM/snSnRpZXP8gVAr/RDK0zADvXXBxTqFmj3IRuy1SqmG5FdYaXogCsl2Eti LKIi58BT/JqiG9MXTfmPY5jYUFSluPmFE6husH4ALsKPkUuxkfiShUVIN3vaFmzy8zfwfLbU7E2 Ik72W8Y3FDtYtVlE7FEqMF3XkQyT6LxrG8mimaiO2QHX54u9uGpkv43vSUgVlnSoo0tR/TsvrKQ 6bp2c0mEW X-Received: by 2002:a05:6402:5107:b0:66d:d267:9707 with SMTP id 4fb4d7f45d1cf-66e3f3d0f0fmr11150392a12.9.1775696960978; Wed, 08 Apr 2026 18:09:20 -0700 (PDT) MIME-Version: 1.0 References: <74381238-4E8A-4621-B794-57025DCCE0BA@gmail.com> <6a42c40e-eb81-4212-9bca-8c0eb02d47d1@proxel.se> In-Reply-To: <6a42c40e-eb81-4212-9bca-8c0eb02d47d1@proxel.se> From: Xuneng Zhou Date: Thu, 9 Apr 2026 09:09:08 +0800 X-Gm-Features: AQROBzCPZpogL8LOm3IU4Vo_usBtMq6PY2OEeeMOH3QhPO650ethB0L1J2dK83c Message-ID: Subject: Re: Use proc_exit() in WalRcvWaitForStartPosition To: Andreas Karlsson Cc: Chao Li , PostgreSQL-development 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 Thu, Apr 9, 2026 at 5:00=E2=80=AFAM Andreas Karlsson = wrote: > > On 4/8/26 11:08 AM, Chao Li wrote: > > While working on another patch, I happened to notice that WalRcvWaitFor= StartPosition() calls raw exit(1). I think this should use proc_exit(1) ins= tead, so that the normal cleanup machinery is not bypassed. > > > > This tiny patch just replaces exit(1) with proc_exit(1) in WalRcvWaitFo= rStartPosition(). > > This looks likely to be correct since when we exit in WalReceiverMain() > (on WALRCV_STOPPING and WALRCV_STOPPED) we call proc_exit(1). I feel we > should exit the same way in WalRcvWaitForStartPosition() as we do in > WalReceiverMain() and if not I would like a comment explaining why those > two cases are different. +1 WalRcvWaitForStartPosition, WALRCV_STOPPING before entering wait loop uses proc_exit(0) for WALRCV_STOPPING, while this path should probably use proc_exit(0) as well (not proc_exit(1)), since the stop was a requested shutdown, not an error. Using exit code 1 for a clean stop-on-request seems inconsistent. --=20 Best, Xuneng