RE: Logical Replication of sequences

2025-09-03 Thread Hayato Kuroda (Fujitsu)
Dear Vignesh, Thanks for updating the patch. Few comments: 01. ``` /* Find the leader apply worker and signal it. */ logicalrep_worker_wakeup(MyLogicalRepWorker->subid, InvalidOid); ``` Sequencesync worker does not need to send a signal to the apply worker. Should we skip in the c

RE: Logical Replication of sequences

2025-08-28 Thread Hayato Kuroda (Fujitsu)
Dear Vignesh, Thanks for updating the patch. Below are my comments. 01. ``` /* Relation is either a sequence or a table */ relkind = get_rel_relkind(subrel->srrelid); if (relkind != RELKIND_SEQUENCE) continue; ``` Can you up

RE: Logical Replication of sequences

2025-08-28 Thread Hayato Kuroda (Fujitsu)
Dear Shveta, > Say we have triggered REFRESH on sub, and when seq-sync worker is in > copy_sequences() where it has retrieved the local sequence using > seqname while it has not locked the sequence-relation yet, if > meanwhile we alter sequence and change its name, seq-sync worker ends > up syncin

Re: Logical Replication of sequences

2025-08-25 Thread shveta malik
On Thu, Aug 21, 2025 at 10:08 PM vignesh C wrote: > > I have also addressed all the comments from [1] in the attached > v20250823 version patch. > [1] - > https://www.postgresql.org/message-id/CAA4eK1%2BoVQW8oP%3DLo1X8qac6dzg-fgGQ6R_F_psfokUEqe%2Ba6w%40mail.gmail.com > Thank You for the patches

Re: Logical Replication of sequences

2025-08-21 Thread Amit Kapila
On Thu, Aug 21, 2025 at 10:52 PM Masahiko Sawada wrote: > > On Wed, Aug 20, 2025 at 9:04 PM Amit Kapila wrote: > > > > On Wed, Aug 20, 2025 at 11:00 PM Masahiko Sawada > > wrote: > > > > > > On Tue, Aug 19, 2025 at 9:14 PM Amit Kapila > > > wrote: > > > > > > > > If so, I don't think we can d

Re: Logical Replication of sequences

2025-08-21 Thread Masahiko Sawada
On Wed, Aug 20, 2025 at 9:04 PM Amit Kapila wrote: > > On Wed, Aug 20, 2025 at 11:00 PM Masahiko Sawada > wrote: > > > > On Tue, Aug 19, 2025 at 9:14 PM Amit Kapila wrote: > > > > > > If so, I don't think we can do much with the design > > > choice we made. During DDL replication of sequences,

Re: Logical Replication of sequences

2025-08-20 Thread shveta malik
On Wed, Aug 20, 2025 at 2:25 PM vignesh C wrote: > > On Tue, 19 Aug 2025 at 23:33, Masahiko Sawada wrote: > > > > I imagined something like case 2. For logical replication of tables, > > if we support DDL replication (i.e., CREATE/ALTER/DROP TABLE), all > > changes the apply worker executes are s

Re: Logical Replication of sequences

2025-08-20 Thread Amit Kapila
On Wed, Aug 20, 2025 at 11:00 PM Masahiko Sawada wrote: > > On Tue, Aug 19, 2025 at 9:14 PM Amit Kapila wrote: > > > > If so, I don't think we can do much with the design > > choice we made. During DDL replication of sequences, we need to > > consider it as a conflict. > > > > BTW, note that the

Re: Logical Replication of sequences

2025-08-20 Thread Masahiko Sawada
On Tue, Aug 19, 2025 at 9:14 PM Amit Kapila wrote: > > On Tue, Aug 19, 2025 at 11:33 PM Masahiko Sawada > wrote: > > > > On Tue, Aug 19, 2025 at 1:44 AM vignesh C wrote: > > > > > > > > > Case 2: Sequence value Conflict While Applying DDL Changes(Future patch) > > > > > > Example: > > > -- Publ

Re: Logical Replication of sequences

2025-08-20 Thread Amit Kapila
On Mon, Aug 18, 2025 at 3:36 PM vignesh C wrote: > > Thanks for the comments, the updated version has the changes for the same. > I wanted to first discuss a few design points. The patch implements "ALTER SUBSCRIPTION ... REFRESH PUBLICATION SEQUENCES" such that it copies the existing sequences v

Re: Logical Replication of sequences

2025-08-20 Thread vignesh C
On Tue, 19 Aug 2025 at 23:33, Masahiko Sawada wrote: > > I imagined something like case 2. For logical replication of tables, > if we support DDL replication (i.e., CREATE/ALTER/DROP TABLE), all > changes the apply worker executes are serialized in commit LSN order. > Therefore, users would not ha

Re: Logical Replication of sequences

