mirror of
https://github.com/postgres/postgres.git
synced 2026-10-23 13:29:09 +03:00
Commit072ee847adtaught logical decoding to discard the changes of a transaction that is already known to be aborted when it is picked for eviction. That path reuses ReorderBufferTruncateTXN(), which marks every subtransaction that still has in-memory changes as streamed. Since nothing is streamed in that path, and the top-level transaction is never marked, a subtransaction ends up flagged as streamed even though the output plugin has never seen it. Decoding the subsequent abort record then makes ReorderBufferAbort() invoke the stream_abort callback for that subtransaction. For pgoutput this sends a Stream Abort ('A') message to a subscriber that requested streaming = off, and it does so regardless of the negotiated protocol version, so even a client speaking a version that predates transaction streaming receives a message it cannot parse. test_decoding dereferences a NULL pointer and crashes, since it allocates its per-transaction state in the begin or stream start callback, neither of which runs for a transaction discarded as aborted. This commit fixes this by marking a subtransaction as streamed only when it has changes and its top-level transaction is already marked as streamed. All streaming call sites mark the top-level transaction before truncating it, so their behavior is unchanged, while the abort-discard path never marks the top-level transaction and therefore now leaves its subtransactions unmarked. Backpatch to v18, where commit072ee847adwas introduced. Bug: #19616 Reported-by: Tyler Smart <tyler@smarts.io> Author: Andrey Rachitskiy <pl0h0yp1@gmail.com> Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com> Discussion: https://postgr.es/m/19616-f6153af509910853@postgresql.org Backpatch-through: 18
The PostgreSQL contrib tree
---------------------------
This subtree contains porting tools, analysis utilities, and plug-in
features that are not part of the core PostgreSQL system, mainly
because they address a limited audience or are too experimental to be
part of the main source tree. This does not preclude their
usefulness.
User documentation for each module appears in the main SGML
documentation.
When building from the source distribution, these modules are not
built automatically, unless you build the "world" target. You can
also build and install them all by running "make all" and "make
install" in this directory; or to build and install just one selected
module, do the same in that module's subdirectory.
Some directories supply new user-defined functions, operators, or
types. To make use of one of these modules, after you have installed
the code you need to register the new SQL objects in the database
system by executing a CREATE EXTENSION command. In a fresh database,
you can simply do
CREATE EXTENSION module_name;
See the PostgreSQL documentation for more information about this
procedure.