From: | Tomas Vondra <tomas(dot)vondra(at)postgresql(dot)org> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Fix snapshot handling in logicalmsg_decode |
Date: | 2023-02-22 16:34:43 |
Message-ID: | E1pUs4o-000A5x-JN@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Fix snapshot handling in logicalmsg_decode
Whe decoding a transactional logical message, logicalmsg_decode called
SnapBuildGetOrBuildSnapshot. But we may not have a consistent snapshot
yet at that point. We don't actually need the snapshot in this case
(during replay we'll have the snapshot from the transaction), so in
practice this is harmless. But in assert-enabled build this crashes.
Fixed by requesting the snapshot only in non-transactional case, where
we are guaranteed to have SNAPBUILD_CONSISTENT.
Backpatch to 11. The issue exists since 9.6.
Backpatch-through: 11
Reviewed-by: Andres Freund
Discussion: https://postgr.es/m/84d60912-6eab-9b84-5de3-41765a5449e8@enterprisedb.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/7fe1aa991b622feaabfac5ed9c918fe8a1d598c9
Modified Files
--------------
src/backend/replication/logical/decode.c | 14 ++++++++++++--
src/backend/replication/logical/reorderbuffer.c | 10 ++++++++++
2 files changed, 22 insertions(+), 2 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tomas Vondra | 2023-02-22 16:35:00 | pgsql: Fix snapshot handling in logicalmsg_decode |
Previous Message | Dean Rasheed | 2023-02-22 13:32:34 | pgsql: Add missing support for the latest SPI status codes. |