Re: Logical Replication of sequences - Mailing list pgsql-hackers

From Peter Smith
Subject Re: Logical Replication of sequences
Date
Msg-id CAHut+PuqU5BjyFkAsM0eifE=b+g8ABU61QZ05Q5QL6ht_xsnQg@mail.gmail.com
Whole thread Raw
In response to Re: Logical Replication of sequences  (vignesh C <vignesh21@gmail.com>)
Responses Re: Logical Replication of sequences
List pgsql-hackers
Hi Vignesh.

I had a quick look at this patch.

======

- * Instead, we invalidate only the relsyncache.
+ * Instead, invalidate the relation sync cache for publications that
+ * include tables. Invalidation is not required for sequences only
+ * publications.
  */
- InvalidatePubRelSyncCache(pub->oid, pub->puballtables);
+ if (!pub->puballsequences || pub->puballtables)
+ InvalidatePubRelSyncCache(pub->oid, pub->puballtables);

I felt all these "sequence only" conditions are becoming difficult to read.

It wonder if it would be better to introduce some function like:

bool
PubHasSequencesOnly(pub)
{
  return pub->puballsequences && !pub->puballtables;
}

IIUC the current patch code only works because publication syntax like
below is not yet supported:

CREATE PUBLICATION pub1 FOR ALL SEQUENCES, TABLE t1;

But when that syntax does become possible, then all these conditions
will be broken.

Should we prepare for that eventuality by introducing some function
right now, so as to contain all the future broken code?

======
Kind Regards,
Peter Smith.
Fujitsu Australia



pgsql-hackers by date:

Previous
From: shveta malik
Date:
Subject: Re: Logical Replication of sequences
Next
From: shveta malik
Date:
Subject: Re: Proposal: Conflict log history table for Logical Replication