From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Fix busted logic for parallel lock grouping in TopoSort(). |
Date: | 2019-07-29 22:49:22 |
Message-ID: | E1hsESI-0005Bb-4r@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Fix busted logic for parallel lock grouping in TopoSort().
A "break" statement erroneously left behind by commit a1c1af2a1
caused TopoSort to do the wrong thing if a lock's wait list
contained multiple members of the same locking group.
Because parallel workers don't normally need any locks not already
taken by their leader, this is very hard --- maybe impossible ---
to hit in production. Still, if it did happen, the queries involved
in an otherwise-resolvable deadlock would block until canceled.
In addition to removing the bogus "break", add an Assert showing
that the conflicting uses of the beforeConstraints[] array (for both
counts and flags) don't overlap, and add some commentary explaining
why not; because it's not obvious without explanation, IMHO.
Original report and patch from Rui Hai Jiang; additional assert
and commentary by me. Back-patch to 9.6 where the bug came in.
Discussion: https://postgr.es/m/CAEri+mLd3bpHLyW+a9pSe1y=aEkeuJpwBSwvo-+m4n7-ceRmXw@mail.gmail.com
Branch
------
REL_12_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/d933816c04c64326419bbcd89dc17a4e310f950b
Modified Files
--------------
src/backend/storage/lmgr/deadlock.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2019-07-30 01:56:48 | pgsql: Fix memory leak coming from simple lists built in reindexdb |
Previous Message | Peter Eisentraut | 2019-07-29 06:06:01 | pgsql: Handle fsync failures in pg_receivewal and pg_recvlogical |