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 1wQIQe-001Ps4-28 for pgsql-hackers@arkaria.postgresql.org; Fri, 22 May 2026 05:28:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wQIQa-00CNHl-0O for pgsql-hackers@arkaria.postgresql.org; Fri, 22 May 2026 05:28:09 +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 1wQIQZ-00CNHd-2Y for pgsql-hackers@lists.postgresql.org; Fri, 22 May 2026 05:28:08 +0000 Received: from mail-oo1-xc29.google.com ([2607:f8b0:4864:20::c29]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wQIQZ-00000000E3b-0RYX for pgsql-hackers@lists.postgresql.org; Fri, 22 May 2026 05:28:07 +0000 Received: by mail-oo1-xc29.google.com with SMTP id 006d021491bc7-6948d7ccfbbso2597281eaf.1 for ; Thu, 21 May 2026 22:28:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1779427686; cv=none; d=google.com; s=arc-20240605; b=D7nmo0RkLEqDNfs7VBKaSeHfcSXqSJCJV7LLlxLeFiJNLmUYuco4pdx+eYG9bXwfFz ihPx7svG+DxQwRDZ18JnevhmR8CpDZdq/a93jCiy0KCal4K28pSxpGSQXoIle3yjSKyo iFQQhAiWEXiJyuV0o6WPxijh0CrpvRo4LUyundyty/7gwXjX1gT8w9I63HMGnqkpptdM MYz0i835l7eDjHCfix6q+SyPuPZreRzmuwXYVyOIn6F89u+PqNGKiOBnxofMLhXdjddm FMhMIpCSrTWDo4OD9X+kIR9FJnrW7eXs19Hu0Q3KOxheK+babkzdJEFav16wgr5y+S91 rpwA== 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=b6r8YpM7X+3+uUxjfZP9r0LlEaT6XJptMrPUEsggd2o=; fh=S5lU+5oA1lU1/dqUpocJfO2IiMMhqjs9Mn7C/HWAmhM=; b=SQhv3MiBV8indjrD0KSWNVPB3XlgQawlsBzamNltc9Gj80T2/fFseZboe43e7EFT2V l+s8H9MSVyvCSIrx75CM8ZZP45+zhAy0N33t02WfbzJ/q3tpGfmEBDjsR/H1Pjl4GwLh UwGm7+WXMhOLNUUvSsmO7Ew793UsQsBQksm8Hk6PO3WIS5I6/qWzRQAre9hmdAji9zoe wLyJ14wI9RKACK9MJwYV+ZidQR9XsGa7glLXggyXdcNN02im2cifKhbxqh3la+0TVQoA JxuVNH6rh9bItbggihx5fFtcraw6BIqnp3t4ZgH/eos26+7d3L06VG9f0Cp17FFTazyc ELWg==; 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=20251104; t=1779427686; x=1780032486; 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=b6r8YpM7X+3+uUxjfZP9r0LlEaT6XJptMrPUEsggd2o=; b=r/iVz6lUjCrum3INA4pxzwcrt+BNaBG0ZlIQMIdg8dObPa4b4GWe8LUVLseterkSjS DQLmCuLIOqBX4UGPjlj3HThLfm9FlRknG5csJyNYraOysujRAYy1bYT78eCvZx6KrMFf Ff46lF0vbHKomSIT2JMuUYznIecTN9EK0nGjoM+etBYR/g5Jq7OC9h8FOJ+rvOAbz1gK 5u/7Ixap2+4u/p4XGQwKF1OyG3vqukOdBhm/aNM7nOTVeCPXPsV7Z9JBwCU6r6S9W+Qs PEAK/gkYjrZDJwDCb0HphP7Y6XSHaXX9XTbTZgPk3kp1XsW51rdKsx/S8n+BM/dKvB7u PjFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779427686; x=1780032486; 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=b6r8YpM7X+3+uUxjfZP9r0LlEaT6XJptMrPUEsggd2o=; b=jEXImK4Gi6uOUoDqyQaATSKP6a31BSHvyfP8RcprK6i1sbFRzToIZTKBqI2ILxN0Sy bCHOHpfbGTfR9aF7ueaqb3Mzu+XtIpnlC9iPx2/a9DGluhgCoSKi0U2Vuqr3p6myGOzM 1B/jaS/LaDAs+/Uv7LCTTJbXJ3DHeLenRRYiwpFA+cK8Fj2DHKKHWMKwZv28sf75AjFz 07YvNkNLT3Mu0pwaC9q85PFdhxWXwu1MCm5Hib84Rbzb6HQbGxMynJjNbnj3UzyGeqQE vKIKUBVNsIhTCuh4FvOaLNWo7y/CfxAIgUxaWWj7Rb6PHwmez93PE6JwZYWBTukeO8yk LsiQ== X-Forwarded-Encrypted: i=1; AFNElJ+B/qwjASRn5oxmS3ojVuFL+yuFqklfau+ky5hMljHwJoGDwnHGbpESgR85AYuN5QNW6+cbWbPHM4+ubwpy@lists.postgresql.org X-Gm-Message-State: AOJu0Yx5spQ3gjmdc8jdAG7CEldnaFfqzyoqnQCZgoAwk7WLwSK/l9Gq RXzXD6wZr6imsVxkcFXtkVGYphu2ZNUpvHazybhFaVltRZcHcvow7NmoBfZowT+T+/7lhWWoYuN mr+nJIEGpnSIY/CL66tL9S2vfbNjpNQc= X-Gm-Gg: Acq92OFAeKuEFHvdtgtZgC4tLXwoaDsIFMnIl2Y6mw00w8rzPUI4K2SEXwFKYEuQl7H IvYfr39pPD5yanTl2ppUHMXA89w1zRSyNhtS1fwg+5zA/OEIOsu6hrHlya1w7qR0NDQBmrpOKHX YB0M/P3ejXnytc8tnPEBV7uFKzGPGgq3C5WoKZMhDe/1esmS3zxIAYoEwJbDBRCiHEs0/pCq1kG Lp4xiQ8J6cbxVbB7gKABidbXA2KnWRZgB2v3w4ig9ICS1IN4+DFysXAfbTWkhdVn1LhORMP/vMq 5i+rjVMmUxGVrupgu9msTh9UTkZcqGOktCBspddK0g== X-Received: by 2002:a05:6820:208b:b0:69b:9093:e3c7 with SMTP id 006d021491bc7-69d7ec26b15mr1162380eaf.39.1779427686308; Thu, 21 May 2026 22:28:06 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Fujii Masao Date: Fri, 22 May 2026 14:27:54 +0900 X-Gm-Features: AVHnY4L3chIBTPfQtJsjF7zdipQwF9QpOO2AIz1l2RV0-2XjX2rlhIWDQ6G1LFA Message-ID: Subject: Re: pg_createsubscriber: Fix incorrect handling of cleanup flags To: Nisha Moond Cc: Peter Smith , "David G. Johnston" , 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 Tue, May 12, 2026 at 7:56=E2=80=AFPM Nisha Moond wrote: > Let me first briefly explain why this patch still holds: > The made_publication and made_replslot are publisher-side cleanup > flags. They are checked only in cleanup_objects_atexit(), which > executes at most once and connects to the publisher to remove objects > created by the tool. They have no inherent relationship to the > subscriber. > That said, check_and_drop_publications() always operates on the > subscriber, so resetting made_publication because of a failure on the > subscriber side, when that same flag is later used for publisher-side > cleanup, does not seem correct to me as it could incorrectly skip the > required cleanup. A failure on one server should not affect cleanup > decisions for another server. The same is true for the made_replslot > flag in respective code. > > After looking further, I noticed that since a recent commit > 85ddcc2[3], check_and_drop_publications() also reads made_publication > to decide whether the subscriber-side inherited publication should be > dropped or preserved. In that sense, the dual usage of the flag looks > valid and continues to work correctly with my patch. > > Also, after checking on pg_head, I don=E2=80=99t think there is a possibi= lity > of a double-drop on the subscriber side. Either all publications are > dropped in the if (drop_all_pubs) block when "--remove=3Dpublications" > is specified, or by default the else block drops only dbinfo->pubname > (the FOR ALL TABLES publication). The if (made_publication) condition > simply guards against dropping a pre-existing publication. I don=E2=80=99= t see > an issue there, but please let me know if I=E2=80=99m missing something. Thanks for the analysis of this issue! Barring any objections, I will commit the patch and backpatch it to v17. Regards, --=20 Fujii Masao