2025-08-19 Thread Amit Kapila
On Tue, Aug 19, 2025 at 11:33 PM Masahiko Sawada wrote: > > On Tue, Aug 19, 2025 at 1:44 AM vignesh C wrote: > > > > > > Case 2: Sequence value Conflict While Applying DDL Changes(Future patch) > > > > Example: > > -- Publisher > > CREATE SEQUENCE s1 MINVALUE 10 MAXVALUE 20; > > SELECT nextval('s

Re: Logical Replication of sequences

2025-08-19 Thread Masahiko Sawada
On Tue, Aug 19, 2025 at 1:44 AM vignesh C wrote: > > On Tue, 19 Aug 2025 at 06:47, Masahiko Sawada wrote: > > > > On Mon, Aug 18, 2025 at 4:21 PM Masahiko Sawada > > wrote: > > > > > > For example, if a sequence is dropped > > > on the publisher, the subscriber would encounter synchronization >

Re: Logical Replication of sequences

2025-08-19 Thread vignesh C
On Tue, 19 Aug 2025 at 06:47, Masahiko Sawada wrote: > > On Mon, Aug 18, 2025 at 4:21 PM Masahiko Sawada wrote: > > > > For example, if a sequence is dropped > > on the publisher, the subscriber would encounter synchronization > > failures unless the DROP SEQUENCE is properly applied. > > This ex

Re: Logical Replication of sequences

2025-08-18 Thread Masahiko Sawada
On Mon, Aug 18, 2025 at 4:21 PM Masahiko Sawada wrote: > > For example, if a sequence is dropped > on the publisher, the subscriber would encounter synchronization > failures unless the DROP SEQUENCE is properly applied. This example is wrong. It seems DROP SEQUENCE works but we might have proble

Re: Logical Replication of sequences

2025-08-18 Thread Masahiko Sawada
On Mon, Aug 18, 2025 at 2:13 AM vignesh C wrote: > > On Sat, 16 Aug 2025 at 14:15, Masahiko Sawada wrote: > > > > As I understand it, the logical replication of sequences implemented > > by these patches shares the same user interface as table replication > > (ut

Re: Logical Replication of sequences

2025-08-18 Thread vignesh C
On Sat, 16 Aug 2025 at 14:15, Masahiko Sawada wrote: > > As I understand it, the logical replication of sequences implemented > by these patches shares the same user interface as table replication > (utilizing CREATE PUBLICATION and CREATE SUBSCRIPTION commands for > configuration

Re: Logical Replication of sequences

2025-08-16 Thread Masahiko Sawada
llPublicationRelations, > >GetPublicationRelationsForAll, > >GetPublicationRelationsForAllTablesSequences > > Modified it to GetAllPublicationRelations > > Please find my response for the comments from [2]: > >patch-0005: sequencesync.c > >+ aclresult = pg_class_a

RE: Logical Replication of sequences

2025-08-15 Thread Hayato Kuroda (Fujitsu)
Dear Vignesh, Thanks for updating the patch. Here are my small comments: 01. Per pgindent report, publicationcmds.c should be fixed. 02. ``` + ScanKeyInit(&skey[1], + Anum_pg_subscription_rel_srsubstate, + BTEqualStrategyNumber, F

Re: Logical Replication of sequences

2025-08-06 Thread shveta malik
On Wed, Aug 6, 2025 at 4:29 PM shveta malik wrote: > > On Wed, Aug 6, 2025 at 2:28 PM vignesh C wrote: > > > > The attached v20250806 version patch has the changes for the same. > > > > Thank You for the patches. Please find a few comments: > > 1) > * If 'resync_all_sequences' is false: > *

Re: Logical Replication of sequences

2025-08-06 Thread Nisha Moond
On Wed, Aug 6, 2025 at 2:28 PM vignesh C wrote: > > > The attached v20250806 version patch has the changes for the same. > Thank You for the patches. patch-0005: sequencesync.c + aclresult = pg_class_aclcheck(RelationGetRelid(sequence_rel), GetUserId(), + ACL_UPDATE); + if (aclresult != ACLCHEC

Re: Logical Replication of sequences

2025-08-06 Thread shveta malik
On Wed, Aug 6, 2025 at 2:28 PM vignesh C wrote: > > The attached v20250806 version patch has the changes for the same. > Thank You for the patches. Please find a few comments: 1) * If 'resync_all_sequences' is false: * Add or remove tables and sequences that have been added to or removed

RE: Logical Replication of sequences

2025-08-01 Thread Hayato Kuroda (Fujitsu)
Dear Vignesh, I played with your patch and found something. 01. In LogicalRepSyncSequences() and GetSubscriptionRelations(), there is a possibility that the sequence on the subscriber could be dropped before opens that. This can cause `could not open relation with OID %u` error, which is not us

Re: Logical Replication of sequences

2025-07-30 Thread shveta malik
On Wed, Jul 30, 2025 at 11:16 AM shveta malik wrote: > > On Mon, Jul 28, 2025 at 3:37 PM vignesh C wrote: > > > Thanks for the comments, the attached v20250728 version patch has the > > changes for the same. > > > Thanks for the patches, please find a few comments: > > 1) > WARNING: WITH clause

Re: Logical Replication of sequences

2025-07-29 Thread shveta malik
On Mon, Jul 28, 2025 at 3:37 PM vignesh C wrote: > Thanks for the comments, the attached v20250728 version patch has the > changes for the same. > Thanks for the patches, please find a few comments: 1) WARNING: WITH clause parameters do not affect sequence synchronization a) How about: WITH cl

RE: Logical Replication of sequences

2025-07-28 Thread Hayato Kuroda (Fujitsu)
Dear Vignesh, Here are remained comments for v20250723 0003-0005. I've not checked the latest version. 01. ``` *PostgreSQL logical replication: common synchronization code ``` How about: "Common code for synchronizations"? Since this file locates in replication/logical, initial part is

RE: Logical Replication of sequences

2025-07-24 Thread Hayato Kuroda (Fujitsu)
Dear Vignesh, Thanks for working the project. Here are my comments only for 0001 and 0002. Sorry if my points have already been discussed, this thread is too huge to catchup for me :-(. 01. Do we have to document the function and open to users? Previously it was not. Another example is pg_get_pu

Re: Logical Replication of sequences

2025-07-21 Thread shveta malik
On Mon, Jul 21, 2025 at 2:55 PM Amit Kapila wrote: > > On Mon, Jul 21, 2025 at 2:36 PM vignesh C wrote: > > > > On Mon, 21 Jul 2025 at 11:15, Dilip Kumar wrote: > > > > > > > > 3. Some of the syntaxes works for sequence which doesn't make sense to > > > me, as listed below, I think there are mor

Re: Logical Replication of sequences

2025-07-21 Thread Dilip Kumar
On Mon, Jul 21, 2025 at 2:36 PM vignesh C wrote: > > On Mon, 21 Jul 2025 at 11:15, Dilip Kumar wrote: > > > > On Mon, Jul 21, 2025 at 10:36 AM Dilip Kumar wrote: > > > > > > I was just trying a different test, so I realized that ALTER > > > PUBLICATION ADD SEQUENCE is not supported, any reason f

Re: Logical Replication of sequences

2025-07-21 Thread Dilip Kumar
On Mon, Jul 21, 2025 at 2:23 PM vignesh C wrote: > > On Mon, 21 Jul 2025 at 10:36, Dilip Kumar wrote: > > > > I was just trying a different test, so I realized that ALTER > > PUBLICATION ADD SEQUENCE is not supported, any reason for the same? > > > > postgres[154731]=# ALTER PUBLICATION pub ADD s

Re: Logical Replication of sequences

2025-07-21 Thread Amit Kapila
On Mon, Jul 21, 2025 at 2:36 PM vignesh C wrote: > > On Mon, 21 Jul 2025 at 11:15, Dilip Kumar wrote: > > > > > 3. Some of the syntaxes works for sequence which doesn't make sense to > > me, as listed below, I think there are more > > > > postgres[154731]=# CREATE PUBLICATION insert_only FOR ALL

Re: Logical Replication of sequences

2025-07-21 Thread vignesh C
On Mon, 21 Jul 2025 at 11:15, Dilip Kumar wrote: > > On Mon, Jul 21, 2025 at 10:36 AM Dilip Kumar wrote: > > > > I was just trying a different test, so I realized that ALTER > > PUBLICATION ADD SEQUENCE is not supported, any reason for the same? > > > > postgres[154731]=# ALTER PUBLICATION pub AD

Re: Logical Replication of sequences

2025-07-21 Thread vignesh C
On Mon, 21 Jul 2025 at 10:36, Dilip Kumar wrote: > > I was just trying a different test, so I realized that ALTER > PUBLICATION ADD SEQUENCE is not supported, any reason for the same? > > postgres[154731]=# ALTER PUBLICATION pub ADD sequence s1; > ERROR: 42601: invalid publication object list > L

Re: Logical Replication of sequences

2025-07-20 Thread shveta malik
On Mon, Jul 21, 2025 at 11:15 AM Dilip Kumar wrote: > > 3. Some of the syntaxes works for sequence which doesn't make sense to > me, as listed below, I think there are more > > postgres[154731]=# CREATE PUBLICATION insert_only FOR ALL SEQUENCES > WITH (publish = 'insert'); > CREATE PUBLICATION > >

Re: Logical Replication of sequences

2025-07-20 Thread Dilip Kumar
On Mon, Jul 21, 2025 at 10:36 AM Dilip Kumar wrote: > > I was just trying a different test, so I realized that ALTER > PUBLICATION ADD SEQUENCE is not supported, any reason for the same? > > postgres[154731]=# ALTER PUBLICATION pub ADD sequence s1; > ERROR: 42601: invalid publication object list

Re: Logical Replication of sequences

2025-07-20 Thread Dilip Kumar
On Sun, Jul 20, 2025 at 7:48 PM vignesh C wrote: > > On Fri, 18 Jul 2025 at 14:11, Dilip Kumar wrote: > > > > On Fri, Jul 18, 2025 at 10:44 AM Dilip Kumar wrote: > > > > > > On Thu, Jul 17, 2025 at 4:52 PM vignesh C wrote: > > > > > > > > I was looking at the high level idea of sequence sync wo

Re: Logical Replication of sequences

2025-07-20 Thread vignesh C
On Fri, 18 Jul 2025 at 14:11, Dilip Kumar wrote: > > On Fri, Jul 18, 2025 at 10:44 AM Dilip Kumar wrote: > > > > On Thu, Jul 17, 2025 at 4:52 PM vignesh C wrote: > > > > > I was looking at the high level idea of sequence sync worker patch > i.e. 0005, so far I haven't found anything problematic

Re: Logical Replication of sequences

2025-07-18 Thread Amit Kapila
On Thu, Jul 17, 2025 at 4:52 PM vignesh C wrote: > > The attached v20250717 version patch has the changes for the same. > Few comments on 0001 and 0002: 0001 1. Instead of introducing a new function, can we think of extending the existing function pg_get_sequence_data()? 0002 2. postgres=# Creat

Re: Logical Replication of sequences

2025-07-18 Thread Dilip Kumar
On Fri, Jul 18, 2025 at 10:44 AM Dilip Kumar wrote: > > On Thu, Jul 17, 2025 at 4:52 PM vignesh C wrote: > > I was looking at the high level idea of sequence sync worker patch i.e. 0005, so far I haven't found anything problematic there, but I haven't completed the review and testing yet. Here

Re: Logical Replication of sequences

2025-07-17 Thread Dilip Kumar
On Thu, Jul 17, 2025 at 4:52 PM vignesh C wrote: > > On Wed, 16 Jul 2025 at 11:15, Dilip Kumar wrote: > > > > On Mon, Jul 14, 2025 at 10:03 AM vignesh C wrote: > > > > > > On Fri, 11 Jul 2025 at 14:26, shveta malik wrote: > > > > > > I have picked this up again for final review, started with 00

Re: Logical Replication of sequences

2025-07-15 Thread Dilip Kumar
On Mon, Jul 14, 2025 at 10:03 AM vignesh C wrote: > > On Fri, 11 Jul 2025 at 14:26, shveta malik wrote: > > I have picked this up again for final review, started with 0001, I think mostly 0001 looks good to me, except few comments 1. + lsn = PageGetLSN(page); + last_value = seq->last_value; + lo

Re: Logical Replication of sequences

2025-07-14 Thread shveta malik
On Mon, Jul 14, 2025 at 10:03 AM vignesh C wrote: > > On Fri, 11 Jul 2025 at 14:26, shveta malik wrote: > > > > On Wed, Jul 9, 2025 at 4:11 PM vignesh C wrote: > > > > > > > > > 3) > > > > SyncFetchRelationStates: > > > > Earlier the name was FetchTableStates. If we really want to use the > > >

Re: Logical Replication of sequences

2025-07-11 Thread shveta malik
On Wed, Jul 9, 2025 at 4:11 PM vignesh C wrote: > > > 3) > > SyncFetchRelationStates: > > Earlier the name was FetchTableStates. If we really want to use the > > 'Sync' keyword, we can name it FetchRelationSyncStates, as we are > > fetching sync-status only. Thoughts? > > Instead of FetchRelatio

Re: Logical Replication of sequences

2025-07-10 Thread Nisha Moond
On Wed, Jul 9, 2025 at 4:11 PM vignesh C wrote: > > The attached v20250709 version patch has the changes for the same. > Thanks for the patches. In Patch-004: sequencesync.c : I think below function logic can be simplified. +void +ProcessSyncingSequencesForApply(void) +{ + bool started_tx = fal

Re: Logical Replication of sequences

2025-07-09 Thread shveta malik
Please find a few more comments on July4 patch 6) + + To synchronize sequences from a publisher to a subscriber, first publish + them using + CREATE PUBLICATION ... FOR ALL SEQUENCES. + This sentence looks odd, as we have 'first' but no follow-up sentence after that. Can we please comb

Re: Logical Replication of sequences

2025-07-07 Thread shveta malik
On Mon, Jul 7, 2025 at 2:37 PM shveta malik wrote: > > On Fri, Jul 4, 2025 at 3:53 PM vignesh C wrote: > > > > On Tue, 1 Jul 2025 at 15:20, shveta malik wrote: > > > On Mon, Jun 30, 2025 at 3:21 PM Nisha Moond > > > wrote: > > > > > > > > Please find the attached v20250630 patch set addressing

Re: Logical Replication of sequences

2025-07-07 Thread shveta malik
On Fri, Jul 4, 2025 at 3:53 PM vignesh C wrote: > > On Tue, 1 Jul 2025 at 15:20, shveta malik wrote: > > On Mon, Jun 30, 2025 at 3:21 PM Nisha Moond > > wrote: > > > > > > Please find the attached v20250630 patch set addressing above comments > > > and other comments in [1],[2],[3] and [4]. > >

Re: Logical Replication of sequences

2025-07-03 Thread shveta malik
Few more concerns: 4) In UpdateSubscriptionRelState(): if (!HeapTupleIsValid(tup)) elog(ERROR, "subscription table %u in subscription %u does not exist", relid, subid); table-->relation as now it can be hit for both sequence and table. 5) In Logic

Re: Logical Replication of sequences

2025-07-01 Thread shveta malik
On Mon, Jun 30, 2025 at 3:21 PM Nisha Moond wrote: > > Please find the attached v20250630 patch set addressing above comments > and other comments in [1],[2],[3] and [4]. Thanks for the patches. I am still in process of reviewing it but please find few comments: 1) + if (pset.sversion >= 18)

Re: Logical Replication of sequences

2025-06-30 Thread shveta malik
On Mon, Jun 30, 2025 at 3:21 PM Nisha Moond wrote: > > Tab-completion is not supported after a comma (,) in any other cases. > For example, the following commands are valid, but tab-completion does > not work after the comma: > > CREATE PUBLICATION pub7 FOR TABLE t1, TABLES IN SCHEMA public; > CRE

Re: Logical Replication of sequences

2025-06-30 Thread Nisha Moond
On Wed, Jun 25, 2025 at 3:10 PM Shlok Kyal wrote: > > > 4. Since we are not adding sequences in the list 'sub_remove_rels', > should we only palloc for (the count of no. of tables)? Is it worth > the effort? > /* > * Rels that we want to remove from subscription and drop any slots > * and origins

Re: Logical Replication of sequences

2025-06-30 Thread Nisha Moond
On Wed, Jun 25, 2025 at 9:26 AM shveta malik wrote: > > On Tue, Jun 24, 2025 at 6:44 PM Shlok Kyal wrote: > > > > > > 1. Initially, I have created a publication on sequence s1. > > postgres=# CREATE PUBLICATION pub1 FOR ALL SEQUENCES; > > CREATE PUBLICATION > > postgres=# ALTER PUBLICATION pub1 S

Re: Logical Replication of sequences

2025-06-30 Thread Nisha Moond
On Fri, Jun 27, 2025 at 8:50 AM shveta malik wrote: > > On Wed, Jun 25, 2025 at 7:42 PM Shlok Kyal wrote: > > Hi Vignesh, > > > > I tested with all patches applied. I have a comment: > > > > Let consider following case: > > On publisher create a publication pub1 on all sequence. publication > > h

Re: Logical Replication of sequences

2025-06-26 Thread shveta malik
On Wed, Jun 25, 2025 at 7:42 PM Shlok Kyal wrote: > > On Sun, 22 Jun 2025 at 08:05, vignesh C wrote: > > > > On Thu, 19 Jun 2025 at 11:26, Nisha Moond wrote: > > > > > > Hi, > > > > > > Here are my review comments for v20250610 patches: > > > > > > Patch-0005:sequencesync.c > > > > > > 1) report

Re: Logical Replication of sequences

2025-06-25 Thread Shlok Kyal
On Sun, 22 Jun 2025 at 08:05, vignesh C wrote: > > On Thu, 19 Jun 2025 at 11:26, Nisha Moond wrote: > > > > Hi, > > > > Here are my review comments for v20250610 patches: > > > > Patch-0005:sequencesync.c > > > > 1) report_error_sequences() > > > > In case there are both missing and mismatched se

Re: Logical Replication of sequences

2025-06-25 Thread Shlok Kyal
On Sun, 22 Jun 2025 at 08:05, vignesh C wrote: > > On Thu, 19 Jun 2025 at 11:26, Nisha Moond wrote: > > > > Hi, > > > > Here are my review comments for v20250610 patches: > > > > Patch-0005:sequencesync.c > > > > 1) report_error_sequences() > > > > In case there are both missing and mismatched se

Re: Logical Replication of sequences

2025-06-24 Thread Shlok Kyal
On Sun, 22 Jun 2025 at 08:05, vignesh C wrote: > > On Thu, 19 Jun 2025 at 11:26, Nisha Moond wrote: > > > > Hi, > > > > Here are my review comments for v20250610 patches: > > > > Patch-0005:sequencesync.c > > > > 1) report_error_sequences() > > > > In case there are both missing and mismatched se

Re: Logical Replication of sequences

2025-06-24 Thread shveta malik
On Tue, Jun 24, 2025 at 6:44 PM Shlok Kyal wrote: > > > 1. Initially, I have created a publication on sequence s1. > postgres=# CREATE PUBLICATION pub1 FOR ALL SEQUENCES; > CREATE PUBLICATION > postgres=# ALTER PUBLICATION pub1 SET TABLE t1; > ALTER PUBLICATION > postgres=# \d s1 >

Re: Logical Replication of sequences

2025-06-24 Thread Nisha Moond
On Tue, Jun 24, 2025 at 3:07 PM Nisha Moond wrote: > > On Sun, Jun 22, 2025 at 8:05 AM vignesh C wrote: > > > > Thanks for the comment, the attached v20250622 version patch has the > > changes for the same. > > > > Thanks for the patches, please find my review comments for patches 001 and > 002:

Re: Logical Replication of sequences

2025-06-24 Thread Nisha Moond
On Sun, Jun 22, 2025 at 8:05 AM vignesh C wrote: > > Thanks for the comment, the attached v20250622 version patch has the > changes for the same. > Thanks for the patches, please find my review comments for patches 001 and 002: 1) patch-001 :pg_sequence_state() + /* open and lock sequence */ +

Re: Logical Replication of sequences

2025-06-24 Thread shveta malik
> > Thanks for the comment, the attached v20250622 version patch has the > changes for the same. > Thanks for the patches, I am not done with review yet, but please find the feedback so far: 1) + if (!OidIsValid(seq_relid)) + ereport(ERROR, + errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), +

Re: Logical Replication of sequences

2025-06-18 Thread Nisha Moond
Hi, Here are my review comments for v20250610 patches: Patch-0005:sequencesync.c 1) report_error_sequences() In case there are both missing and mismatched sequences, the ERROR message logged is - ``` 2025-05-28 14:22:19.898 IST [392259] ERROR: logical replication sequence synchronization fail

Re: Logical Replication of sequences

2025-06-03 Thread Amit Kapila
On Thu, May 29, 2025 at 8:09 PM vignesh C wrote: > > These comments are handled in the attached v2025029 version patch. > 1. The current syntax to publish sequences is: CREATE PUBLICATION pub1 FOR ALL TABLES, ALL SEQUENCES; The other alternative could be: CREATE PUBLICATION pub1 FOR ALL TABLES,

Re: Logical Replication of sequences

2025-06-02 Thread shveta malik
On Thu, May 29, 2025 at 8:09 PM vignesh C wrote: > These comments are handled in the attached v2025029 version patch. > Thanks for the patches. I am still reviewing but please find few comments: 1) Only persistent sequences are included in the publication. Temporary sequences a

Re: Logical Replication of sequences

2025-05-28 Thread Ajin Cherian
On Fri, May 23, 2025 at 3:12 AM vignesh C wrote: > > > The attached v20250522 patch has the changes for the same. > > Regards, > Vignesh > Some review comments for patch 0001: 1. In src/backend/commands/sequence.c in pg_sequence_state() + /* open and lock sequence */ + init_sequence(seq_relid, &

Re: Logical Replication of sequences

2025-05-28 Thread Nisha Moond
On Thu, May 22, 2025 at 10:42 PM vignesh C wrote: > > > The attached v20250522 patch has the changes for the same. > Thank you for the patches, please find comments for patch-0004. 1) +/* + * report_error_sequences + * + * Logs a warning listing all sequences that are missing on the publisher, +

Re: Logical Replication of sequences

2025-05-21 Thread vignesh C
On Tue, 20 May 2025 at 09:54, shveta malik wrote: > > On Tue, May 20, 2025 at 8:35 AM Nisha Moond wrote: > > > > > > > > Thanks for the comments, these are handled in the attached v20250516 > > > version patch. > > > > > > > Thanks for the patches. Here are my review comments - > > > > Patch-0004

Re: Logical Replication of sequences

2025-05-21 Thread shveta malik
On Tue, May 20, 2025 at 11:13 AM Peter Smith wrote: > > > Test-scenario: > > --Created 250 sequences on both pub and sub. > > --There were 10 sequences mismatched. > > --Sequence replication worked as expected. Logs look better now: > > > > LOG: Logical replication sequence synchronization for su

Re: Logical Replication of sequences

2025-05-20 Thread Nisha Moond
On Tue, May 20, 2025 at 8:35 AM Nisha Moond wrote: > > > > > Thanks for the comments, these are handled in the attached v20250516 > > version patch. > > > > Thanks for the patches. Here are my review comments - > > Patch-0004: src/backend/replication/logical/sequencesync.c > Hi, Currently, the b

Re: Logical Replication of sequences

2025-05-19 Thread Peter Smith
> Test-scenario: > --Created 250 sequences on both pub and sub. > --There were 10 sequences mismatched. > --Sequence replication worked as expected. Logs look better now: > > LOG: Logical replication sequence synchronization for subscription > "sub1" - total unsynchronized: 250; batch #1 = 100 att

Re: Logical Replication of sequences

2025-05-19 Thread shveta malik
On Tue, May 20, 2025 at 8:35 AM Nisha Moond wrote: > > > > > Thanks for the comments, these are handled in the attached v20250516 > > version patch. > > > > Thanks for the patches. Here are my review comments - > > Patch-0004: src/backend/replication/logical/sequencesync.c > > The sequence count l

Re: Logical Replication of sequences

2025-05-19 Thread Nisha Moond
> > Thanks for the comments, these are handled in the attached v20250516 > version patch. > Thanks for the patches. Here are my review comments - Patch-0004: src/backend/replication/logical/sequencesync.c The sequence count logic using curr_seq in copy_sequences() seems buggy. Currently, curr_se

Re: Logical Replication of sequences

2025-05-15 Thread Peter Smith
Hi Vignesh. Some minor review comments for the patches in set v20250514. == Patch 0001. 1.1 For function 'pg_sequence_state', the DOCS call the 2nd parameter 'sequence_name', but the pg_proc.dat file calls it 'seq_name'. Should these be made the same? Patch 0004. pg_

Re: Logical Replication of sequences

2025-05-13 Thread vignesh C
On Wed, 14 May 2025 at 09:55, Nisha Moond wrote: > > On Sat, May 3, 2025 at 7:28 PM vignesh C wrote: > > > > > > There was one pending open comment #6 from [1]. This has been > > addressed in the attached patch. > > Thank you for the patches, here are my comments for patch-004: sequencesync.c > >

Re: Logical Replication of sequences

2025-05-13 Thread Nisha Moond
On Sat, May 3, 2025 at 7:28 PM vignesh C wrote: > > > There was one pending open comment #6 from [1]. This has been > addressed in the attached patch. Thank you for the patches, here are my comments for patch-004: sequencesync.c copy_sequences() --- 1) + if (first) + first = fals

Re: Logical Replication of sequences

2025-05-09 Thread shveta malik
On Sat, May 3, 2025 at 7:27 PM vignesh C wrote: > > > > > Thanks for the comments, the updated patch has the changes for the same. > Thanks for the patches. Please find few comments: 1) patch004 commit msg: - Drop published sequences are removed from pg_subscription_rel. Drop -->Dropped 2) c

Re: Logical Replication of sequences

2025-04-28 Thread Peter Smith
Hi Vignesh. Some trivial review comments for DOCS patch v20250428-0005. == doc/src/sgml/logical-replication.sgml 1. + Publications may currently only contain tables or sequences. Objects must be + added explicitly, except when a publication is created using + FOR TABLES IN SCHEMA, or F

Re: Logical Replication of sequences

2025-04-26 Thread Peter Smith
Hi Vignesh. Some review comments for v20250426-0005. == doc/src/sgml/catalogs.sgml 1. - State code: + State code for tables: i = initialize, d = data is being copied, f = finished table copy, s = synchronized, r = ready (normal repl

Re: Logical Replication of sequences

2025-04-26 Thread Peter Smith
Hi Vignesh. FYI, patch v20250424-0004 reported whitespace errors when applied. [postgres@CentOS7-x64 oss_postgres_misc]$ git apply ../patches_misc/v20250424-0004-Enhance-sequence-synchronization-during-su.patch ../patches_misc/v20250424-0004-Enhance-sequence-synchronization-during-su.patch:366: t

Re: Logical Replication of sequences

2025-04-23 Thread Peter Smith
page_lsn of the remote sequence at the + * moment it was synchronized. + * SUGGESTION (minor rewording) The page LSN will be used in logical replication of sequences to record the LSN of the sequence page in the pg_subscription_rel system catalog. It reflects the LSN of the remote sequence at the

Re: Logical Replication of sequences

2025-04-23 Thread Peter Smith
Hi Vignesh, Some review comments for patch v20250422-0003. == src/backend/replication/logical/syncutils.c 1. +/* + * Exit routine for synchronization worker. + */ +pg_noreturn void +SyncFinishWorker(void) Why does this have the pg_noreturn annotation? None of the other void functions do. ~

Re: Logical Replication of sequences

2025-04-22 Thread Peter Smith
Hi Vignesh. Review comments for patch v20250422-0001. == Commit message 1. This patch introduces a new function: pg_sequence_state function allows retrieval of sequence values including LSN. SUGGESTION This patch introduces a new function, 'pg_sequence_state', which allows retrieval of sequ

Re: Logical Replication of sequences

2025-04-17 Thread Peter Smith
Hi Vignesh, No comments for patch v20250416-0001 No comments for patch v20250416-0002 No comments for patch v20250416-0003 Here are some comments for patch v20250416-0004 == src/backend/catalog/system_views.sql 1. +CREATE VIEW pg_publication_sequences AS +SELECT +P.pubname AS pu

Re: Logical Replication of sequences

2025-04-17 Thread Peter Smith
Hi Vignesh, Some review comments for patch v20250416-0005 (docs) == doc/src/sgml/catalogs.sgml (52.55. pg_subscription_rel) 1. State code: i = initialize, - d = data is being copied, - f = finished table copy, - s = synchronized, + d = data is

Re: Logical Replication of sequences

2025-04-15 Thread Peter Smith
Hi Vignesh, Some review comments for patch v20250325-0005 (docs). == doc/src/sgml/catalogs.sgml (52.55. pg_subscription_rel) 1. State code: i = initialize, d = data is being copied, f = finished table copy, s = synchronized, r = ready (normal replication) ~ This is not part of the patch,

Re: Logical Replication of sequences

2025-04-15 Thread Peter Smith
Hi Vignesh, Some review comments for v20250525-0004. == Commit message 1. A new sequencesync worker is launched as needed to synchronize sequences. It does the following: a) Retrieves remote values of sequences with pg_sequence_state() INIT. b) Log a warning if the sequence parameter

