pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Avoid unnecessary failure in SELECT concurrent with ALTER NO INH 6+ messages / 1 participants [nested] [flat]
* pgsql: Avoid unnecessary failure in SELECT concurrent with ALTER NO INH @ 2018-01-12 20:47 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2018-01-12 20:47 UTC (permalink / raw) To: pgsql-committers Avoid unnecessary failure in SELECT concurrent with ALTER NO INHERIT. If a query against an inheritance tree runs concurrently with an ALTER TABLE that's disinheriting one of the tree members, it's possible to get a "could not find inherited attribute" error because after obtaining lock on the removed member, make_inh_translation_list sees that its columns have attinhcount=0 and decides they aren't the columns it's looking for. An ideal fix, perhaps, would avoid including such a just-removed member table in the query at all; but there seems no way to accomplish that without adding expensive catalog rechecks or creating a likelihood of deadlocks. Instead, let's just drop the check on attinhcount. In this way, a query that's included a just-disinherited child will still succeed, which is not a completely unreasonable behavior. This problem has existed for a long time, so back-patch to all supported branches. Also add an isolation test verifying related behaviors. Patch by me; the new isolation test is based on Kyotaro Horiguchi's work. Discussion: https://postgr.es/m/20170626.174612.23936762.horiguchi.kyotaro@lab.ntt.co.jp Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/680d540502609b422d378a1b8e0c10cac3c60084 Modified Files -------------- src/backend/optimizer/prep/prepunion.c | 4 +- src/test/isolation/expected/alter-table-4.out | 57 +++++++++++++++++++++++++++ src/test/isolation/isolation_schedule | 1 + src/test/isolation/specs/alter-table-4.spec | 37 +++++++++++++++++ 4 files changed, 97 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Avoid unnecessary failure in SELECT concurrent with ALTER NO INH @ 2018-01-12 20:47 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2018-01-12 20:47 UTC (permalink / raw) To: pgsql-committers Avoid unnecessary failure in SELECT concurrent with ALTER NO INHERIT. If a query against an inheritance tree runs concurrently with an ALTER TABLE that's disinheriting one of the tree members, it's possible to get a "could not find inherited attribute" error because after obtaining lock on the removed member, make_inh_translation_list sees that its columns have attinhcount=0 and decides they aren't the columns it's looking for. An ideal fix, perhaps, would avoid including such a just-removed member table in the query at all; but there seems no way to accomplish that without adding expensive catalog rechecks or creating a likelihood of deadlocks. Instead, let's just drop the check on attinhcount. In this way, a query that's included a just-disinherited child will still succeed, which is not a completely unreasonable behavior. This problem has existed for a long time, so back-patch to all supported branches. Also add an isolation test verifying related behaviors. Patch by me; the new isolation test is based on Kyotaro Horiguchi's work. Discussion: https://postgr.es/m/20170626.174612.23936762.horiguchi.kyotaro@lab.ntt.co.jp Branch ------ REL_10_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/55e5eb4d97fbe78af9c81d808afbd0d8559fb392 Modified Files -------------- src/backend/optimizer/prep/prepunion.c | 4 +- src/test/isolation/expected/alter-table-4.out | 57 +++++++++++++++++++++++++++ src/test/isolation/isolation_schedule | 1 + src/test/isolation/specs/alter-table-4.spec | 37 +++++++++++++++++ 4 files changed, 97 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Avoid unnecessary failure in SELECT concurrent with ALTER NO INH @ 2018-01-12 20:47 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2018-01-12 20:47 UTC (permalink / raw) To: pgsql-committers Avoid unnecessary failure in SELECT concurrent with ALTER NO INHERIT. If a query against an inheritance tree runs concurrently with an ALTER TABLE that's disinheriting one of the tree members, it's possible to get a "could not find inherited attribute" error because after obtaining lock on the removed member, make_inh_translation_list sees that its columns have attinhcount=0 and decides they aren't the columns it's looking for. An ideal fix, perhaps, would avoid including such a just-removed member table in the query at all; but there seems no way to accomplish that without adding expensive catalog rechecks or creating a likelihood of deadlocks. Instead, let's just drop the check on attinhcount. In this way, a query that's included a just-disinherited child will still succeed, which is not a completely unreasonable behavior. This problem has existed for a long time, so back-patch to all supported branches. Also add an isolation test verifying related behaviors. Patch by me; the new isolation test is based on Kyotaro Horiguchi's work. Discussion: https://postgr.es/m/20170626.174612.23936762.horiguchi.kyotaro@lab.ntt.co.jp Branch ------ REL9_6_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/c2a7044a5128a17256c771b545a534c7dccb7736 Modified Files -------------- src/backend/optimizer/prep/prepunion.c | 4 +- src/test/isolation/expected/alter-table-4.out | 57 +++++++++++++++++++++++++++ src/test/isolation/isolation_schedule | 1 + src/test/isolation/specs/alter-table-4.spec | 37 +++++++++++++++++ 4 files changed, 97 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Avoid unnecessary failure in SELECT concurrent with ALTER NO INH @ 2018-01-12 20:47 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2018-01-12 20:47 UTC (permalink / raw) To: pgsql-committers Avoid unnecessary failure in SELECT concurrent with ALTER NO INHERIT. If a query against an inheritance tree runs concurrently with an ALTER TABLE that's disinheriting one of the tree members, it's possible to get a "could not find inherited attribute" error because after obtaining lock on the removed member, make_inh_translation_list sees that its columns have attinhcount=0 and decides they aren't the columns it's looking for. An ideal fix, perhaps, would avoid including such a just-removed member table in the query at all; but there seems no way to accomplish that without adding expensive catalog rechecks or creating a likelihood of deadlocks. Instead, let's just drop the check on attinhcount. In this way, a query that's included a just-disinherited child will still succeed, which is not a completely unreasonable behavior. This problem has existed for a long time, so back-patch to all supported branches. Also add an isolation test verifying related behaviors. Patch by me; the new isolation test is based on Kyotaro Horiguchi's work. Discussion: https://postgr.es/m/20170626.174612.23936762.horiguchi.kyotaro@lab.ntt.co.jp Branch ------ REL9_5_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/a99922f966f57fcccee3b6e02a9df62789493dbc Modified Files -------------- src/backend/optimizer/prep/prepunion.c | 4 +- src/test/isolation/expected/alter-table-4.out | 57 +++++++++++++++++++++++++++ src/test/isolation/isolation_schedule | 1 + src/test/isolation/specs/alter-table-4.spec | 37 +++++++++++++++++ 4 files changed, 97 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Avoid unnecessary failure in SELECT concurrent with ALTER NO INH @ 2018-01-12 20:47 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2018-01-12 20:47 UTC (permalink / raw) To: pgsql-committers Avoid unnecessary failure in SELECT concurrent with ALTER NO INHERIT. If a query against an inheritance tree runs concurrently with an ALTER TABLE that's disinheriting one of the tree members, it's possible to get a "could not find inherited attribute" error because after obtaining lock on the removed member, make_inh_translation_list sees that its columns have attinhcount=0 and decides they aren't the columns it's looking for. An ideal fix, perhaps, would avoid including such a just-removed member table in the query at all; but there seems no way to accomplish that without adding expensive catalog rechecks or creating a likelihood of deadlocks. Instead, let's just drop the check on attinhcount. In this way, a query that's included a just-disinherited child will still succeed, which is not a completely unreasonable behavior. This problem has existed for a long time, so back-patch to all supported branches. Also add an isolation test verifying related behaviors. Patch by me; the new isolation test is based on Kyotaro Horiguchi's work. Discussion: https://postgr.es/m/20170626.174612.23936762.horiguchi.kyotaro@lab.ntt.co.jp Branch ------ REL9_4_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/8b0e5e7e7cf0f205d93677b39b4fcbe60dce3b34 Modified Files -------------- src/backend/optimizer/prep/prepunion.c | 4 +- src/test/isolation/expected/alter-table-4.out | 57 +++++++++++++++++++++++++++ src/test/isolation/isolation_schedule | 1 + src/test/isolation/specs/alter-table-4.spec | 37 +++++++++++++++++ 4 files changed, 97 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Avoid unnecessary failure in SELECT concurrent with ALTER NO INH @ 2018-01-12 20:47 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2018-01-12 20:47 UTC (permalink / raw) To: pgsql-committers Avoid unnecessary failure in SELECT concurrent with ALTER NO INHERIT. If a query against an inheritance tree runs concurrently with an ALTER TABLE that's disinheriting one of the tree members, it's possible to get a "could not find inherited attribute" error because after obtaining lock on the removed member, make_inh_translation_list sees that its columns have attinhcount=0 and decides they aren't the columns it's looking for. An ideal fix, perhaps, would avoid including such a just-removed member table in the query at all; but there seems no way to accomplish that without adding expensive catalog rechecks or creating a likelihood of deadlocks. Instead, let's just drop the check on attinhcount. In this way, a query that's included a just-disinherited child will still succeed, which is not a completely unreasonable behavior. This problem has existed for a long time, so back-patch to all supported branches. Also add an isolation test verifying related behaviors. Patch by me; the new isolation test is based on Kyotaro Horiguchi's work. Discussion: https://postgr.es/m/20170626.174612.23936762.horiguchi.kyotaro@lab.ntt.co.jp Branch ------ REL9_3_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/4e71700584de1e7db6b05257f61dc643e4bea2bf Modified Files -------------- src/backend/optimizer/prep/prepunion.c | 4 +- src/test/isolation/expected/alter-table-4.out | 57 +++++++++++++++++++++++++++ src/test/isolation/isolation_schedule | 1 + src/test/isolation/specs/alter-table-4.spec | 37 +++++++++++++++++ 4 files changed, 97 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2018-01-12 20:47 UTC | newest] Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2018-01-12 20:47 pgsql: Avoid unnecessary failure in SELECT concurrent with ALTER NO INH Tom Lane <tgl@sss.pgh.pa.us> 2018-01-12 20:47 pgsql: Avoid unnecessary failure in SELECT concurrent with ALTER NO INH Tom Lane <tgl@sss.pgh.pa.us> 2018-01-12 20:47 pgsql: Avoid unnecessary failure in SELECT concurrent with ALTER NO INH Tom Lane <tgl@sss.pgh.pa.us> 2018-01-12 20:47 pgsql: Avoid unnecessary failure in SELECT concurrent with ALTER NO INH Tom Lane <tgl@sss.pgh.pa.us> 2018-01-12 20:47 pgsql: Avoid unnecessary failure in SELECT concurrent with ALTER NO INH Tom Lane <tgl@sss.pgh.pa.us> 2018-01-12 20:47 pgsql: Avoid unnecessary failure in SELECT concurrent with ALTER NO INH 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