8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.124 2005/08/11 13: 22:33 momjian Exp $
11
+ * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.125 2005/09/24 22:54:35 tgl Exp $
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
@@ -49,8 +49,7 @@ static void _bt_insertonpg(Relation rel, Buffer buf,
49
49
bool split_only_page );
50
50
static Buffer _bt_split (Relation rel , Buffer buf , OffsetNumber firstright ,
51
51
OffsetNumber newitemoff , Size newitemsz ,
52
- BTItem newitem , bool newitemonleft ,
53
- OffsetNumber * itup_off , BlockNumber * itup_blkno );
52
+ BTItem newitem , bool newitemonleft );
54
53
static OffsetNumber _bt_findsplitloc (Relation rel , Page page ,
55
54
OffsetNumber newitemoff ,
56
55
Size newitemsz ,
@@ -365,8 +364,6 @@ _bt_insertonpg(Relation rel,
365
364
{
366
365
Page page ;
367
366
BTPageOpaque lpageop ;
368
- OffsetNumber itup_off ;
369
- BlockNumber itup_blkno ;
370
367
OffsetNumber newitemoff ;
371
368
OffsetNumber firstright = InvalidOffsetNumber ;
372
369
Size itemsz ;
@@ -490,8 +487,7 @@ _bt_insertonpg(Relation rel,
490
487
491
488
/* split the buffer into left and right halves */
492
489
rbuf = _bt_split (rel , buf , firstright ,
493
- newitemoff , itemsz , btitem , newitemonleft ,
494
- & itup_off , & itup_blkno );
490
+ newitemoff , itemsz , btitem , newitemonleft );
495
491
496
492
/*----------
497
493
* By here,
@@ -516,6 +512,8 @@ _bt_insertonpg(Relation rel,
516
512
Buffer metabuf = InvalidBuffer ;
517
513
Page metapg = NULL ;
518
514
BTMetaPageData * metad = NULL ;
515
+ OffsetNumber itup_off ;
516
+ BlockNumber itup_blkno ;
519
517
520
518
itup_off = newitemoff ;
521
519
itup_blkno = BufferGetBlockNumber (buf );
@@ -640,14 +638,12 @@ _bt_insertonpg(Relation rel,
640
638
* must be inserted along with the data from the old page.
641
639
*
642
640
* Returns the new right sibling of buf, pinned and write-locked.
643
- * The pin and lock on buf are maintained. *itup_off and *itup_blkno
644
- * are set to the exact location where newitem was inserted.
641
+ * The pin and lock on buf are maintained.
645
642
*/
646
643
static Buffer
647
644
_bt_split (Relation rel , Buffer buf , OffsetNumber firstright ,
648
645
OffsetNumber newitemoff , Size newitemsz , BTItem newitem ,
649
- bool newitemonleft ,
650
- OffsetNumber * itup_off , BlockNumber * itup_blkno )
646
+ bool newitemonleft )
651
647
{
652
648
Buffer rbuf ;
653
649
Page origpage ;
@@ -659,6 +655,8 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
659
655
Buffer sbuf = InvalidBuffer ;
660
656
Page spage = NULL ;
661
657
BTPageOpaque sopaque = NULL ;
658
+ OffsetNumber itup_off = 0 ;
659
+ BlockNumber itup_blkno = 0 ;
662
660
Size itemsz ;
663
661
ItemId itemid ;
664
662
BTItem item ;
@@ -752,16 +750,16 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
752
750
{
753
751
_bt_pgaddtup (rel , leftpage , newitemsz , newitem , leftoff ,
754
752
"left sibling" );
755
- * itup_off = leftoff ;
756
- * itup_blkno = BufferGetBlockNumber (buf );
753
+ itup_off = leftoff ;
754
+ itup_blkno = BufferGetBlockNumber (buf );
757
755
leftoff = OffsetNumberNext (leftoff );
758
756
}
759
757
else
760
758
{
761
759
_bt_pgaddtup (rel , rightpage , newitemsz , newitem , rightoff ,
762
760
"right sibling" );
763
- * itup_off = rightoff ;
764
- * itup_blkno = BufferGetBlockNumber (rbuf );
761
+ itup_off = rightoff ;
762
+ itup_blkno = BufferGetBlockNumber (rbuf );
765
763
rightoff = OffsetNumberNext (rightoff );
766
764
}
767
765
}
@@ -788,16 +786,16 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
788
786
{
789
787
_bt_pgaddtup (rel , leftpage , newitemsz , newitem , leftoff ,
790
788
"left sibling" );
791
- * itup_off = leftoff ;
792
- * itup_blkno = BufferGetBlockNumber (buf );
789
+ itup_off = leftoff ;
790
+ itup_blkno = BufferGetBlockNumber (buf );
793
791
leftoff = OffsetNumberNext (leftoff );
794
792
}
795
793
else
796
794
{
797
795
_bt_pgaddtup (rel , rightpage , newitemsz , newitem , rightoff ,
798
796
"right sibling" );
799
- * itup_off = rightoff ;
800
- * itup_blkno = BufferGetBlockNumber (rbuf );
797
+ itup_off = rightoff ;
798
+ itup_blkno = BufferGetBlockNumber (rbuf );
801
799
rightoff = OffsetNumberNext (rightoff );
802
800
}
803
801
}
@@ -839,7 +837,7 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
839
837
XLogRecData rdata [4 ];
840
838
841
839
xlrec .target .node = rel -> rd_node ;
842
- ItemPointerSet (& (xlrec .target .tid ), * itup_blkno , * itup_off );
840
+ ItemPointerSet (& (xlrec .target .tid ), itup_blkno , itup_off );
843
841
if (newitemonleft )
844
842
xlrec .otherblk = BufferGetBlockNumber (rbuf );
845
843
else
0 commit comments