diff options
author | Alexander Korotkov | 2018-12-27 01:10:51 +0000 |
---|---|---|
committer | Alexander Korotkov | 2018-12-27 01:24:20 +0000 |
commit | b450abd2551ee30b5bc289c662f5728d87e13a39 (patch) | |
tree | 6d4f6671df05664ade51c6174d80cb23b6c57964 /src/backend/access/gin/ginbtree.c | |
parent | 1e504f01da11db0181d7b28bb30cb5eeb0767184 (diff) |
Remove entry tree root conflict checking from GIN predicate locking
According to README we acquire predicate locks on entry tree leafs and posting
tree roots. However, when ginFindLeafPage() is going to lock leaf in exclusive
mode, then it checks root for conflicts regardless whether it's a entry or
posting tree. Assuming that we never place predicate lock on entry tree root
(excluding corner case when root is leaf), this check is redundant. This
commit removes this check. Now, root conflict checking is controlled by
separate argument of ginFindLeafPage().
Discussion: https://postgr.es/m/CAPpHfdv7rrDyy%3DMgsaK-L9kk0AH7az0B-mdC3w3p0FSb9uoyEg%40mail.gmail.com
Author: Alexander Korotkov
Backpatch-through: 11
Diffstat (limited to 'src/backend/access/gin/ginbtree.c')
-rw-r--r-- | src/backend/access/gin/ginbtree.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/backend/access/gin/ginbtree.c b/src/backend/access/gin/ginbtree.c index d5a568106c5..01a1b0c2d2f 100644 --- a/src/backend/access/gin/ginbtree.c +++ b/src/backend/access/gin/ginbtree.c @@ -72,9 +72,13 @@ ginTraverseLock(Buffer buffer, bool searchMode) * If 'searchmode' is false, on return stack->buffer is exclusively locked, * and the stack represents the full path to the root. Otherwise stack->buffer * is share-locked, and stack->parent is NULL. + * + * If 'rootConflictCheck' is true, tree root is checked for serialization + * conflict. */ GinBtreeStack * -ginFindLeafPage(GinBtree btree, bool searchMode, Snapshot snapshot) +ginFindLeafPage(GinBtree btree, bool searchMode, + bool rootConflictCheck, Snapshot snapshot) { GinBtreeStack *stack; @@ -84,7 +88,7 @@ ginFindLeafPage(GinBtree btree, bool searchMode, Snapshot snapshot) stack->parent = NULL; stack->predictNumber = 1; - if (!searchMode) + if (rootConflictCheck) CheckForSerializableConflictIn(btree->index, NULL, stack->buffer); for (;;) |