summaryrefslogtreecommitdiff
path: root/src/backend/access/hash/hashinsert.c
diff options
context:
space:
mode:
authorTeodor Sigaev <teodor@sigaev.ru>2018-04-07 16:59:14 +0300
committerTeodor Sigaev <teodor@sigaev.ru>2018-04-07 16:59:14 +0300
commitb508a56f2f3a2d850e75a14661943d6b4dde8274 (patch)
tree1c8e5b683669f19cf27606f472628fb162421bdd /src/backend/access/hash/hashinsert.c
parent971d7ddbe19ad9525457e65d01b8b6504ab57cc4 (diff)
downloadpostgresql-b508a56f2f3a2d850e75a14661943d6b4dde8274.tar.gz
Predicate locking in hash indexes.
Hash index searches acquire predicate locks on the primary page of a bucket. It acquires a lock on both the old and new buckets for scans that happen concurrently with page splits. During a bucket split, a predicate lock is copied from the primary page of an old bucket to the primary page of a new bucket. Author: Shubham Barai, Amit Kapila Reviewed by: Amit Kapila, Alexander Korotkov, Thomas Munro Discussion: https://www.postgresql.org/message-id/flat/CALxAEPvNsM2GTiXdRgaaZ1Pjd1bs+sxfFsf7Ytr+iq+5JJoYXA@mail.gmail.com
Diffstat (limited to 'src/backend/access/hash/hashinsert.c')
-rw-r--r--src/backend/access/hash/hashinsert.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/backend/access/hash/hashinsert.c b/src/backend/access/hash/hashinsert.c
index f121286b8c..3eb722ce26 100644
--- a/src/backend/access/hash/hashinsert.c
+++ b/src/backend/access/hash/hashinsert.c
@@ -22,6 +22,7 @@
#include "utils/rel.h"
#include "storage/lwlock.h"
#include "storage/buf_internals.h"
+#include "storage/predicate.h"
static void _hash_vacuum_one_page(Relation rel, Buffer metabuf, Buffer buf,
RelFileNode hnode);
@@ -88,6 +89,8 @@ restart_insert:
&usedmetap);
Assert(usedmetap != NULL);
+ CheckForSerializableConflictIn(rel, NULL, buf);
+
/* remember the primary bucket buffer to release the pin on it at end. */
bucket_buf = buf;