pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix deadlock in GIN vacuum introduced by 218f51584d5
3+ messages / 1 participants
[nested] [flat]

* pgsql: Fix deadlock in GIN vacuum introduced by 218f51584d5
@ 2018-12-13 03:55  Alexander Korotkov <akorotkov@postgresql.org>
  0 siblings, 0 replies; 3+ messages in thread

From: Alexander Korotkov @ 2018-12-13 03:55 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix deadlock in GIN vacuum introduced by 218f51584d5

Before 218f51584d5 if posting tree page is about to be deleted, then the whole
posting tree is locked by LockBufferForCleanup() on root preventing all the
concurrent inserts.  218f51584d5 reduced locking to the subtree containing
page to be deleted.  However, due to concurrent parent split, inserter doesn't
always holds pins on all the pages constituting path from root to the target
leaf page.  That could cause a deadlock between GIN vacuum process and GIN
inserter.  And we didn't find non-invasive way to fix this.

This commit reverts VACUUM behavior to lock the whole posting tree before
delete any page.  However, we keep another useful change by 218f51584d5: the
tree is locked only if there are pages to be deleted.

Reported-by: Chen Huajun
Diagnosed-by: Chen Huajun, Andrey Borodin, Peter Geoghegan
Discussion: https://postgr.es/m/31a702a.14dd.166c1366ac1.Coremail.chjischj%40163.com
Author: Alexander Korotkov, based on ideas from Andrey Borodin and Peter Geoghegan
Reviewed-by: Andrey Borodin
Backpatch-through: 10

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/9aa94d8536f81168b6de3744c1fb4a173af1cefe

Modified Files
--------------
src/backend/access/gin/README      |  15 +---
src/backend/access/gin/ginvacuum.c | 148 +++++++++++++++++--------------------
2 files changed, 73 insertions(+), 90 deletions(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: Fix deadlock in GIN vacuum introduced by 218f51584d5
@ 2018-12-13 03:56  Alexander Korotkov <akorotkov@postgresql.org>
  0 siblings, 0 replies; 3+ messages in thread

From: Alexander Korotkov @ 2018-12-13 03:56 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix deadlock in GIN vacuum introduced by 218f51584d5

Before 218f51584d5 if posting tree page is about to be deleted, then the whole
posting tree is locked by LockBufferForCleanup() on root preventing all the
concurrent inserts.  218f51584d5 reduced locking to the subtree containing
page to be deleted.  However, due to concurrent parent split, inserter doesn't
always holds pins on all the pages constituting path from root to the target
leaf page.  That could cause a deadlock between GIN vacuum process and GIN
inserter.  And we didn't find non-invasive way to fix this.

This commit reverts VACUUM behavior to lock the whole posting tree before
delete any page.  However, we keep another useful change by 218f51584d5: the
tree is locked only if there are pages to be deleted.

Reported-by: Chen Huajun
Diagnosed-by: Chen Huajun, Andrey Borodin, Peter Geoghegan
Discussion: https://postgr.es/m/31a702a.14dd.166c1366ac1.Coremail.chjischj%40163.com
Author: Alexander Korotkov, based on ideas from Andrey Borodin and Peter Geoghegan
Reviewed-by: Andrey Borodin
Backpatch-through: 10

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/2e3bd064e530bfe85257032919cfae20860708cc

Modified Files
--------------
src/backend/access/gin/README      |  15 +---
src/backend/access/gin/ginvacuum.c | 148 +++++++++++++++++--------------------
2 files changed, 73 insertions(+), 90 deletions(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: Fix deadlock in GIN vacuum introduced by 218f51584d5
@ 2018-12-13 03:56  Alexander Korotkov <akorotkov@postgresql.org>
  0 siblings, 0 replies; 3+ messages in thread

From: Alexander Korotkov @ 2018-12-13 03:56 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix deadlock in GIN vacuum introduced by 218f51584d5

Before 218f51584d5 if posting tree page is about to be deleted, then the whole
posting tree is locked by LockBufferForCleanup() on root preventing all the
concurrent inserts.  218f51584d5 reduced locking to the subtree containing
page to be deleted.  However, due to concurrent parent split, inserter doesn't
always holds pins on all the pages constituting path from root to the target
leaf page.  That could cause a deadlock between GIN vacuum process and GIN
inserter.  And we didn't find non-invasive way to fix this.

This commit reverts VACUUM behavior to lock the whole posting tree before
delete any page.  However, we keep another useful change by 218f51584d5: the
tree is locked only if there are pages to be deleted.

Reported-by: Chen Huajun
Diagnosed-by: Chen Huajun, Andrey Borodin, Peter Geoghegan
Discussion: https://postgr.es/m/31a702a.14dd.166c1366ac1.Coremail.chjischj%40163.com
Author: Alexander Korotkov, based on ideas from Andrey Borodin and Peter Geoghegan
Reviewed-by: Andrey Borodin
Backpatch-through: 10

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/fd83c83d0943a6717dbe521efa10da9dce94e4cd

Modified Files
--------------
src/backend/access/gin/README      |  15 +---
src/backend/access/gin/ginvacuum.c | 148 +++++++++++++++++--------------------
2 files changed, 73 insertions(+), 90 deletions(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2018-12-13 03:56 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-12-13 03:55 pgsql: Fix deadlock in GIN vacuum introduced by 218f51584d5 Alexander Korotkov <akorotkov@postgresql.org>
2018-12-13 03:56 pgsql: Fix deadlock in GIN vacuum introduced by 218f51584d5 Alexander Korotkov <akorotkov@postgresql.org>
2018-12-13 03:56 pgsql: Fix deadlock in GIN vacuum introduced by 218f51584d5 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