pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix deadlock between ginDeletePage() and ginStepRight() 4+ messages / 1 participants [nested] [flat]
* pgsql: Fix deadlock between ginDeletePage() and ginStepRight() @ 2019-11-19 21:08 Alexander Korotkov <akorotkov@postgresql.org> 0 siblings, 0 replies; 4+ messages in thread From: Alexander Korotkov @ 2019-11-19 21:08 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix deadlock between ginDeletePage() and ginStepRight() When ginDeletePage() is about to delete page it locks its left sibling to revise the rightlink. So, it locks pages in right to left manner. Int he same time ginStepRight() locks pages in left to right manner, and that could cause a deadlock. This commit makes ginScanToDelete() keep exclusive lock on left siblings of currently investigated path. That elimites need to relock left sibling in ginDeletePage(). Thus, deadlock with ginStepRight() can't happen anymore. Reported-by: Chen Huajun Discussion: https://postgr.es/m/5c332bd1.87b6.16d7c17aa98.Coremail.chjischj%40163.com Author: Alexander Korotkov Reviewed-by: Peter Geoghegan Backpatch-through: 10 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/e14641197a5690d92cc48446d0d40f1aec07bac7 Modified Files -------------- src/backend/access/gin/README | 79 ++++++++++++++++++++++---------------- src/backend/access/gin/ginvacuum.c | 54 +++++++++++++++++--------- 2 files changed, 81 insertions(+), 52 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Fix deadlock between ginDeletePage() and ginStepRight() @ 2019-11-19 21:08 Alexander Korotkov <akorotkov@postgresql.org> 0 siblings, 0 replies; 4+ messages in thread From: Alexander Korotkov @ 2019-11-19 21:08 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix deadlock between ginDeletePage() and ginStepRight() When ginDeletePage() is about to delete page it locks its left sibling to revise the rightlink. So, it locks pages in right to left manner. Int he same time ginStepRight() locks pages in left to right manner, and that could cause a deadlock. This commit makes ginScanToDelete() keep exclusive lock on left siblings of currently investigated path. That elimites need to relock left sibling in ginDeletePage(). Thus, deadlock with ginStepRight() can't happen anymore. Reported-by: Chen Huajun Discussion: https://postgr.es/m/5c332bd1.87b6.16d7c17aa98.Coremail.chjischj%40163.com Author: Alexander Korotkov Reviewed-by: Peter Geoghegan Backpatch-through: 10 Branch ------ REL_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/051c50c01c32ceb498d53e78f48297713744b7cb Modified Files -------------- src/backend/access/gin/README | 79 ++++++++++++++++++++++---------------- src/backend/access/gin/ginvacuum.c | 54 +++++++++++++++++--------- 2 files changed, 81 insertions(+), 52 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Fix deadlock between ginDeletePage() and ginStepRight() @ 2019-11-19 21:08 Alexander Korotkov <akorotkov@postgresql.org> 0 siblings, 0 replies; 4+ messages in thread From: Alexander Korotkov @ 2019-11-19 21:08 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix deadlock between ginDeletePage() and ginStepRight() When ginDeletePage() is about to delete page it locks its left sibling to revise the rightlink. So, it locks pages in right to left manner. Int he same time ginStepRight() locks pages in left to right manner, and that could cause a deadlock. This commit makes ginScanToDelete() keep exclusive lock on left siblings of currently investigated path. That elimites need to relock left sibling in ginDeletePage(). Thus, deadlock with ginStepRight() can't happen anymore. Reported-by: Chen Huajun Discussion: https://postgr.es/m/5c332bd1.87b6.16d7c17aa98.Coremail.chjischj%40163.com Author: Alexander Korotkov Reviewed-by: Peter Geoghegan Backpatch-through: 10 Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/9f292798992ee8efe3281ba61db3c53ea7007b1a Modified Files -------------- src/backend/access/gin/README | 79 ++++++++++++++++++++++---------------- src/backend/access/gin/ginvacuum.c | 54 +++++++++++++++++--------- 2 files changed, 81 insertions(+), 52 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Fix deadlock between ginDeletePage() and ginStepRight() @ 2019-11-19 21:08 Alexander Korotkov <akorotkov@postgresql.org> 0 siblings, 0 replies; 4+ messages in thread From: Alexander Korotkov @ 2019-11-19 21:08 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix deadlock between ginDeletePage() and ginStepRight() When ginDeletePage() is about to delete page it locks its left sibling to revise the rightlink. So, it locks pages in right to left manner. Int he same time ginStepRight() locks pages in left to right manner, and that could cause a deadlock. This commit makes ginScanToDelete() keep exclusive lock on left siblings of currently investigated path. That elimites need to relock left sibling in ginDeletePage(). Thus, deadlock with ginStepRight() can't happen anymore. Reported-by: Chen Huajun Discussion: https://postgr.es/m/5c332bd1.87b6.16d7c17aa98.Coremail.chjischj%40163.com Author: Alexander Korotkov Reviewed-by: Peter Geoghegan Backpatch-through: 10 Branch ------ REL_10_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/21ad61ab31786128ae780feca8fcf766bbb6a579 Modified Files -------------- src/backend/access/gin/README | 79 ++++++++++++++++++++++---------------- src/backend/access/gin/ginvacuum.c | 54 +++++++++++++++++--------- 2 files changed, 81 insertions(+), 52 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2019-11-19 21:08 UTC | newest] Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2019-11-19 21:08 pgsql: Fix deadlock between ginDeletePage() and ginStepRight() Alexander Korotkov <akorotkov@postgresql.org> 2019-11-19 21:08 pgsql: Fix deadlock between ginDeletePage() and ginStepRight() Alexander Korotkov <akorotkov@postgresql.org> 2019-11-19 21:08 pgsql: Fix deadlock between ginDeletePage() and ginStepRight() Alexander Korotkov <akorotkov@postgresql.org> 2019-11-19 21:08 pgsql: Fix deadlock between ginDeletePage() and ginStepRight() Alexander Korotkov <akorotkov@postgresql.org>
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