Deadlock in multiple CIC.

Jeff Janes <jeff.janes@gmail.com>

From: Jeff Janes <jeff.janes@gmail.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2017-12-26T05:31:02Z
Lists: pgsql-hackers

Attachments

c3d09b3bd23f5f6 fixed it so concurrent CIC would not deadlock (or at least
not as reliably as before) by dropping its own snapshot before waiting for
all the other ones to go away.

With commit 8aa3e47510b969354ea02a, concurrent CREATE INDEX CONCURRENTLY on
different tables in the same database started deadlocking against each
other again quite reliably.

I think the solution is simply to drop the catalog snapshot as well, as in
the attached.

reported by Jeremy Finzel here:
https://www.postgresql.org/message-id/flat/CAMa1XUhHjCv8Qkx0WOr1Mpm_R4qxN26EibwCrj0Oor2YBUFUTg%40mail.gmail.com#CAMa1XUhHjCv8Qkx0WOr1Mpm_R4qxN26EibwCrj0Oor2YBUFUTg@mail.gmail.com


Cheers,

Jeff

Commits

  1. Better fix for deadlock hazard in CREATE INDEX CONCURRENTLY.

  2. Add more temporary debug logging, in 9.4 branch only.

  3. Add temporary debug logging, in 9.4 branch only.