pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Force immediate commit after CREATE DATABASE etc in extended pro 7+ messages / 1 participants [nested] [flat]
* pgsql: Force immediate commit after CREATE DATABASE etc in extended pro @ 2022-07-26 17:07 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2022-07-26 17:07 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Force immediate commit after CREATE DATABASE etc in extended protocol. We have a few commands that "can't run in a transaction block", meaning that if they complete their processing but then we fail to COMMIT, we'll be left with inconsistent on-disk state. However, the existing defenses for this are only watertight for simple query protocol. In extended protocol, we didn't commit until receiving a Sync message. Since the client is allowed to issue another command instead of Sync, we're in trouble if that command fails or is an explicit ROLLBACK. In any case, sitting in an inconsistent state while waiting for a client message that might not come seems pretty risky. This case wasn't reachable via libpq before we introduced pipeline mode, but it's always been an intended aspect of extended query protocol, and likely there are other clients that could reach it before. To fix, set a flag in PreventInTransactionBlock that tells exec_execute_message to force an immediate commit. This seems to be the approach that does least damage to existing working cases while still preventing the undesirable outcomes. While here, add some documentation to protocol.sgml that explicitly says how to use pipelining. That's latent in the existing docs if you know what to look for, but it's better to spell it out; and it provides a place to document this new behavior. Per bug #17434 from Yugo Nagata. It's been wrong for ages, so back-patch to all supported branches. Discussion: https://postgr.es/m/17434-d9f7a064ce2a88a3@postgresql.org Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/f92944137cdec3e80e826879d817a2d3dff68b5f Modified Files -------------- doc/src/sgml/protocol.sgml | 58 +++++++++++++++++++++++++++++++++++++++ src/backend/access/transam/xact.c | 14 +++++++++- src/backend/tcop/postgres.c | 52 ++++++++++++++++++----------------- src/include/access/xact.h | 6 ++++ 4 files changed, 104 insertions(+), 26 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Force immediate commit after CREATE DATABASE etc in extended pro @ 2022-07-26 17:07 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2022-07-26 17:07 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Force immediate commit after CREATE DATABASE etc in extended protocol. We have a few commands that "can't run in a transaction block", meaning that if they complete their processing but then we fail to COMMIT, we'll be left with inconsistent on-disk state. However, the existing defenses for this are only watertight for simple query protocol. In extended protocol, we didn't commit until receiving a Sync message. Since the client is allowed to issue another command instead of Sync, we're in trouble if that command fails or is an explicit ROLLBACK. In any case, sitting in an inconsistent state while waiting for a client message that might not come seems pretty risky. This case wasn't reachable via libpq before we introduced pipeline mode, but it's always been an intended aspect of extended query protocol, and likely there are other clients that could reach it before. To fix, set a flag in PreventInTransactionBlock that tells exec_execute_message to force an immediate commit. This seems to be the approach that does least damage to existing working cases while still preventing the undesirable outcomes. While here, add some documentation to protocol.sgml that explicitly says how to use pipelining. That's latent in the existing docs if you know what to look for, but it's better to spell it out; and it provides a place to document this new behavior. Per bug #17434 from Yugo Nagata. It's been wrong for ages, so back-patch to all supported branches. Discussion: https://postgr.es/m/17434-d9f7a064ce2a88a3@postgresql.org Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/a0c632c1dea74de042110e204bd2dc634e87b7ea Modified Files -------------- doc/src/sgml/protocol.sgml | 58 +++++++++++++++++++++++++++++++++++++++ src/backend/access/transam/xact.c | 14 +++++++++- src/backend/tcop/postgres.c | 52 ++++++++++++++++++----------------- src/include/access/xact.h | 6 ++++ 4 files changed, 104 insertions(+), 26 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Force immediate commit after CREATE DATABASE etc in extended pro @ 2022-07-26 17:07 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2022-07-26 17:07 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Force immediate commit after CREATE DATABASE etc in extended protocol. We have a few commands that "can't run in a transaction block", meaning that if they complete their processing but then we fail to COMMIT, we'll be left with inconsistent on-disk state. However, the existing defenses for this are only watertight for simple query protocol. In extended protocol, we didn't commit until receiving a Sync message. Since the client is allowed to issue another command instead of Sync, we're in trouble if that command fails or is an explicit ROLLBACK. In any case, sitting in an inconsistent state while waiting for a client message that might not come seems pretty risky. This case wasn't reachable via libpq before we introduced pipeline mode, but it's always been an intended aspect of extended query protocol, and likely there are other clients that could reach it before. To fix, set a flag in PreventInTransactionBlock that tells exec_execute_message to force an immediate commit. This seems to be the approach that does least damage to existing working cases while still preventing the undesirable outcomes. While here, add some documentation to protocol.sgml that explicitly says how to use pipelining. That's latent in the existing docs if you know what to look for, but it's better to spell it out; and it provides a place to document this new behavior. Per bug #17434 from Yugo Nagata. It's been wrong for ages, so back-patch to all supported branches. Discussion: https://postgr.es/m/17434-d9f7a064ce2a88a3@postgresql.org Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/3e1297a63f760b02ea8d951f6b270c9c843083ae Modified Files -------------- doc/src/sgml/protocol.sgml | 58 +++++++++++++++++++++++++++++++++++++++ src/backend/access/transam/xact.c | 14 +++++++++- src/backend/tcop/postgres.c | 52 ++++++++++++++++++----------------- src/include/access/xact.h | 6 ++++ 4 files changed, 104 insertions(+), 26 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Force immediate commit after CREATE DATABASE etc in extended pro @ 2022-07-26 17:07 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2022-07-26 17:07 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Force immediate commit after CREATE DATABASE etc in extended protocol. We have a few commands that "can't run in a transaction block", meaning that if they complete their processing but then we fail to COMMIT, we'll be left with inconsistent on-disk state. However, the existing defenses for this are only watertight for simple query protocol. In extended protocol, we didn't commit until receiving a Sync message. Since the client is allowed to issue another command instead of Sync, we're in trouble if that command fails or is an explicit ROLLBACK. In any case, sitting in an inconsistent state while waiting for a client message that might not come seems pretty risky. This case wasn't reachable via libpq before we introduced pipeline mode, but it's always been an intended aspect of extended query protocol, and likely there are other clients that could reach it before. To fix, set a flag in PreventInTransactionBlock that tells exec_execute_message to force an immediate commit. This seems to be the approach that does least damage to existing working cases while still preventing the undesirable outcomes. While here, add some documentation to protocol.sgml that explicitly says how to use pipelining. That's latent in the existing docs if you know what to look for, but it's better to spell it out; and it provides a place to document this new behavior. Per bug #17434 from Yugo Nagata. It's been wrong for ages, so back-patch to all supported branches. Discussion: https://postgr.es/m/17434-d9f7a064ce2a88a3@postgresql.org Branch ------ REL_13_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/6c193c2ace32b4770cf13981914d9c054fb5404d Modified Files -------------- doc/src/sgml/protocol.sgml | 58 +++++++++++++++++++++++++++++++++++++++ src/backend/access/transam/xact.c | 14 +++++++++- src/backend/tcop/postgres.c | 52 ++++++++++++++++++----------------- src/include/access/xact.h | 6 ++++ 4 files changed, 104 insertions(+), 26 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Force immediate commit after CREATE DATABASE etc in extended pro @ 2022-07-26 17:07 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2022-07-26 17:07 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Force immediate commit after CREATE DATABASE etc in extended protocol. We have a few commands that "can't run in a transaction block", meaning that if they complete their processing but then we fail to COMMIT, we'll be left with inconsistent on-disk state. However, the existing defenses for this are only watertight for simple query protocol. In extended protocol, we didn't commit until receiving a Sync message. Since the client is allowed to issue another command instead of Sync, we're in trouble if that command fails or is an explicit ROLLBACK. In any case, sitting in an inconsistent state while waiting for a client message that might not come seems pretty risky. This case wasn't reachable via libpq before we introduced pipeline mode, but it's always been an intended aspect of extended query protocol, and likely there are other clients that could reach it before. To fix, set a flag in PreventInTransactionBlock that tells exec_execute_message to force an immediate commit. This seems to be the approach that does least damage to existing working cases while still preventing the undesirable outcomes. While here, add some documentation to protocol.sgml that explicitly says how to use pipelining. That's latent in the existing docs if you know what to look for, but it's better to spell it out; and it provides a place to document this new behavior. Per bug #17434 from Yugo Nagata. It's been wrong for ages, so back-patch to all supported branches. Discussion: https://postgr.es/m/17434-d9f7a064ce2a88a3@postgresql.org Branch ------ REL_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/968b89257b119ba69e36f4bb0a2a21eed96c2b6c Modified Files -------------- doc/src/sgml/protocol.sgml | 58 +++++++++++++++++++++++++++++++++++++++ src/backend/access/transam/xact.c | 14 +++++++++- src/backend/tcop/postgres.c | 52 ++++++++++++++++++----------------- src/include/access/xact.h | 6 ++++ 4 files changed, 104 insertions(+), 26 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Force immediate commit after CREATE DATABASE etc in extended pro @ 2022-07-26 17:07 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2022-07-26 17:07 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Force immediate commit after CREATE DATABASE etc in extended protocol. We have a few commands that "can't run in a transaction block", meaning that if they complete their processing but then we fail to COMMIT, we'll be left with inconsistent on-disk state. However, the existing defenses for this are only watertight for simple query protocol. In extended protocol, we didn't commit until receiving a Sync message. Since the client is allowed to issue another command instead of Sync, we're in trouble if that command fails or is an explicit ROLLBACK. In any case, sitting in an inconsistent state while waiting for a client message that might not come seems pretty risky. This case wasn't reachable via libpq before we introduced pipeline mode, but it's always been an intended aspect of extended query protocol, and likely there are other clients that could reach it before. To fix, set a flag in PreventInTransactionBlock that tells exec_execute_message to force an immediate commit. This seems to be the approach that does least damage to existing working cases while still preventing the undesirable outcomes. While here, add some documentation to protocol.sgml that explicitly says how to use pipelining. That's latent in the existing docs if you know what to look for, but it's better to spell it out; and it provides a place to document this new behavior. Per bug #17434 from Yugo Nagata. It's been wrong for ages, so back-patch to all supported branches. Discussion: https://postgr.es/m/17434-d9f7a064ce2a88a3@postgresql.org Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/9e3e1ac458abcda5aa03fa2a136e6fa492d58bd6 Modified Files -------------- doc/src/sgml/protocol.sgml | 58 +++++++++++++++++++++++++++++++++++++++ src/backend/access/transam/xact.c | 14 +++++++++- src/backend/tcop/postgres.c | 52 ++++++++++++++++++----------------- src/include/access/xact.h | 6 ++++ 4 files changed, 104 insertions(+), 26 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Force immediate commit after CREATE DATABASE etc in extended pro @ 2022-07-26 17:07 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2022-07-26 17:07 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Force immediate commit after CREATE DATABASE etc in extended protocol. We have a few commands that "can't run in a transaction block", meaning that if they complete their processing but then we fail to COMMIT, we'll be left with inconsistent on-disk state. However, the existing defenses for this are only watertight for simple query protocol. In extended protocol, we didn't commit until receiving a Sync message. Since the client is allowed to issue another command instead of Sync, we're in trouble if that command fails or is an explicit ROLLBACK. In any case, sitting in an inconsistent state while waiting for a client message that might not come seems pretty risky. This case wasn't reachable via libpq before we introduced pipeline mode, but it's always been an intended aspect of extended query protocol, and likely there are other clients that could reach it before. To fix, set a flag in PreventInTransactionBlock that tells exec_execute_message to force an immediate commit. This seems to be the approach that does least damage to existing working cases while still preventing the undesirable outcomes. While here, add some documentation to protocol.sgml that explicitly says how to use pipelining. That's latent in the existing docs if you know what to look for, but it's better to spell it out; and it provides a place to document this new behavior. Per bug #17434 from Yugo Nagata. It's been wrong for ages, so back-patch to all supported branches. Discussion: https://postgr.es/m/17434-d9f7a064ce2a88a3@postgresql.org Branch ------ REL_10_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/964f42aa297b26af000982bfd24033011faf2eaf Modified Files -------------- doc/src/sgml/protocol.sgml | 58 +++++++++++++++++++++++++++++++++++++++ src/backend/access/transam/xact.c | 14 +++++++++- src/backend/tcop/postgres.c | 52 ++++++++++++++++++----------------- src/include/access/xact.h | 6 ++++ 4 files changed, 104 insertions(+), 26 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2022-07-26 17:07 UTC | newest] Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2022-07-26 17:07 pgsql: Force immediate commit after CREATE DATABASE etc in extended pro Tom Lane <tgl@sss.pgh.pa.us> 2022-07-26 17:07 pgsql: Force immediate commit after CREATE DATABASE etc in extended pro Tom Lane <tgl@sss.pgh.pa.us> 2022-07-26 17:07 pgsql: Force immediate commit after CREATE DATABASE etc in extended pro Tom Lane <tgl@sss.pgh.pa.us> 2022-07-26 17:07 pgsql: Force immediate commit after CREATE DATABASE etc in extended pro Tom Lane <tgl@sss.pgh.pa.us> 2022-07-26 17:07 pgsql: Force immediate commit after CREATE DATABASE etc in extended pro Tom Lane <tgl@sss.pgh.pa.us> 2022-07-26 17:07 pgsql: Force immediate commit after CREATE DATABASE etc in extended pro Tom Lane <tgl@sss.pgh.pa.us> 2022-07-26 17:07 pgsql: Force immediate commit after CREATE DATABASE etc in extended pro Tom Lane <tgl@sss.pgh.pa.us>
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