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 1wie5b-000Kle-0r for pgsql-hackers@arkaria.postgresql.org; Sat, 11 Jul 2026 20:14:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wie5Z-00553R-1r for pgsql-hackers@arkaria.postgresql.org; Sat, 11 Jul 2026 20:14:18 +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 1wie5Z-00553I-0x for pgsql-hackers@lists.postgresql.org; Sat, 11 Jul 2026 20:14:18 +0000 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wie5X-00000000r5a-1K6C for pgsql-hackers@postgresql.org; Sat, 11 Jul 2026 20:14:17 +0000 Received: by mail-pj1-x102c.google.com with SMTP id 98e67ed59e1d1-381216921aaso2213276a91.1 for ; Sat, 11 Jul 2026 13:14:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; t=1783800853; x=1784405653; darn=postgresql.org; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:content-type:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=K5By6QddVGtEcDAwQHAq5V5095xbAU5F9sClZ1aucK4=; b=BPWuzXqkkE4OmVhZ4RQHzg502VP7ggL4c67SyWQ08ggEHRR5W5hEZuEi09ZoJ32DSc lncWmTwkE9hLJ7/CMBEHH9IgoFEzhhBFpEDg5iPB9GYalsqQiUSYma6kHKuL3McV7D33 CSoZXEeF9I3h7okXHpIcZFLjB8y6ePhXWnqNA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783800853; x=1784405653; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:content-type: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:content-type; bh=K5By6QddVGtEcDAwQHAq5V5095xbAU5F9sClZ1aucK4=; b=rakgAT7kIE5L3034mtRILqx7Bwg/dfo3+zvXA4wsi/YyAG58HelAUpBYDlhKSdCcEw yQ5iimjKCIn+gqdBztxATRccT5AjpZ6dqxrUz4p81SA8bqKBInY9Tqo+87RhYu5U+hLh ZL8wCvHj9Jjxzd9X90Z7sycBF4yssQ7ryH3bkYCo3MUmWR18AWtP45hhnDqWYkjAOiAC 6xafhOiek+nE9tZrsdRPbMH/fjvxzcQn2ALpx8pawsm4fyWdqENGP8xUenXguPO3YUc4 NJ+Z/iX+NrCcrI60Fe5Ly4AdQFSIw2F7ogVTZou/QjApJgWqQ4aDYI3B/gymzwQPOv8U 9Q/w== X-Forwarded-Encrypted: i=1; AHgh+RqKLDg6EAoKauFqWzljX77k6/z7oEtfIFIeAPVu+5XOpj4B7EOTal6VKe29okHasrziFxXve6RuOvuPuY2T@postgresql.org X-Gm-Message-State: AOJu0YzukjIWRkyvAYklB3mXlLq1t3473tku0MBGl9gCAfbKBGX2eINq ivP+NKhqVEEz9OHcVLv4U8hRg35vO2DoFWoiUmh/nVXEad36i6U26ox+gvavDNc0KQ== X-Gm-Gg: AfdE7cmDObwElW1u4LCscqgDbTppKwnq6Dfm8s8IUmXh/e0pOIoy7cwOFFR3Ngq2ykS CcP+AXjhradNqJRddealPQRO7xvFa245w4vp6UaGFvhk0NomzXnpRWr5MZmmJRmwMuGGxTz1RsT oVqFaLHaf3tVF3HkZ4IyF44Z2DU1wHtOeqyyr9WYqvnv9NVlRCnNPBY5BNUd2hnjOmzzehGH/MH IyDVTmZVaFXKh3yKkbnUCxrTHVlbNuC+HQ6hlRkhA/6DWyRZyL4MMTtS+ZcN3hPn3GV5ywknqZo Su4irCPKTkKIVui8awVmDMYmQ6wsVPsCn55KdvBOPgOMDvSDbYTRv3+r68JaA8O4FruvISw5Tbx iHCA/BWTCzTkQgIxPzHkFn7F2Oze1qYFY7L44z2vXPjwxLPe4N7V8CkSPZyxuY5st0/R/EeRoNY SR45qu8k/Cz7+pvpn77U92N2l47o8nq/VJrjCUR6vT48tkSylScRWg290= X-Received: by 2002:a17:90b:180a:b0:387:e0cb:c8db with SMTP id 98e67ed59e1d1-38dc77998d2mr3292056a91.36.1783800852960; Sat, 11 Jul 2026 13:14:12 -0700 (PDT) Received: from microsoft.com (c-73-15-160-255.hsd1.ca.comcast.net. [73.15.160.255]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-31189cd8234sm45649675eec.9.2026.07.11.13.14.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 11 Jul 2026 13:14:12 -0700 (PDT) Date: Sat, 11 Jul 2026 13:14:10 -0700 From: Noah Misch To: Amit Kapila Cc: vignesh21@gmail.com, pgsql-hackers@postgresql.org Subject: Re: sequencesync worker race with REFRESH SEQUENCES Message-ID: <20260711201410.4a.noahmisch@microsoft.com> References: <20260710045217.f0.noahmisch@microsoft.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.3.0 (2026-01-25) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, Jul 11, 2026 at 10:31:06AM +0530, Amit Kapila wrote: > On Fri, Jul 10, 2026 at 10:22 AM Noah Misch wrote: > > A Fable 5 review of logical replication of sequences found a way to get > > subscribed sequences into READY state despite the subscriber side having data > > older than the last REFRESH SEQUENCES. I'm attaching the test case it wrote. > > I reviewed the test, and I think it identifies a genuine defect. > > Good catch. We have following ways to fix: (a) As mentioned by > Kuroda-san, during REFRESH SEQUENCES command, if we detect that the > sequencesync worker is in progress, we can either make the command > wait till the sequencesync is finished, return ERROR suggesting > sequence sync already in-progress, or first stop the sequencesync > worker and then complete the command and let the worker restart after > REFRESH command is finished; (b) raise a WARNING+HINT for sequences > that are not in ready state as proposed by Vignesh. Shall we > additionally add a Note for user to ensure seuencesync worker is not > in-progress before REFRESH SEQUENCES command? > > Do you have any preference? I think WARNING+HINT should be sufficient > for users as this shouldn't be a common scenario but going the other > way is also fine. I haven't formed a preference, but I would use these principles to decide. Assume we eventually support continuous, WAL-decoded replication of sequences, not just snapshot replication. Which choice would make sequence replication behave most like table replication under the analogous concurrent actions? If it's an ERROR, I'd probably omit the doc note, since the ERROR would be clear and unsurprising. In general, there's no need to document everything that causes an error. Documentation is most useful when an error is surprising or affects how the user writes the application. If the command merely raises a WARNING, documentation becomes more important, because warnings are easy to overlook. That is also an argument against a WARNING: if the user must take action to avoid incorrect replicated state, it is risky to rely on the user noticing one. Does that help?