Re: logical decoding and replication of sequences, take 2

Tomas Vondra <tomas.vondra@enterprisedb.com>

From: Tomas Vondra <tomas.vondra@enterprisedb.com>
To: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Cc: Amit Kapila <amit.kapila16@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Masahiko Sawada <sawada.mshk@gmail.com>, Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Date: 2023-07-20T16:49:55Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Migrate logical slots to the new node during an upgrade.

  2. Make test_decoding ddl.out shorter

  3. Fix snapshot handling in logicalmsg_decode

  4. doc: Adjust a few more references to "postmaster"

  5. Revert "Logical decoding of sequences"

FWIW there's two questions related to the switch to XLOG_SMGR_CREATE.

1) Does smgr_decode() need to do the same block as sequence_decode()?

    /* Skip the change if already processed (per the snapshot). */
    if (transactional &&
        !SnapBuildProcessChange(builder, xid, buf->origptr))
        return;
    else if (!transactional &&
             (SnapBuildCurrentState(builder) != SNAPBUILD_CONSISTENT ||
              SnapBuildXactNeedsSkip(builder, buf->origptr)))
        return;

I don't think it does. Also, we don't have any transactional flag here.
Or rather, everything is transactional ...


2) Currently, the sequences hash table is in reorderbuffer, i.e. global.
I was thinking maybe we should have it in the transaction (because we
need to do cleanup at the end). It seem a bit inconvenient, because then
we'd need to either search htabs in all subxacts, or transfer the
entries to the top-level xact (otoh, we already do that with snapshots),
and cleanup on abort.

What do you think?


regards

-- 
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company