aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/gin/ginutil.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/access/gin/ginutil.c')
-rw-r--r--src/backend/access/gin/ginutil.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/backend/access/gin/ginutil.c b/src/backend/access/gin/ginutil.c
index 03fec1704e9..437f24753c0 100644
--- a/src/backend/access/gin/ginutil.c
+++ b/src/backend/access/gin/ginutil.c
@@ -299,7 +299,6 @@ Buffer
GinNewBuffer(Relation index)
{
Buffer buffer;
- bool needLock;
/* First, try to get a page from FSM */
for (;;)
@@ -328,15 +327,8 @@ GinNewBuffer(Relation index)
}
/* Must extend the file */
- needLock = !RELATION_IS_LOCAL(index);
- if (needLock)
- LockRelationForExtension(index, ExclusiveLock);
-
- buffer = ReadBuffer(index, P_NEW);
- LockBuffer(buffer, GIN_EXCLUSIVE);
-
- if (needLock)
- UnlockRelationForExtension(index, ExclusiveLock);
+ buffer = ExtendBufferedRel(EB_REL(index), MAIN_FORKNUM, NULL,
+ EB_LOCK_FIRST);
return buffer;
}