pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix predicate-locking of HOT updated rows. 7+ messages / 1 participants [nested] [flat]
* pgsql: Fix predicate-locking of HOT updated rows. @ 2019-08-07 10:01 Heikki Linnakangas <heikki.linnakangas@iki.fi> 0 siblings, 0 replies; 7+ messages in thread From: Heikki Linnakangas @ 2019-08-07 10:01 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix predicate-locking of HOT updated rows. In serializable mode, heap_hot_search_buffer() incorrectly acquired a predicate lock on the root tuple, not the returned tuple that satisfied the visibility checks. As explained in README-SSI, the predicate lock does not need to be copied or extended to other tuple versions, but for that to work, the correct, visible, tuple version must be locked in the first place. The original SSI commit had this bug in it, but it was fixed back in 2013, in commit 81fbbfe335. But unfortunately, it was reintroduced a few months later in commit b89e151054. Wising up from that, add a regression test to cover this, so that it doesn't get reintroduced again. Also, move the code that sets 't_self', so that it happens at the same time that the other HeapTuple fields are set, to make it more clear that all the code in the loop operate on the "current" tuple in the chain, not the root tuple. Bug spotted by Andres Freund, analysis and original fix by Thomas Munro, test case and some additional changes to the fix by Heikki Linnakangas. Backpatch to all supported versions (9.4). Discussion: https://www.postgresql.org/message-id/20190731210630.nqhszuktygwftjty%40alap3.anarazel.de Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/1169fcf129f41762fa8a2d82b52eabd788b3a4de Modified Files -------------- src/backend/access/heap/heapam.c | 29 +++++++---------- .../expected/predicate-lock-hot-tuple.out | 20 ++++++++++++ src/test/isolation/isolation_schedule | 1 + .../isolation/specs/predicate-lock-hot-tuple.spec | 37 ++++++++++++++++++++++ 4 files changed, 70 insertions(+), 17 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix predicate-locking of HOT updated rows. @ 2019-08-07 10:01 Heikki Linnakangas <heikki.linnakangas@iki.fi> 0 siblings, 0 replies; 7+ messages in thread From: Heikki Linnakangas @ 2019-08-07 10:01 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix predicate-locking of HOT updated rows. In serializable mode, heap_hot_search_buffer() incorrectly acquired a predicate lock on the root tuple, not the returned tuple that satisfied the visibility checks. As explained in README-SSI, the predicate lock does not need to be copied or extended to other tuple versions, but for that to work, the correct, visible, tuple version must be locked in the first place. The original SSI commit had this bug in it, but it was fixed back in 2013, in commit 81fbbfe335. But unfortunately, it was reintroduced a few months later in commit b89e151054. Wising up from that, add a regression test to cover this, so that it doesn't get reintroduced again. Also, move the code that sets 't_self', so that it happens at the same time that the other HeapTuple fields are set, to make it more clear that all the code in the loop operate on the "current" tuple in the chain, not the root tuple. Bug spotted by Andres Freund, analysis and original fix by Thomas Munro, test case and some additional changes to the fix by Heikki Linnakangas. Backpatch to all supported versions (9.4). Discussion: https://www.postgresql.org/message-id/20190731210630.nqhszuktygwftjty%40alap3.anarazel.de Branch ------ REL_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/f8d30182b121f0c38695498d6d386ffa96858e76 Modified Files -------------- src/backend/access/heap/heapam.c | 29 +++++++---------- .../expected/predicate-lock-hot-tuple.out | 20 ++++++++++++ src/test/isolation/isolation_schedule | 1 + .../isolation/specs/predicate-lock-hot-tuple.spec | 37 ++++++++++++++++++++++ 4 files changed, 70 insertions(+), 17 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix predicate-locking of HOT updated rows. @ 2019-08-07 10:01 Heikki Linnakangas <heikki.linnakangas@iki.fi> 0 siblings, 0 replies; 7+ messages in thread From: Heikki Linnakangas @ 2019-08-07 10:01 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix predicate-locking of HOT updated rows. In serializable mode, heap_hot_search_buffer() incorrectly acquired a predicate lock on the root tuple, not the returned tuple that satisfied the visibility checks. As explained in README-SSI, the predicate lock does not need to be copied or extended to other tuple versions, but for that to work, the correct, visible, tuple version must be locked in the first place. The original SSI commit had this bug in it, but it was fixed back in 2013, in commit 81fbbfe335. But unfortunately, it was reintroduced a few months later in commit b89e151054. Wising up from that, add a regression test to cover this, so that it doesn't get reintroduced again. Also, move the code that sets 't_self', so that it happens at the same time that the other HeapTuple fields are set, to make it more clear that all the code in the loop operate on the "current" tuple in the chain, not the root tuple. Bug spotted by Andres Freund, analysis and original fix by Thomas Munro, test case and some additional changes to the fix by Heikki Linnakangas. Backpatch to all supported versions (9.4). Discussion: https://www.postgresql.org/message-id/20190731210630.nqhszuktygwftjty%40alap3.anarazel.de Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/c5b796125299b7a1b37b8b5d6e5f0b316521c33a Modified Files -------------- src/backend/access/heap/heapam.c | 29 +++++++---------- .../expected/predicate-lock-hot-tuple.out | 20 ++++++++++++ src/test/isolation/isolation_schedule | 1 + .../isolation/specs/predicate-lock-hot-tuple.spec | 37 ++++++++++++++++++++++ 4 files changed, 70 insertions(+), 17 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix predicate-locking of HOT updated rows. @ 2019-08-07 10:01 Heikki Linnakangas <heikki.linnakangas@iki.fi> 0 siblings, 0 replies; 7+ messages in thread From: Heikki Linnakangas @ 2019-08-07 10:01 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix predicate-locking of HOT updated rows. In serializable mode, heap_hot_search_buffer() incorrectly acquired a predicate lock on the root tuple, not the returned tuple that satisfied the visibility checks. As explained in README-SSI, the predicate lock does not need to be copied or extended to other tuple versions, but for that to work, the correct, visible, tuple version must be locked in the first place. The original SSI commit had this bug in it, but it was fixed back in 2013, in commit 81fbbfe335. But unfortunately, it was reintroduced a few months later in commit b89e151054. Wising up from that, add a regression test to cover this, so that it doesn't get reintroduced again. Also, move the code that sets 't_self', so that it happens at the same time that the other HeapTuple fields are set, to make it more clear that all the code in the loop operate on the "current" tuple in the chain, not the root tuple. Bug spotted by Andres Freund, analysis and original fix by Thomas Munro, test case and some additional changes to the fix by Heikki Linnakangas. Backpatch to all supported versions (9.4). Discussion: https://www.postgresql.org/message-id/20190731210630.nqhszuktygwftjty%40alap3.anarazel.de Branch ------ REL_10_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/65468cc705ea8a329f175de7eed44163ce532482 Modified Files -------------- src/backend/access/heap/heapam.c | 29 +++++++---------- .../expected/predicate-lock-hot-tuple.out | 20 ++++++++++++ src/test/isolation/isolation_schedule | 1 + .../isolation/specs/predicate-lock-hot-tuple.spec | 37 ++++++++++++++++++++++ 4 files changed, 70 insertions(+), 17 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix predicate-locking of HOT updated rows. @ 2019-08-07 10:01 Heikki Linnakangas <heikki.linnakangas@iki.fi> 0 siblings, 0 replies; 7+ messages in thread From: Heikki Linnakangas @ 2019-08-07 10:01 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix predicate-locking of HOT updated rows. In serializable mode, heap_hot_search_buffer() incorrectly acquired a predicate lock on the root tuple, not the returned tuple that satisfied the visibility checks. As explained in README-SSI, the predicate lock does not need to be copied or extended to other tuple versions, but for that to work, the correct, visible, tuple version must be locked in the first place. The original SSI commit had this bug in it, but it was fixed back in 2013, in commit 81fbbfe335. But unfortunately, it was reintroduced a few months later in commit b89e151054. Wising up from that, add a regression test to cover this, so that it doesn't get reintroduced again. Also, move the code that sets 't_self', so that it happens at the same time that the other HeapTuple fields are set, to make it more clear that all the code in the loop operate on the "current" tuple in the chain, not the root tuple. Bug spotted by Andres Freund, analysis and original fix by Thomas Munro, test case and some additional changes to the fix by Heikki Linnakangas. Backpatch to all supported versions (9.4). Discussion: https://www.postgresql.org/message-id/20190731210630.nqhszuktygwftjty%40alap3.anarazel.de Branch ------ REL9_6_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/75774cc221e50a408267a1f09af7f09f44999c0b Modified Files -------------- src/backend/access/heap/heapam.c | 29 +++++++---------- .../expected/predicate-lock-hot-tuple.out | 20 ++++++++++++ src/test/isolation/isolation_schedule | 1 + .../isolation/specs/predicate-lock-hot-tuple.spec | 37 ++++++++++++++++++++++ 4 files changed, 70 insertions(+), 17 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix predicate-locking of HOT updated rows. @ 2019-08-07 10:01 Heikki Linnakangas <heikki.linnakangas@iki.fi> 0 siblings, 0 replies; 7+ messages in thread From: Heikki Linnakangas @ 2019-08-07 10:01 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix predicate-locking of HOT updated rows. In serializable mode, heap_hot_search_buffer() incorrectly acquired a predicate lock on the root tuple, not the returned tuple that satisfied the visibility checks. As explained in README-SSI, the predicate lock does not need to be copied or extended to other tuple versions, but for that to work, the correct, visible, tuple version must be locked in the first place. The original SSI commit had this bug in it, but it was fixed back in 2013, in commit 81fbbfe335. But unfortunately, it was reintroduced a few months later in commit b89e151054. Wising up from that, add a regression test to cover this, so that it doesn't get reintroduced again. Also, move the code that sets 't_self', so that it happens at the same time that the other HeapTuple fields are set, to make it more clear that all the code in the loop operate on the "current" tuple in the chain, not the root tuple. Bug spotted by Andres Freund, analysis and original fix by Thomas Munro, test case and some additional changes to the fix by Heikki Linnakangas. Backpatch to all supported versions (9.4). Discussion: https://www.postgresql.org/message-id/20190731210630.nqhszuktygwftjty%40alap3.anarazel.de Branch ------ REL9_5_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/fd298cd6394bead60456457cf791f958d20fc3f4 Modified Files -------------- src/backend/access/heap/heapam.c | 29 +++++++---------- .../expected/predicate-lock-hot-tuple.out | 20 ++++++++++++ src/test/isolation/isolation_schedule | 1 + .../isolation/specs/predicate-lock-hot-tuple.spec | 37 ++++++++++++++++++++++ 4 files changed, 70 insertions(+), 17 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix predicate-locking of HOT updated rows. @ 2019-08-07 10:01 Heikki Linnakangas <heikki.linnakangas@iki.fi> 0 siblings, 0 replies; 7+ messages in thread From: Heikki Linnakangas @ 2019-08-07 10:01 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix predicate-locking of HOT updated rows. In serializable mode, heap_hot_search_buffer() incorrectly acquired a predicate lock on the root tuple, not the returned tuple that satisfied the visibility checks. As explained in README-SSI, the predicate lock does not need to be copied or extended to other tuple versions, but for that to work, the correct, visible, tuple version must be locked in the first place. The original SSI commit had this bug in it, but it was fixed back in 2013, in commit 81fbbfe335. But unfortunately, it was reintroduced a few months later in commit b89e151054. Wising up from that, add a regression test to cover this, so that it doesn't get reintroduced again. Also, move the code that sets 't_self', so that it happens at the same time that the other HeapTuple fields are set, to make it more clear that all the code in the loop operate on the "current" tuple in the chain, not the root tuple. Bug spotted by Andres Freund, analysis and original fix by Thomas Munro, test case and some additional changes to the fix by Heikki Linnakangas. Backpatch to all supported versions (9.4). Discussion: https://www.postgresql.org/message-id/20190731210630.nqhszuktygwftjty%40alap3.anarazel.de Branch ------ REL9_4_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/54c98fa71ac10cbdd07008921ceea23d9f47bcee Modified Files -------------- src/backend/access/heap/heapam.c | 29 +++++++---------- .../expected/predicate-lock-hot-tuple.out | 20 ++++++++++++ src/test/isolation/isolation_schedule | 1 + .../isolation/specs/predicate-lock-hot-tuple.spec | 37 ++++++++++++++++++++++ 4 files changed, 70 insertions(+), 17 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2019-08-07 10:01 UTC | newest] Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2019-08-07 10:01 pgsql: Fix predicate-locking of HOT updated rows. Heikki Linnakangas <heikki.linnakangas@iki.fi> 2019-08-07 10:01 pgsql: Fix predicate-locking of HOT updated rows. Heikki Linnakangas <heikki.linnakangas@iki.fi> 2019-08-07 10:01 pgsql: Fix predicate-locking of HOT updated rows. Heikki Linnakangas <heikki.linnakangas@iki.fi> 2019-08-07 10:01 pgsql: Fix predicate-locking of HOT updated rows. Heikki Linnakangas <heikki.linnakangas@iki.fi> 2019-08-07 10:01 pgsql: Fix predicate-locking of HOT updated rows. Heikki Linnakangas <heikki.linnakangas@iki.fi> 2019-08-07 10:01 pgsql: Fix predicate-locking of HOT updated rows. Heikki Linnakangas <heikki.linnakangas@iki.fi> 2019-08-07 10:01 pgsql: Fix predicate-locking of HOT updated rows. Heikki Linnakangas <heikki.linnakangas@iki.fi>
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