0002-Obtain-a-RowExclusiveLock-on-the-index-relation-with.patch
text/x-patch
Filename: 0002-Obtain-a-RowExclusiveLock-on-the-index-relation-with.patch
Type: text/x-patch
Part: 1
Patch
Format: format-patch
Series: patch 0002
Subject: Obtain a RowExclusiveLock on the index relation within _bt_worker_main(), because that's all the leader has at that point within CREATE INDEX CONCURRENTLY.
| File | + | − |
|---|---|---|
| src/backend/access/nbtree/nbtsort.c | 1 | 3 |
From d382bfcec141bc1dd0d0543b3ce298893b1bfd19 Mon Sep 17 00:00:00 2001 From: Rushabh Lathia <rushabh.lathia@enterprisedb.com> Date: Tue, 12 Dec 2017 14:41:24 +0530 Subject: [PATCH 2/3] Obtain a RowExclusiveLock on the index relation within _bt_worker_main(), because that's all the leader has at that point within CREATE INDEX CONCURRENTLY. --- src/backend/access/nbtree/nbtsort.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/backend/access/nbtree/nbtsort.c b/src/backend/access/nbtree/nbtsort.c index 9ce7530..52265ac 100644 --- a/src/backend/access/nbtree/nbtsort.c +++ b/src/backend/access/nbtree/nbtsort.c @@ -1513,9 +1513,7 @@ _bt_worker_main(dsm_segment *seg, shm_toc *toc) heapLockmode = ShareLock; else heapLockmode = ShareUpdateExclusiveLock; - - /* REINDEX and CREATE INDEX [CONCURRENTLY] use an AccessExclusiveLock */ - indexLockmode = AccessExclusiveLock; + indexLockmode = btshared->isconcurrent ? RowExclusiveLock : AccessExclusiveLock; /* Open relations here, for worker */ heapRel = heap_open(btshared->heaprelid, heapLockmode); -- 1.8.3.1