Extend the logical decoding output plugin API with stream methods

Enterprise / PostgreSQL - Amit Kapila [postgresql.org] - 28 July 2020 02:39 UTC

This adds seven methods to the output plugin API, adding support for streaming changes of large in-progress transactions.

- stream_start
- stream_stop
- stream_abort
- stream_commit
- stream_change
- stream_message
- stream_truncate

Most of this is a simple extension of the existing methods, with the semantic difference that the transaction (or subtransaction) is incomplete and may be aborted later (which is something the regular API does not really need to deal with).

This also extends the 'test_decoding' plugin, implementing these new stream methods.

The stream_start/start_stop are used to demarcate a chunk of changes streamed for a particular toplevel transaction.

This commit simply adds these new APIs and the upcoming patch to "allow the streaming mode in ReorderBuffer" will use these APIs.

Author: Tomas Vondra, Dilip Kumar, Amit Kapila

45fdc9738b Extend the logical decoding output plugin API with stream methods.
contrib/test_decoding/test_decoding.c | 176 +++++++++++++++
doc/src/sgml/logicaldecoding.sgml | 218 +++++++++++++++++++
src/backend/replication/logical/logical.c | 351 ++++++++++++++++++++++++++++++
src/include/replication/logical.h | 5 +
src/include/replication/output_plugin.h | 69 ++++++
src/include/replication/reorderbuffer.h | 59 +++++
6 files changed, 878 insertions(+)

Upstream: git.postgresql.org


  • Share