pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Prevent deadlock in ginRedoDeletePage()
6+ messages / 1 participants
[nested] [flat]

* pgsql: Prevent deadlock in ginRedoDeletePage()
@ 2018-12-13 03:55 Alexander Korotkov <akorotkov@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

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

Prevent deadlock in ginRedoDeletePage()

On standby ginRedoDeletePage() can work concurrently with read-only queries.
Those queries can traverse posting tree in two ways.
1) Using rightlinks by ginStepRight(), which locks the next page before
   unlocking its left sibling.
2) Using downlinks by ginFindLeafPage(), which locks at most one page at time.

Original lock order was: page, parent, left sibling.  That lock order can
deadlock with ginStepRight().  In order to prevent deadlock this commit changes
lock order to: left sibling, page, parent.  Note, that position of parent in
locking order seems insignificant, because we only lock one page at time while
traversing downlinks.

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

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/225b5c9c480fa90d4734ce4a8d1a4b46ac5e826e

Modified Files
--------------
src/backend/access/gin/ginxlog.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)



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

* pgsql: Prevent deadlock in ginRedoDeletePage()
@ 2018-12-13 03:56 Alexander Korotkov <akorotkov@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

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

Prevent deadlock in ginRedoDeletePage()

On standby ginRedoDeletePage() can work concurrently with read-only queries.
Those queries can traverse posting tree in two ways.
1) Using rightlinks by ginStepRight(), which locks the next page before
   unlocking its left sibling.
2) Using downlinks by ginFindLeafPage(), which locks at most one page at time.

Original lock order was: page, parent, left sibling.  That lock order can
deadlock with ginStepRight().  In order to prevent deadlock this commit changes
lock order to: left sibling, page, parent.  Note, that position of parent in
locking order seems insignificant, because we only lock one page at time while
traversing downlinks.

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

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/865870374aff35b886afac12e71542a1b079a021

Modified Files
--------------
src/backend/access/gin/ginxlog.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)



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

* pgsql: Prevent deadlock in ginRedoDeletePage()
@ 2018-12-13 03:56 Alexander Korotkov <akorotkov@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

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

Prevent deadlock in ginRedoDeletePage()

On standby ginRedoDeletePage() can work concurrently with read-only queries.
Those queries can traverse posting tree in two ways.
1) Using rightlinks by ginStepRight(), which locks the next page before
   unlocking its left sibling.
2) Using downlinks by ginFindLeafPage(), which locks at most one page at time.

Original lock order was: page, parent, left sibling.  That lock order can
deadlock with ginStepRight().  In order to prevent deadlock this commit changes
lock order to: left sibling, page, parent.  Note, that position of parent in
locking order seems insignificant, because we only lock one page at time while
traversing downlinks.

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

Branch
------
REL9_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/80d4d8d71d57cc336e00e448f14c1b70ad8bc85f

Modified Files
--------------
src/backend/access/gin/ginxlog.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)



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

* pgsql: Prevent deadlock in ginRedoDeletePage()
@ 2018-12-13 03:56 Alexander Korotkov <akorotkov@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

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

Prevent deadlock in ginRedoDeletePage()

On standby ginRedoDeletePage() can work concurrently with read-only queries.
Those queries can traverse posting tree in two ways.
1) Using rightlinks by ginStepRight(), which locks the next page before
   unlocking its left sibling.
2) Using downlinks by ginFindLeafPage(), which locks at most one page at time.

Original lock order was: page, parent, left sibling.  That lock order can
deadlock with ginStepRight().  In order to prevent deadlock this commit changes
lock order to: left sibling, page, parent.  Note, that position of parent in
locking order seems insignificant, because we only lock one page at time while
traversing downlinks.

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

Branch
------
REL9_5_STABLE

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

Modified Files
--------------
src/backend/access/gin/ginxlog.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)



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

* pgsql: Prevent deadlock in ginRedoDeletePage()
@ 2018-12-13 03:56 Alexander Korotkov <akorotkov@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

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

Prevent deadlock in ginRedoDeletePage()

On standby ginRedoDeletePage() can work concurrently with read-only queries.
Those queries can traverse posting tree in two ways.
1) Using rightlinks by ginStepRight(), which locks the next page before
   unlocking its left sibling.
2) Using downlinks by ginFindLeafPage(), which locks at most one page at time.

Original lock order was: page, parent, left sibling.  That lock order can
deadlock with ginStepRight().  In order to prevent deadlock this commit changes
lock order to: left sibling, page, parent.  Note, that position of parent in
locking order seems insignificant, because we only lock one page at time while
traversing downlinks.

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

Branch
------
REL9_4_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/19cf52e6cc33b9e126775f28269ccccb6ddf7e30

Modified Files
--------------
src/backend/access/gin/ginxlog.c | 44 +++++++++++++++++++++++-----------------
1 file changed, 25 insertions(+), 19 deletions(-)



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

* pgsql: Prevent deadlock in ginRedoDeletePage()
@ 2018-12-13 03:56 Alexander Korotkov <akorotkov@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

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

Prevent deadlock in ginRedoDeletePage()

On standby ginRedoDeletePage() can work concurrently with read-only queries.
Those queries can traverse posting tree in two ways.
1) Using rightlinks by ginStepRight(), which locks the next page before
   unlocking its left sibling.
2) Using downlinks by ginFindLeafPage(), which locks at most one page at time.

Original lock order was: page, parent, left sibling.  That lock order can
deadlock with ginStepRight().  In order to prevent deadlock this commit changes
lock order to: left sibling, page, parent.  Note, that position of parent in
locking order seems insignificant, because we only lock one page at time while
traversing downlinks.

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

Branch
------
master

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

Modified Files
--------------
src/backend/access/gin/ginxlog.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)



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


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

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