Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2ab2344

Browse files
Remove unneeded argument from _bt_getstackbuf().
_bt_getstackbuf() is called at exactly two points following commitefada2b (one call site is concerned with page splits, while theother 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 awrite-lock.
1 parent067786c commit2ab2344

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

‎src/backend/access/nbtree/nbtinsert.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1886,7 +1886,7 @@ _bt_insert_parent(Relation rel,
18861886
* 05/27/97
18871887
*/
18881888
stack->bts_btentry=bknum;
1889-
pbuf=_bt_getstackbuf(rel,stack,BT_WRITE);
1889+
pbuf=_bt_getstackbuf(rel,stack);
18901890

18911891
/*
18921892
* 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)
19761976
*
19771977
*Adjusts bts_blkno & bts_offset if changed.
19781978
*
1979-
*Returns InvalidBuffer if item not found (should not happen).
1979+
*Returns write-locked buffer, or InvalidBuffer if item not found
1980+
*(should not happen).
19801981
*/
19811982
Buffer
1982-
_bt_getstackbuf(Relationrel,BTStackstack,intaccess)
1983+
_bt_getstackbuf(Relationrel,BTStackstack)
19831984
{
19841985
BlockNumberblkno;
19851986
OffsetNumberstart;
@@ -1993,11 +1994,11 @@ _bt_getstackbuf(Relation rel, BTStack stack, int access)
19931994
Pagepage;
19941995
BTPageOpaqueopaque;
19951996

1996-
buf=_bt_getbuf(rel,blkno,access);
1997+
buf=_bt_getbuf(rel,blkno,BT_WRITE);
19971998
page=BufferGetPage(buf);
19981999
opaque= (BTPageOpaque)PageGetSpecialPointer(page);
19992000

2000-
if (access==BT_WRITE&&P_INCOMPLETE_SPLIT(opaque))
2001+
if (P_INCOMPLETE_SPLIT(opaque))
20012002
{
20022003
_bt_finish_split(rel,buf,stack->bts_parent);
20032004
continue;

‎src/backend/access/nbtree/nbtpage.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1153,7 +1153,7 @@ _bt_lock_branch_parent(Relation rel, BlockNumber child, BTStack stack,
11531153
* if needed)
11541154
*/
11551155
stack->bts_btentry=child;
1156-
pbuf=_bt_getstackbuf(rel,stack,BT_WRITE);
1156+
pbuf=_bt_getstackbuf(rel,stack);
11571157
if (pbuf==InvalidBuffer)
11581158
elog(ERROR,"failed to re-find parent key in index \"%s\" for deletion target page %u",
11591159
RelationGetRelationName(rel),child);

‎src/include/access/nbtree.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ extern void _bt_parallel_advance_array_keys(IndexScanDesc scan);
528528
*/
529529
externbool_bt_doinsert(Relationrel,IndexTupleitup,
530530
IndexUniqueCheckcheckUnique,RelationheapRel);
531-
externBuffer_bt_getstackbuf(Relationrel,BTStackstack,intaccess);
531+
externBuffer_bt_getstackbuf(Relationrel,BTStackstack);
532532
externvoid_bt_finish_split(Relationrel,Bufferbbuf,BTStackstack);
533533

534534
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp