Incorrect relation locked at beginning of REINDEX CONCURRENTLY
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Postgres hackers <pgsql-hackers@lists.postgresql.org>
Date: 2019-10-21T07:43:23Z
Lists: pgsql-hackers
Attachments
- reindex-conc-lock.patch (text/x-diff) patch
Hi all, While digging into the issues reported lately about REINDEX CONCURRENTLY, I have bumped into the following, independent, issue: /* Now open the relation of the new index, a lock is also needed on it */ newIndexRel = index_open(indexId, ShareUpdateExclusiveLock) In this code path, indexId is the OID od the old index copied, and newIndexId is the OID of the new index created. So that's clearly incorrect, and the comment even says the intention. This causes for example the same session lock to be taken twice on the old index, with the new index remaining unprotected. Any objections if I fix this issue as per the attached? -- Michael
Commits
-
Acquire properly session-level lock on new index in REINDEX CONCURRENTLY
- 7668d48477ed 12.1 landed
- 5d3500da7261 13.0 landed