pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Avoid testing tuple visibility without buffer lock in RI_FKey_ch 10+ messages / 1 participants [nested] [flat]
* pgsql: Avoid testing tuple visibility without buffer lock in RI_FKey_ch @ 2016-10-23 19:02 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 10+ messages in thread From: Tom Lane @ 2016-10-23 19:02 UTC (permalink / raw) To: pgsql-committers Avoid testing tuple visibility without buffer lock in RI_FKey_check(). Despite the argumentation I wrote in commit 7a2fe85b0, it's unsafe to do this, because in corner cases it's possible for HeapTupleSatisfiesSelf to try to set hint bits on the target tuple; and at least since 8.2 we have required the buffer content lock to be held while setting hint bits. The added regression test exercises one such corner case. Unpatched, it causes an assertion failure in assert-enabled builds, or otherwise would cause a hint bit change in a buffer we don't hold lock on, which given the right race condition could result in checksum failures or other data consistency problems. The odds of a problem in the field are probably pretty small, but nonetheless back-patch to all supported branches. Report: <19391.1477244876@sss.pgh.pa.us> Branch ------ REL9_6_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/5beb73b49598ff255c3d085d27d72bf28c8551b0 Modified Files -------------- src/backend/utils/adt/ri_triggers.c | 22 ++++++++++------------ src/test/regress/expected/foreign_key.out | 21 +++++++++++++++++++++ src/test/regress/sql/foreign_key.sql | 23 +++++++++++++++++++++++ 3 files changed, 54 insertions(+), 12 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 10+ messages in thread
* pgsql: Avoid testing tuple visibility without buffer lock in RI_FKey_ch @ 2016-10-23 19:02 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 10+ messages in thread From: Tom Lane @ 2016-10-23 19:02 UTC (permalink / raw) To: pgsql-committers Avoid testing tuple visibility without buffer lock in RI_FKey_check(). Despite the argumentation I wrote in commit 7a2fe85b0, it's unsafe to do this, because in corner cases it's possible for HeapTupleSatisfiesSelf to try to set hint bits on the target tuple; and at least since 8.2 we have required the buffer content lock to be held while setting hint bits. The added regression test exercises one such corner case. Unpatched, it causes an assertion failure in assert-enabled builds, or otherwise would cause a hint bit change in a buffer we don't hold lock on, which given the right race condition could result in checksum failures or other data consistency problems. The odds of a problem in the field are probably pretty small, but nonetheless back-patch to all supported branches. Report: <19391.1477244876@sss.pgh.pa.us> Branch ------ REL9_5_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/913e7e5983ff4b544879845af5305f70a4fa6277 Modified Files -------------- src/backend/utils/adt/ri_triggers.c | 22 ++++++++++------------ src/test/regress/expected/foreign_key.out | 21 +++++++++++++++++++++ src/test/regress/sql/foreign_key.sql | 23 +++++++++++++++++++++++ 3 files changed, 54 insertions(+), 12 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 10+ messages in thread
* pgsql: Avoid testing tuple visibility without buffer lock in RI_FKey_ch @ 2016-10-23 19:02 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 10+ messages in thread From: Tom Lane @ 2016-10-23 19:02 UTC (permalink / raw) To: pgsql-committers Avoid testing tuple visibility without buffer lock in RI_FKey_check(). Despite the argumentation I wrote in commit 7a2fe85b0, it's unsafe to do this, because in corner cases it's possible for HeapTupleSatisfiesSelf to try to set hint bits on the target tuple; and at least since 8.2 we have required the buffer content lock to be held while setting hint bits. The added regression test exercises one such corner case. Unpatched, it causes an assertion failure in assert-enabled builds, or otherwise would cause a hint bit change in a buffer we don't hold lock on, which given the right race condition could result in checksum failures or other data consistency problems. The odds of a problem in the field are probably pretty small, but nonetheless back-patch to all supported branches. Report: <19391.1477244876@sss.pgh.pa.us> Branch ------ REL9_4_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/9ec21591ff11b60e44bfa44fd596ab52022741b3 Modified Files -------------- src/backend/utils/adt/ri_triggers.c | 22 ++++++++++------------ src/test/regress/expected/foreign_key.out | 21 +++++++++++++++++++++ src/test/regress/sql/foreign_key.sql | 23 +++++++++++++++++++++++ 3 files changed, 54 insertions(+), 12 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 10+ messages in thread
* pgsql: Avoid testing tuple visibility without buffer lock in RI_FKey_ch @ 2016-10-23 19:02 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 10+ messages in thread From: Tom Lane @ 2016-10-23 19:02 UTC (permalink / raw) To: pgsql-committers Avoid testing tuple visibility without buffer lock in RI_FKey_check(). Despite the argumentation I wrote in commit 7a2fe85b0, it's unsafe to do this, because in corner cases it's possible for HeapTupleSatisfiesSelf to try to set hint bits on the target tuple; and at least since 8.2 we have required the buffer content lock to be held while setting hint bits. The added regression test exercises one such corner case. Unpatched, it causes an assertion failure in assert-enabled builds, or otherwise would cause a hint bit change in a buffer we don't hold lock on, which given the right race condition could result in checksum failures or other data consistency problems. The odds of a problem in the field are probably pretty small, but nonetheless back-patch to all supported branches. Report: <19391.1477244876@sss.pgh.pa.us> Branch ------ REL9_3_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/676c603755090c94f0072d435c54f440fda6b9d4 Modified Files -------------- src/backend/utils/adt/ri_triggers.c | 22 ++++++++++------------ src/test/regress/expected/foreign_key.out | 21 +++++++++++++++++++++ src/test/regress/sql/foreign_key.sql | 23 +++++++++++++++++++++++ 3 files changed, 54 insertions(+), 12 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 10+ messages in thread
* pgsql: Avoid testing tuple visibility without buffer lock in RI_FKey_ch @ 2016-10-23 19:02 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 10+ messages in thread From: Tom Lane @ 2016-10-23 19:02 UTC (permalink / raw) To: pgsql-committers Avoid testing tuple visibility without buffer lock in RI_FKey_check(). Despite the argumentation I wrote in commit 7a2fe85b0, it's unsafe to do this, because in corner cases it's possible for HeapTupleSatisfiesSelf to try to set hint bits on the target tuple; and at least since 8.2 we have required the buffer content lock to be held while setting hint bits. The added regression test exercises one such corner case. Unpatched, it causes an assertion failure in assert-enabled builds, or otherwise would cause a hint bit change in a buffer we don't hold lock on, which given the right race condition could result in checksum failures or other data consistency problems. The odds of a problem in the field are probably pretty small, but nonetheless back-patch to all supported branches. Report: <19391.1477244876@sss.pgh.pa.us> Branch ------ REL9_2_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/9bc01e7a4cd4d5ac0c9447a5885f3a5b1bd46dd0 Modified Files -------------- src/backend/utils/adt/ri_triggers.c | 20 +++++++++----------- src/test/regress/expected/foreign_key.out | 22 ++++++++++++++++++++++ src/test/regress/sql/foreign_key.sql | 23 +++++++++++++++++++++++ 3 files changed, 54 insertions(+), 11 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 10+ messages in thread
* pgsql: Avoid testing tuple visibility without buffer lock in RI_FKey_ch @ 2016-10-23 19:02 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 10+ messages in thread From: Tom Lane @ 2016-10-23 19:02 UTC (permalink / raw) To: pgsql-committers Avoid testing tuple visibility without buffer lock in RI_FKey_check(). Despite the argumentation I wrote in commit 7a2fe85b0, it's unsafe to do this, because in corner cases it's possible for HeapTupleSatisfiesSelf to try to set hint bits on the target tuple; and at least since 8.2 we have required the buffer content lock to be held while setting hint bits. The added regression test exercises one such corner case. Unpatched, it causes an assertion failure in assert-enabled builds, or otherwise would cause a hint bit change in a buffer we don't hold lock on, which given the right race condition could result in checksum failures or other data consistency problems. The odds of a problem in the field are probably pretty small, but nonetheless back-patch to all supported branches. Report: <19391.1477244876@sss.pgh.pa.us> Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/6292c2339186bac215bab5a1f01370f9735582c1 Modified Files -------------- src/backend/utils/adt/ri_triggers.c | 22 ++++++++++------------ src/test/regress/expected/foreign_key.out | 21 +++++++++++++++++++++ src/test/regress/sql/foreign_key.sql | 23 +++++++++++++++++++++++ 3 files changed, 54 insertions(+), 12 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 10+ messages in thread
* pgsql: Avoid testing tuple visibility without buffer lock in RI_FKey_ch @ 2016-10-23 19:02 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 10+ messages in thread From: Tom Lane @ 2016-10-23 19:02 UTC (permalink / raw) To: pgsql-committers Avoid testing tuple visibility without buffer lock in RI_FKey_check(). Despite the argumentation I wrote in commit 7a2fe85b0, it's unsafe to do this, because in corner cases it's possible for HeapTupleSatisfiesSelf to try to set hint bits on the target tuple; and at least since 8.2 we have required the buffer content lock to be held while setting hint bits. The added regression test exercises one such corner case. Unpatched, it causes an assertion failure in assert-enabled builds, or otherwise would cause a hint bit change in a buffer we don't hold lock on, which given the right race condition could result in checksum failures or other data consistency problems. The odds of a problem in the field are probably pretty small, but nonetheless back-patch to all supported branches. Report: <19391.1477244876@sss.pgh.pa.us> Branch ------ REL9_1_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/d4fa18a551a11a4193bbe91d691952a82549bafc Modified Files -------------- src/backend/utils/adt/ri_triggers.c | 20 +++++++++----------- src/test/regress/expected/foreign_key.out | 22 ++++++++++++++++++++++ src/test/regress/sql/foreign_key.sql | 23 +++++++++++++++++++++++ 3 files changed, 54 insertions(+), 11 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 10+ messages in thread
* pgsql: Avoid testing tuple visibility without buffer lock. @ 2016-10-23 23:14 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 10+ messages in thread From: Tom Lane @ 2016-10-23 23:14 UTC (permalink / raw) To: pgsql-committers Avoid testing tuple visibility without buffer lock. INSERT ... ON CONFLICT (specifically ExecCheckHeapTupleVisible) contains another example of this unsafe coding practice. It is much harder to get a failure out of it than the case fixed in commit 6292c2339, because in most scenarios any hint bits that could be set would have already been set earlier in the command. However, Konstantin Knizhnik reported a failure with a custom transaction manager, and it's clearly possible to get a failure via a race condition in async-commit mode. For lack of a reproducible example, no regression test case in this commit. I did some testing with Asserts added to tqual.c's functions, and can say that running "make check-world" exposed these two bugs and no others. The Asserts are messy enough that I've not added them to the code for now. Report: <57EE93C8.8080504@postgrespro.ru> Related-Discussion: <CAO3NbwOycQjt2Oqy2VW-eLTq2M5uGMyHnGm=RNga4mjqcYD7gQ@mail.gmail.com> Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/8f1fb7d621b0e6bd2eb0ba2ac9634c5b5a03564b Modified Files -------------- src/backend/executor/nodeModifyTable.c | 6 ++++++ 1 file changed, 6 insertions(+) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 10+ messages in thread
* pgsql: Avoid testing tuple visibility without buffer lock. @ 2016-10-23 23:14 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 10+ messages in thread From: Tom Lane @ 2016-10-23 23:14 UTC (permalink / raw) To: pgsql-committers Avoid testing tuple visibility without buffer lock. INSERT ... ON CONFLICT (specifically ExecCheckHeapTupleVisible) contains another example of this unsafe coding practice. It is much harder to get a failure out of it than the case fixed in commit 6292c2339, because in most scenarios any hint bits that could be set would have already been set earlier in the command. However, Konstantin Knizhnik reported a failure with a custom transaction manager, and it's clearly possible to get a failure via a race condition in async-commit mode. For lack of a reproducible example, no regression test case in this commit. I did some testing with Asserts added to tqual.c's functions, and can say that running "make check-world" exposed these two bugs and no others. The Asserts are messy enough that I've not added them to the code for now. Report: <57EE93C8.8080504@postgrespro.ru> Related-Discussion: <CAO3NbwOycQjt2Oqy2VW-eLTq2M5uGMyHnGm=RNga4mjqcYD7gQ@mail.gmail.com> Branch ------ REL9_6_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/fdcee9f1fc12d6d2c20da8da632b2062d2ed6289 Modified Files -------------- src/backend/executor/nodeModifyTable.c | 6 ++++++ 1 file changed, 6 insertions(+) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 10+ messages in thread
* pgsql: Avoid testing tuple visibility without buffer lock. @ 2016-10-23 23:14 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 10+ messages in thread From: Tom Lane @ 2016-10-23 23:14 UTC (permalink / raw) To: pgsql-committers Avoid testing tuple visibility without buffer lock. INSERT ... ON CONFLICT (specifically ExecCheckHeapTupleVisible) contains another example of this unsafe coding practice. It is much harder to get a failure out of it than the case fixed in commit 6292c2339, because in most scenarios any hint bits that could be set would have already been set earlier in the command. However, Konstantin Knizhnik reported a failure with a custom transaction manager, and it's clearly possible to get a failure via a race condition in async-commit mode. For lack of a reproducible example, no regression test case in this commit. I did some testing with Asserts added to tqual.c's functions, and can say that running "make check-world" exposed these two bugs and no others. The Asserts are messy enough that I've not added them to the code for now. Report: <57EE93C8.8080504@postgrespro.ru> Related-Discussion: <CAO3NbwOycQjt2Oqy2VW-eLTq2M5uGMyHnGm=RNga4mjqcYD7gQ@mail.gmail.com> Branch ------ REL9_5_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/beac79369411f62615d465953b9e6da1296758dc Modified Files -------------- src/backend/executor/nodeModifyTable.c | 6 ++++++ 1 file changed, 6 insertions(+) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 10+ messages in thread
end of thread, other threads:[~2016-10-23 23:14 UTC | newest] Thread overview: 10+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2016-10-23 19:02 pgsql: Avoid testing tuple visibility without buffer lock in RI_FKey_ch Tom Lane <tgl@sss.pgh.pa.us> 2016-10-23 19:02 pgsql: Avoid testing tuple visibility without buffer lock in RI_FKey_ch Tom Lane <tgl@sss.pgh.pa.us> 2016-10-23 19:02 pgsql: Avoid testing tuple visibility without buffer lock in RI_FKey_ch Tom Lane <tgl@sss.pgh.pa.us> 2016-10-23 19:02 pgsql: Avoid testing tuple visibility without buffer lock in RI_FKey_ch Tom Lane <tgl@sss.pgh.pa.us> 2016-10-23 19:02 pgsql: Avoid testing tuple visibility without buffer lock in RI_FKey_ch Tom Lane <tgl@sss.pgh.pa.us> 2016-10-23 19:02 pgsql: Avoid testing tuple visibility without buffer lock in RI_FKey_ch Tom Lane <tgl@sss.pgh.pa.us> 2016-10-23 19:02 pgsql: Avoid testing tuple visibility without buffer lock in RI_FKey_ch Tom Lane <tgl@sss.pgh.pa.us> 2016-10-23 23:14 pgsql: Avoid testing tuple visibility without buffer lock. Tom Lane <tgl@sss.pgh.pa.us> 2016-10-23 23:14 pgsql: Avoid testing tuple visibility without buffer lock. Tom Lane <tgl@sss.pgh.pa.us> 2016-10-23 23:14 pgsql: Avoid testing tuple visibility without buffer lock. 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