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 1vsvHz-008nOo-2T for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Feb 2026 04:05:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vsvHy-001gLf-1v for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Feb 2026 04:05:18 +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 1vsvHy-001gLX-0K for pgsql-hackers@lists.postgresql.org; Thu, 19 Feb 2026 04:05:18 +0000 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vsvHv-000000004l0-0jNq for pgsql-hackers@lists.postgresql.org; Thu, 19 Feb 2026 04:05:17 +0000 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-2a95bfdb31eso2002225ad.3 for ; Wed, 18 Feb 2026 20:05:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1771473915; cv=none; d=google.com; s=arc-20240605; b=OylfvZ5dqQ1BmC3lTaPEMP4P/oYL58ixDGClKsnoG4EVIVeyiI+JA/UU+imw80QdT6 mdXODdgQpN+UW9nEveIVBVCrsTUu4p9QeRaJzNiHrPS5CAGWwKW5586BJVbqZ3oH4LzV h27qjDNDG2pjbUHf7JPzbGw7DD9MIGgL/v6nC1X4F3G/WMvYVmqS2U8Fe09zwoAq8RZn FCQHh0iPx29NTr0HBI1mXQUFCxfEfpfLlLxbjpZq2oXcyA1C2wCLC3cGjRDjHSTL1JcC 3m3gYsxaNrmKJ1jKKWFNJfRQgw9cqRDV9xXAyTlnogGCPGug/ISoME+a5ZAV8+aU+4vm iFXA== 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=2lI6g0vd4FnIUhyBHrP3FbCbqsAvAeNKxwLopVRhTlA=; fh=2m81zfZrvW+eePEsSKjC/EjJD4oNpvLbo6OrtX4YRY8=; b=EAOWoLkNhAhpckKqEdLf6GOwFk80iNjBmPU/NMFUWz3e3uszMUqv701BouISZ+1STU lc5T4riS8sJufA13m/AB3EhimKu5uuiEt4J4qMlxgsLxDYP6UShxwwPRvwpqlMhHuAgP F7+X1SrinRZCswGzk3nHNF/NqXTT6QGHR438vONcoYjAFrigW9Xb+jO1MUX9UvYFD2kR Gic5q+kStGNZxQEwcNDuLLNtKQp6XFzpG+93DwtgD00eAgodkkQdzX5ofA7HS03DKGtR eEAxwzRRV7c2MbkyIrINmuqiBgL1mStEXijUIlTVtdosOHX4U4PoIdn0ZNsbeUyBC1Bz zqDw==; 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=1771473915; x=1772078715; 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=2lI6g0vd4FnIUhyBHrP3FbCbqsAvAeNKxwLopVRhTlA=; b=LpSMQ+2cuUm+nkQ9Y9glbcUSqYEvx+LmsTOKSDZGHUkQeOidDzpoFAGtK2INvY74QX m30vSYxlVVhwDYgwwpcRj81amd5AUrzz7BxRCO7Ye9dorHGYdIF5nxEIBhKwHUPJ0ail S667J+n2WFf+vT1NRTDscQNTvIEJeHaoeXas6YjzieTK9U+ywZI8/j+fBxF7pmLD8cKv M3x3ezAyiHbZrmefEOUM8f7y0Ix3l7D1a7OUyijc0i4V3EnSz27JG/PDKRgCU+7Le7n4 5oF3GOWGTfxeXWGT9ZtJ8AhrmpmDz5ruyn2c/LqsaqGHrbq4Kfije5sWcSUUKbvehnRz 70cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771473915; x=1772078715; 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=2lI6g0vd4FnIUhyBHrP3FbCbqsAvAeNKxwLopVRhTlA=; b=fQgdOF5PX11VHmAFN4t+tS/akBac3CwTep4/2vvsdjb9md7WlQvwnNuD2d4lpEv8o0 yrBg5jpODEnDv2X6iJiWZAJ7wZcwxMMLZHAYJe3fgWSqfHNwBWX3PerdPeUNnvZbKi4P AZEim6dpg7JPfNqLHR/LOeEid+xNJW7DUlc7+gOA9vmvx4n862Q6cO6mSHKXhAdZ1sUq W4IrPnr2h8npASD8R2/xquKU6nu2JgMSP2N/ZN+ztXdmILl15UkBJvjkq5Vpq0JVo4eK 1Rj+GuLwoxodjt2lch0Vzegj8dxAt5n0rscZtHC4fj1hVXhdmHUn8BlLnyy8leuJMkue rDDA== X-Forwarded-Encrypted: i=1; AJvYcCVc+QIQiplGq29O/1rMdR2tMy1GSypc4RbDlbHM039AuSwOpMD+hD6CVlN8ojIrNha59zAbRWM+uYM3UmzG@lists.postgresql.org X-Gm-Message-State: AOJu0YxlfS2XGIPqvsa9ZxzOOv/eqgIRRuZuQQjFn96iyZob9vHq+/Ad ZKPdR6nl6RLsZ+NVisvXIIJx2hcjCkwgITytnI8jp4+V7I7K6K55WmuM2kUHabbzM1vsFrcHxCQ B1QW4UfnoIEkLK7IAGMPYaW/ySo+yShE= X-Gm-Gg: AZuq6aLuQF809ZKhM7iG48ACqj9Lx8IdCq8iydFUW0S4RlFYe6bj4gV3VxdZMK9D+kV ZpwbnlFALDYTUZ2+kQDxA5P1Im4+IsDyzi3ceOfH695LFU4ogUb7by/hf82D5+JPlJohfKu+VIV k/Qndgg51dV0BTs9nxBV76c1oq8xCXkrYGtetI7rP7l0TtSqG/SqSjhk3a+e86hJ4nLzirR3Oi5 hFBuJcrZP/n7OJHYHD/SpoqkHDWrEp/HHXt2zNm8t+v58aTIg0wddmcAKN3nFgxkG3yeZuDgoRl 2nclYD5g+DpwLU6MVeIuv/Hat9hKB6Ix1ywSBo9T13vAOYrz9yI= X-Received: by 2002:a17:902:ebd2:b0:2a9:4bd9:bba1 with SMTP id d9443c01a7336-2ad5b170e36mr14128095ad.52.1771473914598; Wed, 18 Feb 2026 20:05:14 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: shveta malik Date: Thu, 19 Feb 2026 09:35:03 +0530 X-Gm-Features: AaiRm52ZC6eX9_j_gXqU_vjJc1i9SeAzQupOq25rpt_vDWuInq2ox35ie6Xjic4 Message-ID: Subject: Re: [PATCH] Support automatic sequence replication To: Peter Smith Cc: Ajin Cherian , Ashutosh Sharma , PostgreSQL Hackers , Amit Kapila , 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 Thu, Feb 19, 2026 at 3:26=E2=80=AFAM Peter Smith = wrote: > > On Wed, Feb 18, 2026 at 9:05=E2=80=AFPM shveta malik wrote: > > > ... > > 3) > > I noticed that copy_sequences is invoked twice per sync cycle=E2=80=94o= nce for > > sequences in the INIT state, and once for sequences in the READY state > > to detect drift. This means we ping the primary twice during each sync > > cycle. We should consider combining this logic into a single > > copy_sequences call. Since we already have the state information > > (INIT, READY, etc.) for each local sequence, copy_sequences can > > internally check the current state and decide whether to transition a > > sequence to READY based on its previous state. This approach would > > allow us to fetch all required information from the primary in a > > single call. > > > > I also think that we do not even need to mention the states here and > > we can give a single message instead of 2: > > DEBUG: logical replication sequence synchronization for subscription > > "sub1" - for sequences in INIT state batch #1 =3D 5 attempted, 5 > > succeeded, 0 mismatched, 0 insufficient permission, 0 missing from > > publisher, 0 skipped, 0 no drift > > DEBUG: logical replication sequence synchronization for subscription > > "sub1" - for sequences in READY state batch #1 =3D 5 attempted, 0 > > succeeded, 0 mismatched, 0 insufficient permission, 0 missing from > > publisher, 0 skipped, 5 no drift > > > > Those are DEBUG1 messages, not LOG messages, so I think the primary > goal is to ensure that they are full of useful information to help > debugging. Knowing the prior state information means we know that the > "drift" logic was needed when deciding to sync or not. > > If message volume can be reduced without any loss of debugging > usefulness, then great, but we need to take care not to throw the baby > out with the bath water. > > If message volume is a problem, then maybe that should be addressed by > using more log levels DEBUG1,DEBUG2,DEBUG3,... etc. > I am not totally against it, but I don=E2=80=99t find it particularly usefu= l to dump the state (INIT, READY), since we already log exactly which sequences were updated individually (see below). The output below covers both cases=E2=80=94sequences with drift and those in the INIT state.= We also include the =E2=80=9Cno drift=E2=80=9D count. So all of these effectiv= ely summarizes the overall status. logical replication sync for subscription "sub2", sequence "public.myseq1" has been updated logical replication sync for subscription "sub2", sequence "public.myseq2" has been updated Even if we plan to retain multiple messages for INIT vs READY, I guess, with copy_sequences() now suggested to be called only once irrespective of 'state' will make it further tricky to separate out these log messages for INIT and READY. But let's see. > I think it is useful to discuss how much DEBUG information is > required. However, I would like to know if this is related to the > patch being discussed or a case in HEAD? If later, then it is better > to discuss it separately and address it as a separate patch if > required. Amit, this is related to the new patch only. thanks Shveta