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 1vzR3c-0010EX-2u for pgsql-hackers@arkaria.postgresql.org; Mon, 09 Mar 2026 03:13:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vzR3b-00DIdb-16 for pgsql-hackers@arkaria.postgresql.org; Mon, 09 Mar 2026 03:13:23 +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 1vzR3b-00DIdT-05 for pgsql-hackers@lists.postgresql.org; Mon, 09 Mar 2026 03:13:23 +0000 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vzR3Z-00000001jDv-1JK5 for pgsql-hackers@lists.postgresql.org; Mon, 09 Mar 2026 03:13:23 +0000 Received: by mail-pj1-x1034.google.com with SMTP id 98e67ed59e1d1-35994d84c6dso3051283a91.2 for ; Sun, 08 Mar 2026 20:13:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1773025998; cv=none; d=google.com; s=arc-20240605; b=I+Mzacns7/ai7s+JvEnvfIrE5Rfg4q1exUhMDtDw7QMxhnp5lbcpS331HB0gsQmoIP yP7EJxbW7gC3bnKcEvXbviMgs+uRGrZHxaJhAmSZ23dXLfqGtJDVudvCF9AqK7keAlh9 rtrLJYfmYcsUBLVnt97Mm2rqJlN2eYccVCimh5ZpRWw4wO2ZcNAVjtg/rEPNmQopgHQM dqU7qsHEjLsZcKbWk7b6N8nQBgZeF6qVfokDtElEVFiwOyK3OwNVTlp5TLTeVGwNWi+J VMAQNusufi+q6jAdSAuLL4TFiZgmCPHS/v6eRhHZHJxewVB6A1nCxJ9GKNACzMB9Qgac 23VA== 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=tCuu1YeXLHHzj1PKOdNF9gEJHgrhi20GHSQUIyW9pQc=; fh=huw3ykeBZmhJnxXwNn04D7wbon7SjeYP71lT+J+5dj8=; b=jhIAyGmotoaK4Xi68Psl7U7d0ao4q7LE1DRqJsDcXSlZPfvnfVY+FLn3P1FYL8U9Pt Mw0gje3utPsMiKcfOOzgyKvg9EsuoD5tLa2WC+MVKz8ZKCFF7awb/hjAfQyP9vcJDzXj 32c/CKbedUq364yMgQvmHAZfubWKXq/1nV6l0BeBSw7pg9WzIv0TTLJ43WAVrzvDxx0q Yb816POjutCIdoWmbdYfcrzcvgUEhlesbj9zLEPlAVIDxdy7k8RXe3+ZmyKek7vkzj6G oRGwBgyRPI8DRcoFJLjCAXSeMuCoqcUlLBcD/EMKINQ8BwcK88GUc+faHqnHMmY8Phr3 cQ5w==; 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=20230601; t=1773025998; x=1773630798; 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=tCuu1YeXLHHzj1PKOdNF9gEJHgrhi20GHSQUIyW9pQc=; b=OLP3+x72LDbAw2h7/IXomzuHL0XJ6V1/Sb5aWAgWtfbElg7oDxAsEbJ50tXFHQ2Ock gZEwI8KUrBBBZxt54+ZdacB2zATo605okYpefVomgYNiwR/dVJEyxp8lRRgAQKU4EdKL pt35UxYr/o+BzOdhm+dPJIiO2uFH9qiZSklEfK/lykUgV7UxZO4eUWLp1fy5yTkGVeue XWYzhroAxnwEob23gspoeyqIxAy+3Hwj8aH9tz/xrmsAu4JTkTyXd2OUOrNOdsP2EIgT kYTL0QhaFUZaIo+HEc6E7qWrvs3qoKwllwHfl04zui9fY0xriEjeYc3Kn2PObGwjoo/P p1Ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773025998; x=1773630798; 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=tCuu1YeXLHHzj1PKOdNF9gEJHgrhi20GHSQUIyW9pQc=; b=WmL+DmjBGEt0ICSmOoHJSyozPr/Cr5Gi2yF85Q+1no9VWQP4bshnAUll3ZcdUSt+AB e81KfG87m0wwIE6c275XbXXiz/RrNgKHah7uY1vfX9BcFwpi7YvFkLtCHQzgtNHYLQBf aWT7gETKClB+tkocYzsy4ixR4r/aWVmpsvp5UCZUu2QDOxVj//ANcv8aoKZExIBBfIll N1m2My8EfxVgJv+rBVul3NXtGlkcdLAs2iMVHnQ7IGP0eNI0IhmSHqrECkH892B/DkOE BK6oe0Ti5WCl/FNTPm74QrN/9PLKxAgNRwe5IUojlyBe6Fexj/N+ZQwc+4/ZZTUgngjs Ucpw== X-Forwarded-Encrypted: i=1; AJvYcCXpWcyRi1w2+wllgRBBoU9Td8aCvxmIVs46D/W4lxKJAGMfD3Hu9rG16wbECnmV8CL8UGBxagXO8XkamJI0@lists.postgresql.org X-Gm-Message-State: AOJu0YzKy6qMBVM64oaEE/lcsMeY/gFYSYi/4CVPrXddt4KECZAwdjWf id9u+Hbnq8Re3ExH1glv7+sGrUEGHLDmWSfbDC1oIIBY7H2gwE+fn+Dwy4PPYuE8h2er1xyVwhw v+gFf03oBIv8S2QgxXLpgGK/mzqn7IVk= X-Gm-Gg: ATEYQzxEiNPHzXOaB3+IRh9QPoWt6VU7HS46/5OhxfRbDF0ygZiqHu6vMQOFg5zOBh9 eabrWqn5jOMuoz7h1WIncmck1n0bXQIjV9kI5zQGI/9XZx0+2agEP48Qb1oRxzO91FvC3Rgp6tW 9ZL25XAYKKZn9Smp8dRt7mGQ4wsMLI20cSGdQ8akYofuqdXrSLM1jwEm7R9fL51QCk8kOXYhQ8q MoYQqmhbdExp2WtUNYDEL/6udme3A0UBuyaKKXBi/LHke/3KFcuO6bZoCcWkEfTqcjhRkDMhK5p Gh+u1H8LqLzwGFg5/z3Nvzqyb5ldmY/PObTfBvx1LqMKtUEd5ABG8Q== X-Received: by 2002:a17:90a:d2ce:b0:34a:8c77:d37b with SMTP id 98e67ed59e1d1-359be3475cemr8629526a91.16.1773025998431; Sun, 08 Mar 2026 20:13:18 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: shveta malik Date: Mon, 9 Mar 2026 08:43:06 +0530 X-Gm-Features: AaiRm53-MDGkdwMhCXL1fnDds308UbeBH8UqY0LX0Vlg-BDChtzAZs6t6rEWwkc Message-ID: Subject: Re: [PATCH] Support automatic sequence replication To: "Zhijie Hou (Fujitsu)" Cc: Amit Kapila , Ajin Cherian , "Hayato Kuroda (Fujitsu)" , Ashutosh Sharma , PostgreSQL Hackers , shveta malik 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 Fri, Mar 6, 2026 at 10:55=E2=80=AFAM shveta malik wrote: > > On Thu, Mar 5, 2026 at 5:04=E2=80=AFPM Zhijie Hou (Fujitsu) > wrote: > > > > > > Thanks for catching this, I changed it to check the increment before re= porting warning. > > > > Thanks! I have changed comments atop sequencesync.c to get rid of old > implementation details (worker dependency upon INIT state) and > rephrased a little bit. Please take it if you find it okay. Attaching > patch as txt file. It is a top-up for 0001. > No major concerns on 001, just a few trivial things. Do these only if you feel okay about these. 1) copy_sequence(): + (void) GetSubscriptionRelState(MySubscription->oid, + RelationGetRelid(sequence_rel), + &local_page_lsn); IIUC, we only need it to get local_page_lsn which is used at the end of copy_sequence(). Shall we move fetching it towards the end. That way if validate_seqsync_state() returns copy-not-allowed, then there is no need to even do 'GetSubscriptionRelState'. 2) validate_seqsync_state() and get_and_validate_seq_info() are a bit confusing (at least to me). They have similar names but serve different purposes. Would it make sense to rename the new function validate_seqsync_state() to check_seq_privileges_and_drift()? 3) I feel that the section below in the doc needs some change to briefly mention the role of the SeqSync worker, at least at a high level, to indicate that it is running to perform incremental synchronization already. Thoughts? --------- 29.7.2. Refreshing Out-of-Sync Sequences Subscriber sequence values can become out of sync as the publisher advances them. To detect this, compare the pg_subscription_rel.srsublsn on the subscriber with the page_lsn obtained from the pg_get_sequence_data function for the sequence on the publisher. Then run ALTER SUBSCRIPTION ... REFRESH SEQUENCES to re-synchronize if necessary. --------- thanks Shveta