pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix snapshot handling in logicalmsg_decode 6+ messages / 1 participants [nested] [flat]
* pgsql: Fix snapshot handling in logicalmsg_decode @ 2023-02-22 16:34 Tomas Vondra <tomas.vondra@postgresql.org> 0 siblings, 0 replies; 6+ messages in thread From: Tomas Vondra @ 2023-02-22 16:34 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix snapshot handling in logicalmsg_decode @ 2023-02-22 16:35 Tomas Vondra <tomas.vondra@postgresql.org> 0 siblings, 0 replies; 6+ messages in thread From: Tomas Vondra @ 2023-02-22 16:35 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/949ac32e12674d9c0bcd3d95ea5e56338a567a18 Modified Files -------------- src/backend/replication/logical/decode.c | 14 ++++++++++++-- src/backend/replication/logical/reorderbuffer.c | 10 ++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix snapshot handling in logicalmsg_decode @ 2023-02-22 16:35 Tomas Vondra <tomas.vondra@postgresql.org> 0 siblings, 0 replies; 6+ messages in thread From: Tomas Vondra @ 2023-02-22 16:35 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/8b9cbd42b61ff55e5519631bada5d310159e3a5f Modified Files -------------- src/backend/replication/logical/decode.c | 14 ++++++++++++-- src/backend/replication/logical/reorderbuffer.c | 10 ++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix snapshot handling in logicalmsg_decode @ 2023-02-22 16:35 Tomas Vondra <tomas.vondra@postgresql.org> 0 siblings, 0 replies; 6+ messages in thread From: Tomas Vondra @ 2023-02-22 16:35 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 ------ REL_13_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/4df581fa0f4b663141901d87817f77ec695c6d22 Modified Files -------------- src/backend/replication/logical/decode.c | 14 ++++++++++++-- src/backend/replication/logical/reorderbuffer.c | 10 ++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix snapshot handling in logicalmsg_decode @ 2023-02-22 16:35 Tomas Vondra <tomas.vondra@postgresql.org> 0 siblings, 0 replies; 6+ messages in thread From: Tomas Vondra @ 2023-02-22 16:35 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 ------ REL_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/497f863f05982c193c12a115f00be6efa7214b29 Modified Files -------------- src/backend/replication/logical/decode.c | 14 ++++++++++++-- src/backend/replication/logical/reorderbuffer.c | 10 ++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix snapshot handling in logicalmsg_decode @ 2023-02-22 16:35 Tomas Vondra <tomas.vondra@postgresql.org> 0 siblings, 0 replies; 6+ messages in thread From: Tomas Vondra @ 2023-02-22 16:35 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/8de91ebf2ac1e9922214bf2976a2fcc5c045c169 Modified Files -------------- src/backend/replication/logical/decode.c | 14 ++++++++++++-- src/backend/replication/logical/reorderbuffer.c | 10 ++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2023-02-22 16:35 UTC | newest] Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2023-02-22 16:34 pgsql: Fix snapshot handling in logicalmsg_decode Tomas Vondra <tomas.vondra@postgresql.org> 2023-02-22 16:35 pgsql: Fix snapshot handling in logicalmsg_decode Tomas Vondra <tomas.vondra@postgresql.org> 2023-02-22 16:35 pgsql: Fix snapshot handling in logicalmsg_decode Tomas Vondra <tomas.vondra@postgresql.org> 2023-02-22 16:35 pgsql: Fix snapshot handling in logicalmsg_decode Tomas Vondra <tomas.vondra@postgresql.org> 2023-02-22 16:35 pgsql: Fix snapshot handling in logicalmsg_decode Tomas Vondra <tomas.vondra@postgresql.org> 2023-02-22 16:35 pgsql: Fix snapshot handling in logicalmsg_decode Tomas Vondra <tomas.vondra@postgresql.org>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox