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 1vspXY-0037L8-0m for pgsql-hackers@arkaria.postgresql.org; Wed, 18 Feb 2026 21:57:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vspXX-000XQo-0V for pgsql-hackers@arkaria.postgresql.org; Wed, 18 Feb 2026 21:56:59 +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 1vspXW-000XQg-2r for pgsql-hackers@lists.postgresql.org; Wed, 18 Feb 2026 21:56:58 +0000 Received: from mail-qt1-x82b.google.com ([2607:f8b0:4864:20::82b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vspXT-000000002IT-3tTD for pgsql-hackers@lists.postgresql.org; Wed, 18 Feb 2026 21:56:57 +0000 Received: by mail-qt1-x82b.google.com with SMTP id d75a77b69052e-506c02ec1b3so4131351cf.0 for ; Wed, 18 Feb 2026 13:56:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1771451816; cv=none; d=google.com; s=arc-20240605; b=gCwWePUJK3q1lg51O47rkXo6WfzuEeEFtIS64mBja6aiUapRzBDgkQHrFEJvkM+VUg +Wqe++WU1HDt6Op/fN1swyRh+/CSWIT5NoAQ1Wd8gssYqBvAYSbCE4hc93zunYu3oDXX lu1df9kt6csy2Fs9e5LdHQRYz8ax5GUluCrY5IabM0aR/g3QtXSx84M2uIn1ptJPOMo4 jvsrKDyB7Vjb+sc9pOAQK0PoIwF355mUqRGCmu9uhNwkc+H03fKpG6aFUyfBc4w/A3K0 UIuWXA/Hdl6vq0WW8oa22ZjR3NPFDM+PUUYZex2T4p7OyOTcVGEcviGbSyvnj6WqodbD ZW3g== 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=/tyF4T9nkdvYjWad8iYCnD4TBbHUlu6/OmSXNhsAn3A=; fh=lPXzJtG+ww0Zdi8mg4skgssKBUcGXOiHfBQWAqQN02A=; b=a7uw+y9nGGvEWpAGQMtgUFy5+IC8xXjf+rDdqd9JmxTniBM3KokqSHU3Xsp2ASNSFy FJiVbOuQobjtFdoSxnsckr8SeVWXRT/odvZ0curjig/2teqK0qUxV3cE17WSlWbbin7a 2KtB5cytxSVWZoAPaKjC/IxiGGkNr18KnbQd1THuW9jzAYS2aaUSJrh5Q1qgHbaL9WNu wUVMzf4mp+yengiHiYiUOE+pvMgejJ7SEpe31Vq0kPDTG39efTxfOcHVmsgt1A0zufgD a/LmuKpVwcF7EFTIPl77MF5beWTAGPIzAF+AZ8oZYTyMjfc1st2zpCNAiGrACTnsPwZb WntA==; 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=1771451816; x=1772056616; 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=/tyF4T9nkdvYjWad8iYCnD4TBbHUlu6/OmSXNhsAn3A=; b=bEF4l9KV/Z0Co/vx4NrRzvD+08nWkU8amtG/M5SLLlooTwPUabq3ok+Syhb4VGRNst ufvtjgE9ni4WLgQg/P41O5Yo2fXGSyQAZHSBbcXOaKKFokWrwGjiqc9SAQFMydurYjwo q9ogV/1OZPKZZm/lLe4LSiCr4na+Kid3Sgpax9v8Gi0aagig6qSgx3qA18KAexyuQIAs wIE6Vtc04cPHXaKQb63Iy75F+dSrKE8vSoAZG1YXcae6L8UBSLNzP1tCujvDF7DTR+rS rvmOWOndnSI4SsM2CMIwWnVR08Sfnqihc3aqd0TXsRQkID+T8ggtNqvWaLgzrrs/xLnc U1aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771451816; x=1772056616; 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=/tyF4T9nkdvYjWad8iYCnD4TBbHUlu6/OmSXNhsAn3A=; b=B43loqYidRuB/f3skJrDGtfB8wnZJctZir/yuVzwVHlp74OJ1z8ApDQUG+cqZfTjyc w2atOwJZAZfSppUAlZ+EG4zjGcSZqYfQm5KEIp/St+o/M6BcNuZn7ftg5Ul0DcvDvqc5 apLR2YQhU/eag+7/9uWP5cFxnAuSiEjoZEMk8dqfYkEsGpr+qbG7/dt1Js84DZPFd4pe IKu5VaCtpuIl4uCWaMkSxuyYCP7Ne28Jxc0vXF7UPBmcC3nsB7roO1Y1sjMMRbF0uKoA jHvhtvPneVpUptfogRCkpDZIpiwuUdn/uLQUqadntT63MEJh1a/Dy80T6i9qcudn6zT4 hVFg== X-Forwarded-Encrypted: i=1; AJvYcCXxGU4rDsErhURe3g6o6cYOdSzG96zege221n6Bd2mp7A0n1qs0QQIffK3g/CPKi+yCABNa2X5XJikHuD/q@lists.postgresql.org X-Gm-Message-State: AOJu0Yz7aG8RzNGiyO/HyWHWfQfSVA1QfA+MsHaLAQCrLLF/WcAK6+O9 M8wjL5xtNFwTdAnwX1uA0+jGeRu3UxlJeY/R78xAgGTr6bl419TxnetVhvjcTO9B7Yq0Vrh+eg4 5mYQ6z92RC5cOfDOzp5th5+Fh8UQDX2k= X-Gm-Gg: AZuq6aI4zi3PYSc/6I4mKrGF55LYt+/fGUiJtnUfH2bJ4SMTThF98n0MUmlQAdfv4ij ldqyQAZvtWubqcl5YS12awgrI7SUiNPV6i/Q796cGU8Nl99wLHAEgNZDn5Dagsm0H+znIpB/NHN rYhrspbT4Lo6Ls0+Dn7oeZBBIoANy9S2cbPcBmPQ4gAl8eTEaphKNSzhLn+NselrLC0ftEvHw29 ncQkQWLz4Ju0gBHzkZBPKqBjpit3PvVLJbrEDyEURsunFTr34/2VTkhUJxQ3E5basTKjsCUAKQ5 T8qqZg7b X-Received: by 2002:a05:622a:113:b0:4ed:bc0a:88c3 with SMTP id d75a77b69052e-506e91fa0ebmr43615541cf.33.1771451816239; Wed, 18 Feb 2026 13:56:56 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Peter Smith Date: Thu, 19 Feb 2026 08:56:29 +1100 X-Gm-Features: AaiRm50ISUvCGA5GRSudFbiZ6Xz_zapWiEB8d9WwPN8A39HrwOmKhniOPb7Lrio Message-ID: Subject: Re: [PATCH] Support automatic sequence replication To: shveta malik Cc: Ajin Cherian , Ashutosh Sharma , PostgreSQL Hackers , Amit Kapila 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 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=94onc= e 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. =3D=3D=3D=3D=3D=3D Kind Regards, Peter Smith. Fujitsu Australia