git.postgresql.org Git - postgresql.git/commit

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: ca3b374) | patch
Allow decoding at prepare time in ReorderBuffer.
Mon, 4 Jan 2021 03:04:50 +0000 (08:34 +0530)
Mon, 4 Jan 2021 03:04:50 +0000 (08:34 +0530)
commit a271a1b50e9bec07e2ef3a05e38e7285113e4ce6
Allow decoding at prepare time in ReorderBuffer.

This patch allows PREPARE-time decoding of two-phase transactions (if the
output plugin supports this capability), in which case the transactions
are replayed at PREPARE and then committed later when COMMIT PREPARED
arrives.

Now that we decode the changes before the commit, the concurrent aborts
may cause failures when the output plugin consults catalogs (both system
and user-defined).

We detect such failures with a special sqlerrcode
ERRCODE_TRANSACTION_ROLLBACK introduced by commit 7259736a6e and stop
decoding the remaining changes. Then we rollback the changes when rollback
prepared is encountered.

Author: Ajin Cherian and Amit Kapila based on previous work by Nikhil Sontakke and Stas Kelvich
Reviewed-by: Amit Kapila, Peter Smith, Sawada Masahiko, Arseny Sher, and Dilip Kumar
Tested-by: Takamichi Osumi
Discussion:
https://postgr.es/m/02DA5F5E-CECE-4D9C-8B4B-418077E2C010@postgrespro.ru
https://postgr.es/m/CAMGcDxeqEpWj3fTXwqhSwBdXd2RS9jzwWscO-XbeCfso6ts3+Q@mail.gmail.com
contrib/test_decoding/Makefile diff | blob | blame | history
contrib/test_decoding/expected/twophase.out [new file with mode: 0644] blob
contrib/test_decoding/expected/twophase_stream.out [new file with mode: 0644] blob
contrib/test_decoding/sql/twophase.sql [new file with mode: 0644] blob
contrib/test_decoding/sql/twophase_stream.sql [new file with mode: 0644] blob
doc/src/sgml/logicaldecoding.sgml diff | blob | blame | history
src/backend/replication/logical/decode.c diff | blob | blame | history
src/backend/replication/logical/logical.c diff | blob | blame | history
src/backend/replication/logical/reorderbuffer.c diff | blob | blame | history
src/backend/replication/logical/snapbuild.c diff | blob | blame | history
src/include/replication/reorderbuffer.h diff | blob | blame | history
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /