aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/nbtree/nbtinsert.c
diff options
context:
space:
mode:
authorPeter Geoghegan <pg@bowt.ie>2019-02-25 17:47:43 -0800
committerPeter Geoghegan <pg@bowt.ie>2019-02-25 17:47:43 -0800
commit2ab23445bc6af517bddb40d8429146d8ff8d7ff4 (patch)
treeedb02d52bf39ee44dd229d7886d35484df9aa5f7 /src/backend/access/nbtree/nbtinsert.c
parent067786cea0f150ccf9350abb9a5ac3e4ad328804 (diff)
downloadpostgresql-2ab23445bc6af517bddb40d8429146d8ff8d7ff4.tar.gz
postgresql-2ab23445bc6af517bddb40d8429146d8ff8d7ff4.zip
Remove unneeded argument from _bt_getstackbuf().
_bt_getstackbuf() is called at exactly two points following commit efada2b8e92 (one call site is concerned with page splits, while the other is concerned with page deletion). The parent buffer returned by _bt_getstackbuf() is write-locked in both cases. Remove the 'access' argument and make _bt_getstackbuf() assume that callers require a write-lock.
Diffstat (limited to 'src/backend/access/nbtree/nbtinsert.c')
-rw-r--r--src/backend/access/nbtree/nbtinsert.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/backend/access/nbtree/nbtinsert.c b/src/backend/access/nbtree/nbtinsert.c
index 5c2b8034f5e..a4d46a0f446 100644
--- a/src/backend/access/nbtree/nbtinsert.c
+++ b/src/backend/access/nbtree/nbtinsert.c
@@ -1886,7 +1886,7 @@ _bt_insert_parent(Relation rel,
* 05/27/97
*/
stack->bts_btentry = bknum;
- pbuf = _bt_getstackbuf(rel, stack, BT_WRITE);
+ pbuf = _bt_getstackbuf(rel, stack);
/*
* Now we can unlock the right child. The left child will be unlocked
@@ -1976,10 +1976,11 @@ _bt_finish_split(Relation rel, Buffer lbuf, BTStack stack)
*
* Adjusts bts_blkno & bts_offset if changed.
*
- * Returns InvalidBuffer if item not found (should not happen).
+ * Returns write-locked buffer, or InvalidBuffer if item not found
+ * (should not happen).
*/
Buffer
-_bt_getstackbuf(Relation rel, BTStack stack, int access)
+_bt_getstackbuf(Relation rel, BTStack stack)
{
BlockNumber blkno;
OffsetNumber start;
@@ -1993,11 +1994,11 @@ _bt_getstackbuf(Relation rel, BTStack stack, int access)
Page page;
BTPageOpaque opaque;
- buf = _bt_getbuf(rel, blkno, access);
+ buf = _bt_getbuf(rel, blkno, BT_WRITE);
page = BufferGetPage(buf);
opaque = (BTPageOpaque) PageGetSpecialPointer(page);
- if (access == BT_WRITE && P_INCOMPLETE_SPLIT(opaque))
+ if (P_INCOMPLETE_SPLIT(opaque))
{
_bt_finish_split(rel, buf, stack->bts_parent);
continue;