pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix COMMIT/ROLLBACK AND CHAIN in the presence of subtransactions 6+ messages / 1 participants [nested] [flat]
* pgsql: Fix COMMIT/ROLLBACK AND CHAIN in the presence of subtransactions @ 2023-09-22 03:12 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2023-09-22 03:12 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix COMMIT/ROLLBACK AND CHAIN in the presence of subtransactions. In older branches, COMMIT/ROLLBACK AND CHAIN failed to propagate the current transaction's properties to the new transaction if there was any open subtransaction (unreleased savepoint). Instead, some previous transaction's properties would be restored. This is because the "if (s->chain)" check in CommitTransactionCommand examined the wrong instance of the "chain" flag and falsely concluded that it didn't need to save transaction properties. Our regression tests would have noticed this, except they used identical transaction properties for multiple tests in a row, so that the faulty behavior was not distinguishable from correct behavior. Commit 12d768e70 fixed the problem in v15 and later, but only rather accidentally, because I removed the "if (s->chain)" test to avoid a compiler warning, while not realizing that the warning was flagging a real bug. In v14 and before, remove the if-test and save transaction properties unconditionally; just as in the newer branches, that's not expensive enough to justify thinking harder. Add the comment and extra regression test to v15 and later to forestall any future recurrence, but there's no live bug in those branches. Patch by me, per bug #18118 from Liu Xiang. Back-patch to v12 where the AND CHAIN feature was added. Discussion: https://postgr.es/m/18118-4b72fcbb903aace6@postgresql.org Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/48e2b234f822ea1610826be4526bb56ca4734dbe Modified Files -------------- src/backend/access/transam/xact.c | 1 + src/test/regress/expected/transactions.out | 40 ++++++++++++++++++++++++++++++ src/test/regress/sql/transactions.sql | 11 ++++++++ 3 files changed, 52 insertions(+) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix COMMIT/ROLLBACK AND CHAIN in the presence of subtransactions @ 2023-09-22 03:12 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2023-09-22 03:12 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix COMMIT/ROLLBACK AND CHAIN in the presence of subtransactions. In older branches, COMMIT/ROLLBACK AND CHAIN failed to propagate the current transaction's properties to the new transaction if there was any open subtransaction (unreleased savepoint). Instead, some previous transaction's properties would be restored. This is because the "if (s->chain)" check in CommitTransactionCommand examined the wrong instance of the "chain" flag and falsely concluded that it didn't need to save transaction properties. Our regression tests would have noticed this, except they used identical transaction properties for multiple tests in a row, so that the faulty behavior was not distinguishable from correct behavior. Commit 12d768e70 fixed the problem in v15 and later, but only rather accidentally, because I removed the "if (s->chain)" test to avoid a compiler warning, while not realizing that the warning was flagging a real bug. In v14 and before, remove the if-test and save transaction properties unconditionally; just as in the newer branches, that's not expensive enough to justify thinking harder. Add the comment and extra regression test to v15 and later to forestall any future recurrence, but there's no live bug in those branches. Patch by me, per bug #18118 from Liu Xiang. Back-patch to v12 where the AND CHAIN feature was added. Discussion: https://postgr.es/m/18118-4b72fcbb903aace6@postgresql.org Branch ------ REL_16_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/227c7cf15602fa21af7eea1bd11375b7572649e3 Modified Files -------------- src/backend/access/transam/xact.c | 1 + src/test/regress/expected/transactions.out | 40 ++++++++++++++++++++++++++++++ src/test/regress/sql/transactions.sql | 11 ++++++++ 3 files changed, 52 insertions(+) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix COMMIT/ROLLBACK AND CHAIN in the presence of subtransactions @ 2023-09-22 03:12 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2023-09-22 03:12 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix COMMIT/ROLLBACK AND CHAIN in the presence of subtransactions. In older branches, COMMIT/ROLLBACK AND CHAIN failed to propagate the current transaction's properties to the new transaction if there was any open subtransaction (unreleased savepoint). Instead, some previous transaction's properties would be restored. This is because the "if (s->chain)" check in CommitTransactionCommand examined the wrong instance of the "chain" flag and falsely concluded that it didn't need to save transaction properties. Our regression tests would have noticed this, except they used identical transaction properties for multiple tests in a row, so that the faulty behavior was not distinguishable from correct behavior. Commit 12d768e70 fixed the problem in v15 and later, but only rather accidentally, because I removed the "if (s->chain)" test to avoid a compiler warning, while not realizing that the warning was flagging a real bug. In v14 and before, remove the if-test and save transaction properties unconditionally; just as in the newer branches, that's not expensive enough to justify thinking harder. Add the comment and extra regression test to v15 and later to forestall any future recurrence, but there's no live bug in those branches. Patch by me, per bug #18118 from Liu Xiang. Back-patch to v12 where the AND CHAIN feature was added. Discussion: https://postgr.es/m/18118-4b72fcbb903aace6@postgresql.org Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/77dc8160278925f453a1b7560326021f971b9b74 Modified Files -------------- src/backend/access/transam/xact.c | 1 + src/test/regress/expected/transactions.out | 40 ++++++++++++++++++++++++++++++ src/test/regress/sql/transactions.sql | 11 ++++++++ 3 files changed, 52 insertions(+) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix COMMIT/ROLLBACK AND CHAIN in the presence of subtransactions @ 2023-09-22 03:12 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2023-09-22 03:12 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix COMMIT/ROLLBACK AND CHAIN in the presence of subtransactions. In older branches, COMMIT/ROLLBACK AND CHAIN failed to propagate the current transaction's properties to the new transaction if there was any open subtransaction (unreleased savepoint). Instead, some previous transaction's properties would be restored. This is because the "if (s->chain)" check in CommitTransactionCommand examined the wrong instance of the "chain" flag and falsely concluded that it didn't need to save transaction properties. Our regression tests would have noticed this, except they used identical transaction properties for multiple tests in a row, so that the faulty behavior was not distinguishable from correct behavior. Commit 12d768e70 fixed the problem in v15 and later, but only rather accidentally, because I removed the "if (s->chain)" test to avoid a compiler warning, while not realizing that the warning was flagging a real bug. In v14 and before, remove the if-test and save transaction properties unconditionally; just as in the newer branches, that's not expensive enough to justify thinking harder. Add the comment and extra regression test to v15 and later to forestall any future recurrence, but there's no live bug in those branches. Patch by me, per bug #18118 from Liu Xiang. Back-patch to v12 where the AND CHAIN feature was added. Discussion: https://postgr.es/m/18118-4b72fcbb903aace6@postgresql.org Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/10323f140fef776881923f1afc0a369f7be8e035 Modified Files -------------- src/backend/access/transam/xact.c | 4 +-- src/test/regress/expected/transactions.out | 40 ++++++++++++++++++++++++++++++ src/test/regress/sql/transactions.sql | 11 ++++++++ 3 files changed, 53 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix COMMIT/ROLLBACK AND CHAIN in the presence of subtransactions @ 2023-09-22 03:12 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2023-09-22 03:12 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix COMMIT/ROLLBACK AND CHAIN in the presence of subtransactions. In older branches, COMMIT/ROLLBACK AND CHAIN failed to propagate the current transaction's properties to the new transaction if there was any open subtransaction (unreleased savepoint). Instead, some previous transaction's properties would be restored. This is because the "if (s->chain)" check in CommitTransactionCommand examined the wrong instance of the "chain" flag and falsely concluded that it didn't need to save transaction properties. Our regression tests would have noticed this, except they used identical transaction properties for multiple tests in a row, so that the faulty behavior was not distinguishable from correct behavior. Commit 12d768e70 fixed the problem in v15 and later, but only rather accidentally, because I removed the "if (s->chain)" test to avoid a compiler warning, while not realizing that the warning was flagging a real bug. In v14 and before, remove the if-test and save transaction properties unconditionally; just as in the newer branches, that's not expensive enough to justify thinking harder. Add the comment and extra regression test to v15 and later to forestall any future recurrence, but there's no live bug in those branches. Patch by me, per bug #18118 from Liu Xiang. Back-patch to v12 where the AND CHAIN feature was added. Discussion: https://postgr.es/m/18118-4b72fcbb903aace6@postgresql.org Branch ------ REL_13_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/555a8d9d37a27ee2a5df36f8a55dd335d42c2efa Modified Files -------------- src/backend/access/transam/xact.c | 4 +-- src/test/regress/expected/transactions.out | 40 ++++++++++++++++++++++++++++++ src/test/regress/sql/transactions.sql | 11 ++++++++ 3 files changed, 53 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix COMMIT/ROLLBACK AND CHAIN in the presence of subtransactions @ 2023-09-22 03:12 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2023-09-22 03:12 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix COMMIT/ROLLBACK AND CHAIN in the presence of subtransactions. In older branches, COMMIT/ROLLBACK AND CHAIN failed to propagate the current transaction's properties to the new transaction if there was any open subtransaction (unreleased savepoint). Instead, some previous transaction's properties would be restored. This is because the "if (s->chain)" check in CommitTransactionCommand examined the wrong instance of the "chain" flag and falsely concluded that it didn't need to save transaction properties. Our regression tests would have noticed this, except they used identical transaction properties for multiple tests in a row, so that the faulty behavior was not distinguishable from correct behavior. Commit 12d768e70 fixed the problem in v15 and later, but only rather accidentally, because I removed the "if (s->chain)" test to avoid a compiler warning, while not realizing that the warning was flagging a real bug. In v14 and before, remove the if-test and save transaction properties unconditionally; just as in the newer branches, that's not expensive enough to justify thinking harder. Add the comment and extra regression test to v15 and later to forestall any future recurrence, but there's no live bug in those branches. Patch by me, per bug #18118 from Liu Xiang. Back-patch to v12 where the AND CHAIN feature was added. Discussion: https://postgr.es/m/18118-4b72fcbb903aace6@postgresql.org Branch ------ REL_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/7cabb20a95aeea441c82552246732ea507f71469 Modified Files -------------- src/backend/access/transam/xact.c | 4 +-- src/test/regress/expected/transactions.out | 40 ++++++++++++++++++++++++++++++ src/test/regress/sql/transactions.sql | 11 ++++++++ 3 files changed, 53 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2023-09-22 03:12 UTC | newest] Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2023-09-22 03:12 pgsql: Fix COMMIT/ROLLBACK AND CHAIN in the presence of subtransactions Tom Lane <tgl@sss.pgh.pa.us> 2023-09-22 03:12 pgsql: Fix COMMIT/ROLLBACK AND CHAIN in the presence of subtransactions Tom Lane <tgl@sss.pgh.pa.us> 2023-09-22 03:12 pgsql: Fix COMMIT/ROLLBACK AND CHAIN in the presence of subtransactions Tom Lane <tgl@sss.pgh.pa.us> 2023-09-22 03:12 pgsql: Fix COMMIT/ROLLBACK AND CHAIN in the presence of subtransactions Tom Lane <tgl@sss.pgh.pa.us> 2023-09-22 03:12 pgsql: Fix COMMIT/ROLLBACK AND CHAIN in the presence of subtransactions Tom Lane <tgl@sss.pgh.pa.us> 2023-09-22 03:12 pgsql: Fix COMMIT/ROLLBACK AND CHAIN in the presence of subtransactions 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