postgresql/contrib/test_decoding
Amit Kapila 0aa8a01d04 Extend the output plugin API to allow decoding of prepared xacts.
This adds six methods to the output plugin API, adding support for
streaming changes of two-phase transactions at prepare time.

* begin_prepare
* filter_prepare
* prepare
* commit_prepared
* rollback_prepared
* stream_prepare

Most of this is a simple extension of the existing methods, with the
semantic difference that the transaction is not yet committed and maybe
aborted later.

Until now two-phase transactions were translated into regular transactions
on the subscriber, and the GID was not forwarded to it. None of the
two-phase commands were communicated to the subscriber.

This patch provides the infrastructure for logical decoding plugins to be
informed of two-phase commands Like PREPARE TRANSACTION, COMMIT PREPARED
and ROLLBACK PREPARED commands with the corresponding GID.

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

This commit simply adds these new APIs and the upcoming patch to "allow
the decoding at prepare time in ReorderBuffer" will use these APIs.

Author: Ajin Cherian and Amit Kapila based on previous work by Nikhil Sontakke and Stas Kelvich
Reviewed-by: Amit Kapila, Peter Smith, Sawada Masahiko, and Dilip Kumar
Discussion:
https://postgr.es/m/02DA5F5E-CECE-4D9C-8B4B-418077E2C010@postgrespro.ru
https://postgr.es/m/CAMGcDxeqEpWj3fTXwqhSwBdXd2RS9jzwWscO-XbeCfso6ts3+Q@mail.gmail.com
2020-12-30 16:17:26 +05:30
..
expected Fix 'skip-empty-xacts' option in test_decoding for streaming mode. 2020-11-17 12:14:53 +05:30
specs Fix 'skip-empty-xacts' option in test_decoding for streaming mode. 2020-11-17 12:14:53 +05:30
sql Change the attribute name in pg_stat_replication_slots view. 2020-10-20 10:24:36 +05:30
.gitignore Improve isolation tests infrastructure. 2017-03-14 15:56:17 -07:00
Makefile Add tests for logical replication spilled stats. 2020-10-13 08:30:35 +05:30
logical.conf Add logical_decoding_work_mem to limit ReorderBuffer memory usage. 2019-11-19 07:32:36 +05:30
test_decoding.c Extend the output plugin API to allow decoding of prepared xacts. 2020-12-30 16:17:26 +05:30