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 1wkbD8-000ldC-2B for pgsql-hackers@arkaria.postgresql.org; Fri, 17 Jul 2026 05:34:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wkbD6-00G2Tx-2z for pgsql-hackers@arkaria.postgresql.org; Fri, 17 Jul 2026 05:34:08 +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 1wkbD6-00G2Tp-24 for pgsql-hackers@lists.postgresql.org; Fri, 17 Jul 2026 05:34:08 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wkbD0-00000000iD4-3X6m for pgsql-hackers@postgresql.org; Fri, 17 Jul 2026 05:34:08 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.18.1/8.18.1) with ESMTP id 66H5XvlA3848536; Fri, 17 Jul 2026 01:33:57 -0400 From: Tom Lane To: vignesh C cc: Noah Misch , Amit Kapila , pgsql-hackers@postgresql.org Subject: Re: sequencesync worker race with REFRESH SEQUENCES In-reply-to: References: <20260710045217.f0.noahmisch@microsoft.com> <20260715025809.cd.noahmisch@microsoft.com> <20260715115601.fd.noahmisch@microsoft.com> <3614163.1784163070@sss.pgh.pa.us> Comments: In-reply-to vignesh C message dated "Fri, 17 Jul 2026 10:47:08 +0530" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3848534.1784266437.1@sss.pgh.pa.us> Date: Fri, 17 Jul 2026 01:33:57 -0400 Message-ID: <3848535.1784266437@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk [ please, please, please: proper bottom-quoting does not mean to quote the entire damn thread and then add a few lines of new material. The point of quoting is just to *briefly* remind readers of the topic. ] vignesh C writes: > While reviewing this further, I noticed another scenario. After the > sequence synchronization worker marks all sequences as READY, if we > pause execution at report_sequence_errors(), an ALTER SUBSCRIPTION ... > REFRESH SEQUENCES can still fail. This means that checking > pg_subscription_rel and verifying that all sequences are in the READY > state is not sufficient. We also need to ensure that the sequence > synchronization worker itself has exited before proceeding, since it > may still be running even after updating the state to READY. I've > updated the test accordingly to include this additional check. I grow even more skeptical that f38afa4ab was a good idea. It seems inevitable that it will cause annoying failures in the field. I think that our goal here needs to be to fix the backend, not band-aid these existing, always-worked-before test cases. Could we, on detecting the race condition problem, wait awhile to see if it resolves? Or simply exit and let the REFRESH be a no-op? regards, tom lane