Re: Logical Replication of sequences

2025-04-13 Thread Peter Smith
Hi Vignesh, FYI, the patch v20250325-0004 failed to apply (atop 0001,0002,0002) due to recent master changes. Checking patch src/backend/commands/sequence.c... error: while searching for: (long long) minv, (long long) maxv))); /* Set the currval() state only if iscalled = true */ if (iscalled) {

Re: Logical Replication of sequences

2025-04-13 Thread Peter Smith
Hi Vignesh, Some review comments for patch v20250325-0002 == Commit message 1. Furthermore, enhancements to psql commands (\d and \dRp) now allow for better display of publications containing specific sequences or sequences included in a publication. ~ That doesn't seem as clear as it migh

Re: Logical Replication of sequences

2025-04-13 Thread Peter Smith
Hi Vignesh, Here are some review comments for patch v20250325-0001. == src/test/regress/expected/sequence.out 1. +SELECT last_value, log_cnt, is_called FROM pg_sequence_state('sequence_test'); + last_value | log_cnt | is_called ++-+--- + 99 | 32 | t

Re: Logical Replication of sequences

2025-03-12 Thread vignesh C
On Wed, 12 Mar 2025 at 09:14, vignesh C wrote: > > The patch was not applying on top of HEAD because of recent commits, > here is a rebased version. I have moved this to the next CommitFest since it will not be committed in the current release. This also allows reviewers to focus on the remaining

Re: Logical Replication of sequences

2025-01-05 Thread Peter Smith
Hi Vignesh, FYI, looks like your attached patchset was misnamed 20250204 instead of 20250104. Anyway, it does not affect the reviews, but I am going to refer to it as 0104 from now. ~~~ I have no comments for the patch v20250104-0001. Some comments for the patch v20250104-0002. == doc/src/

Re: Logical Replication of sequences

2025-01-03 Thread vignesh C
On Fri, 3 Jan 2025 at 09:07, Peter Smith wrote: > > Hi Vignesh, > > Some minor review comments for the patch v20241230-0003. > > == > src/backend/replication/logical/syncutils.c > > 1. > + * syncutils.c > + * PostgreSQL logical replication: common synchronization code > + * > + * Copyright (

Re: Logical Replication of sequences

2025-01-02 Thread Peter Smith
Hi Vignesh, Some minor review comments for the patch v20241230-0003. == src/backend/replication/logical/syncutils.c 1. + * syncutils.c + * PostgreSQL logical replication: common synchronization code + * + * Copyright (c) 2024, PostgreSQL Global Development Group Happy New Year. s/2024/20

Re: Logical Replication of sequences

2025-01-02 Thread Peter Smith
Hi Vignesh. Here are some review comments for patch v20241230-0002 == 1. SYNTAX The proposed syntax is currently: CREATE PUBLICATION name [ FOR ALL object_type [, ...] | FOR publication_object [, ... ] ] [ WITH ( publication_parameter [= value] [, ... ] ) ] where object_type

RE: Logical Replication of sequences

2024-12-27 Thread Hayato Kuroda (Fujitsu)
Dear Vignesh, Thanks for updating the patch! Here are my comments. 01. SyncingRelationsState ``` * SYNC_RELATIONS_STATE_NEEDS_REBUILD The subscription relations state is no * longer valid and the subscription relations should be rebuilt. ``` Can we follow the style like other lines? Like: SY

Re: Logical Replication of sequences

2024-12-24 Thread vignesh C
On Fri, 20 Dec 2024 at 08:05, Peter Smith wrote: > > Hi Vignesh. > > Here are some review comments for the patch v20241211-0005. > > == > > Section "29.6.3. Examples" > > 2. > Should the Examples section also have an example of ALTER SUBSCRIPTION > ... REFRESH PUBLICATION to demonstrate (like

Re: Logical Replication of sequences

2024-12-22 Thread vignesh C
On Thu, 19 Dec 2024 at 04:58, Peter Smith wrote: > > Hi Vignesh, > > Here are some review comments for the patch v20241211-0003. > > ~~~ > > 4. > +/* > + * Common code to fetch the up-to-date sync state info into the static lists. > + * > + * Returns true if subscription has 1 or more tables, else

Re: Logical Replication of sequences

2024-12-19 Thread Peter Smith
Hi Vignesh. Here are some review comments for the patch v20241211-0005. == doc/src/sgml/logical-replication.sgml Section "29.6.1. Sequence Definition Mismatches" 1. + + + If there are differences in sequence definitions between the publisher and + subscriber, a WARNING is log

Re: Logical Replication of sequences

2024-12-19 Thread Peter Smith
Hi Vignesh, Here are some review comments for the patch v20241211-0004. == GENERAL 1. There are more than a dozen places where the relation (relkind) is checked to see if it is a SEQUENCE: e.g. + get_rel_relkind(subrel->srrelid) != RELKIND_SEQUENCE && e.g. + if (get_rel_relkind(subrel->srre

Re: Logical Replication of sequences

2024-12-18 Thread Peter Smith
Hi Vignesh, Here are some review comments for the patch v20241211-0003. == src/backend/replication/logical/syncutils.c 1. +typedef enum +{ + SYNC_RELATIONS_STATE_NEEDS_REBUILD, + SYNC_RELATIONS_STATE_REBUILD_STARTED, + SYNC_RELATIONS_STATE_VALID, +} SyncingRelationsState; + Even though the

  1   2   3   >