postgresql/src/include/catalog
Amit Kapila 5509055d69 Add sequence synchronization for logical replication.
This patch introduces sequence synchronization. Sequences that are synced
will have 2 states:
   - INIT (needs [re]synchronizing)
   - READY (is already synchronized)

A new sequencesync worker is launched as needed to synchronize sequences.
A single sequencesync worker is responsible for synchronizing all
sequences. It begins by retrieving the list of sequences that are flagged
for synchronization, i.e., those in the INIT state. These sequences are
then processed in batches, allowing multiple entries to be synchronized
within a single transaction. The worker fetches the current sequence
values and page LSNs from the remote publisher, updates the corresponding
sequences on the local subscriber, and finally marks each sequence as
READY upon successful synchronization.

Sequence synchronization occurs in 3 places:
1) CREATE SUBSCRIPTION
    - The command syntax remains unchanged.
    - The subscriber retrieves sequences associated with publications.
    - Published sequences are added to pg_subscription_rel with INIT
      state.
    - Initiate the sequencesync worker to synchronize all sequences.

2) ALTER SUBSCRIPTION ... REFRESH PUBLICATION
    - The command syntax remains unchanged.
    - Dropped published sequences are removed from pg_subscription_rel.
    - Newly published sequences are added to pg_subscription_rel with INIT
      state.
    - Initiate the sequencesync worker to synchronize only newly added
      sequences.

3) ALTER SUBSCRIPTION ... REFRESH SEQUENCES
    - A new command introduced for PG19 by f0b3573c3a.
    - All sequences in pg_subscription_rel are reset to INIT state.
    - Initiate the sequencesync worker to synchronize all sequences.
    - Unlike "ALTER SUBSCRIPTION ... REFRESH PUBLICATION" command,
      addition and removal of missing sequences will not be done in this
      case.

