Re: Logical Replication of sequences

shveta malik <shveta.malik@gmail.com>

From: shveta malik <shveta.malik@gmail.com>
To: vignesh C <vignesh21@gmail.com>
Cc: Shlok Kyal <shlok.kyal.oss@gmail.com>, Chao Li <li.evan.chao@gmail.com>, Masahiko Sawada <sawada.mshk@gmail.com>, "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>, Nisha Moond <nisha.moond412@gmail.com>, Dilip Kumar <dilipbalaut@gmail.com>, Amit Kapila <amit.kapila16@gmail.com>, Peter Smith <smithpb2250@gmail.com>, Peter Eisentraut <peter@eisentraut.org>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Euler Taveira <euler@eulerto.com>, Michael Paquier <michael@paquier.xyz>, "Zhijie Hou (Fujitsu)" <houzj.fnst@fujitsu.com>, "Jonathan S. Katz" <jkatz@postgresql.org>, shveta malik <shveta.malik@gmail.com>
Date: 2025-09-22T10:03:03Z
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. Doc: Add documentation for sequence synchronization.

  2. Remove unused assignment in CREATE PUBLICATION grammar.

  3. Add seq_sync_error_count to subscription statistics.

  4. Fix few issues in commit 5509055d69.

  5. Add sequence synchronization for logical replication.

  6. Add worker type argument to logical replication worker functions.

  7. Introduce "REFRESH SEQUENCES" for subscriptions.

  8. Refactor logical worker synchronization code into a separate file.

  9. Standardize use of REFRESH PUBLICATION in code and messages.

  10. Add "ALL SEQUENCES" support to publications.

  11. Expose sequence page LSN via pg_get_sequence_data.

  12. Resume conflict-relevant data retention automatically.

  13. Post-commit review fixes for 228c370868.

  14. Generate GUC tables from .dat file

6)
I tried to test the patch. When sequences are more than the
batch-size, but not enough to make a complete batch of max size, I get
this error:

LOG:  logical replication sequence synchronization for subscription
"sub1" - total unsynchronized: 118
LOG:  logical replication sequence synchronization for subscription
"sub1" - batch #1 = 100 attempted, 100 succeeded, 0 skipped, 0
mismatched, 0 insufficient pemission, 0 missing,
WARNING:  leaked hash_seq_search scan for hash table 0x5fcc78ff8f90
ERROR:  no hash_seq_search scan for hash table "Logical replication
sequence sync worker sequences"
LOG:  background worker "logical replication sequencesync worker" (PID
137165) exited with exit code 1

This is on creating 118 sequences. It can be easily reproduced by
reducing bath-size (MAX_SEQUENCES_SYNC_PER_BATCH) to say 5 and having
6 sequences in total. It seems we break out of the loop of creating a
batch only if batch_size >= MAX_SEQUENCES_SYNC_PER_BATCH.  When we try
to access hash_seq_search() more than the entries present, it gives
the above error.

thanks
Shveta