Author: Vignesh C <vignesh21@gmail.com>
Reviewed-by: shveta malik <shveta.malik@gmail.com>
Reviewed-by: Hou Zhijie <houzj.fnst@fujitsu.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>
Reviewed-by: Peter Smith <smithpb2250@gmail.com>
Reviewed-by: Nisha Moond <nisha.moond412@gmail.com>
Reviewed-by: Shlok Kyal <shlok.kyal.oss@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAA4eK1LC+KJiAkSrpE_NwvNdidw9F2os7GERUeSxSKv71gXysQ@mail.gmail.com
2025-11-05 05:59:58 +00:00
..
.gitignore Put genbki.pl output into src/include/catalog/ directly 2024-03-14 07:11:21 +01:00
binary_upgrade.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
catalog.h Assert lack of hazardous buffer locks before possible catalog read. 2025-04-17 05:00:30 -07:00
catversion.h Add sequence synchronization for logical replication. 2025-11-05 05:59:58 +00:00
dependency.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
duplicate_oids Update copyright for 2025 2025-01-01 11:21:55 -05:00
genbki.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
heap.h Remove now-dead code in StoreAttrDefault(). 2025-03-03 13:09:20 -05:00
index.h Mark ItemPointer arguments as const throughout 2025-10-30 14:12:06 +01:00
indexing.h Mark ItemPointer arguments as const throughout 2025-10-30 14:12:06 +01:00
Makefile Update copyright for 2025 2025-01-01 11:21:55 -05:00
meson.build Update copyright for 2025 2025-01-01 11:21:55 -05:00
namespace.h Provide more-specific error details/hints for function lookup failures. 2025-09-16 12:17:02 -04:00
objectaccess.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
objectaddress.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
partition.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
pg_aggregate.dat Allow negative aggtransspace to indicate unbounded state size 2025-10-08 17:01:48 +09:00
pg_aggregate.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_am.dat Update copyright for 2025 2025-01-01 11:21:55 -05:00
pg_am.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_amop.dat Update copyright for 2025 2025-01-01 11:21:55 -05:00
pg_amop.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_amproc.dat Rename gist stratnum support function 2025-06-02 08:41:27 +02:00
pg_amproc.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_attrdef.h Remove now-dead code in StoreAttrDefault(). 2025-03-03 13:09:20 -05:00
pg_attribute.h Allow NOT NULL constraints to be added as NOT VALID 2025-04-07 19:19:50 +02:00
pg_auth_members.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_authid.dat Do pre-release housekeeping on catalog data. 2025-06-29 21:43:39 -04:00
pg_authid.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_cast.dat Add new OID alias type regdatabase. 2025-06-30 15:38:54 -05:00
pg_cast.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_class.dat Update copyright for 2025 2025-01-01 11:21:55 -05:00
pg_class.h Place "extern" declaration in the right part of pg_class.h. 2025-03-21 15:14:15 -04:00
pg_collation.dat Do pre-release housekeeping on catalog data. 2025-06-29 21:43:39 -04:00
pg_collation.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_constraint.h Allow NOT NULL constraints to be added as NOT VALID 2025-04-07 19:19:50 +02:00
pg_control.h Add default_char_signedness field to ControlFileData. 2025-02-21 10:12:08 -08:00
pg_conversion.dat Update copyright for 2025 2025-01-01 11:21:55 -05:00
pg_conversion.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_database.dat Update copyright for 2025 2025-01-01 11:21:55 -05:00
pg_database.h Avoid including commands/dbcommands.h in so many places 2025-08-28 12:39:04 +02:00
pg_db_role_setting.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_default_acl.h Extend ALTER DEFAULT PRIVILEGES to define default privileges for large objects. 2025-04-04 19:02:17 +09:00
pg_depend.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_description.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_enum.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_event_trigger.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_extension.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_foreign_data_wrapper.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_foreign_server.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_foreign_table.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_index.h Do pre-release housekeeping on catalog data. 2025-06-29 21:43:39 -04:00
pg_inherits.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_init_privs.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_language.dat Update copyright for 2025 2025-01-01 11:21:55 -05:00
pg_language.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_largeobject.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_largeobject_metadata.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_namespace.dat Update copyright for 2025 2025-01-01 11:21:55 -05:00
pg_namespace.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_opclass.dat Update copyright for 2025 2025-01-01 11:21:55 -05:00
pg_opclass.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_operator.dat Fix NO ACTION temporal foreign keys when the referenced endpoints change 2025-01-21 14:39:24 +01:00
pg_operator.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_opfamily.dat Update copyright for 2025 2025-01-01 11:21:55 -05:00
pg_opfamily.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_parameter_acl.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_partitioned_table.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_policy.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_proc.dat Add sequence synchronization for logical replication. 2025-11-05 05:59:58 +00:00
pg_proc.h Fix erroneous construction of functions' dependencies on transforms. 2025-04-07 13:31:37 -04:00
pg_publication.h Add "ALL SEQUENCES" support to publications. 2025-10-09 03:48:54 +00:00
pg_publication_namespace.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_publication_rel.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_range.dat Update copyright for 2025 2025-01-01 11:21:55 -05:00
pg_range.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_replication_origin.h Remove pg_replication_origin's TOAST table. 2025-05-07 14:47:36 -05:00
pg_rewrite.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_seclabel.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_sequence.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_shdepend.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_shdescription.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_shseclabel.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_statistic.h Track the maximum possible frequency of non-MCE array elements. 2025-09-20 14:48:16 -04:00
pg_statistic_ext.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_statistic_ext_data.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_subscription.h Add max_retention_duration option to subscriptions. 2025-09-02 03:20:18 +00:00
pg_subscription_rel.h Add sequence synchronization for logical replication. 2025-11-05 05:59:58 +00:00
pg_tablespace.dat Update copyright for 2025 2025-01-01 11:21:55 -05:00
pg_tablespace.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_transform.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_trigger.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_ts_config.dat Update copyright for 2025 2025-01-01 11:21:55 -05:00
pg_ts_config.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_ts_config_map.dat Update copyright for 2025 2025-01-01 11:21:55 -05:00
pg_ts_config_map.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
pg_ts_dict.dat Update copyright for 2025 2025-01-01 11:21:55 -05:00
pg_ts_dict.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_ts_parser.dat Update copyright for 2025 2025-01-01 11:21:55 -05:00
pg_ts_parser.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_ts_template.dat Update copyright for 2025 2025-01-01 11:21:55 -05:00
pg_ts_template.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_type.dat Grab the low-hanging fruit from forcing USE_FLOAT8_BYVAL to true. 2025-08-13 17:18:22 -04:00
pg_type.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
pg_user_mapping.h IWYU pragmas for catalog headers 2025-01-15 18:57:53 +01:00
README Add src/include/catalog/README 2025-08-19 08:41:42 +02:00
reformat_dat_file.pl Fix an assortment of spelling mistakes and typos 2025-01-02 12:42:01 +13:00
renumber_oids.pl Update copyright for 2025 2025-01-01 11:21:55 -05:00
storage.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
storage_xlog.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
toasting.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
unused_oids Update copyright for 2025 2025-01-01 11:21:55 -05:00

See <https://www.postgresql.org/docs/devel/bki.html> about the
files in this directory.