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

Commit88dc31e

Browse files
committed
First cut at recycling space in btree indexes. Still some rough edges
to fix, but it seems to basically work...
1 parent2785491 commit88dc31e

File tree

8 files changed

+745
-32
lines changed

8 files changed

+745
-32
lines changed

‎src/backend/access/common/indextuple.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.63 2002/11/13 00:39:46 momjian Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.64 2003/02/23 06:17:12 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -394,17 +394,16 @@ nocache_index_getattr(IndexTuple tup,
394394
}
395395

396396
/*
397-
* Copies source into target. If *target == NULL, we palloc space; otherwise
398-
* we assume we have space that is already palloc'ed.
397+
* Create a palloc'd copy of an index tuple.
399398
*/
400-
void
401-
CopyIndexTuple(IndexTuplesource,IndexTuple*target)
399+
IndexTuple
400+
CopyIndexTuple(IndexTuplesource)
402401
{
402+
IndexTupleresult;
403403
Sizesize;
404404

405405
size=IndexTupleSize(source);
406-
if (*target==NULL)
407-
*target= (IndexTuple)palloc(size);
408-
409-
memmove((char*)*target, (char*)source,size);
406+
result= (IndexTuple)palloc(size);
407+
memcpy(result,source,size);
408+
returnresult;
410409
}

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.98 2003/02/22 00:45:03 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.99 2003/02/23 06:17:13 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -58,7 +58,6 @@ static OffsetNumber _bt_findsplitloc(Relation rel, Page page,
5858
staticvoid_bt_checksplitloc(FindSplitData*state,OffsetNumberfirstright,
5959
intleftfree,intrightfree,
6060
boolnewitemonleft,Sizefirstrightitemsz);
61-
staticBuffer_bt_getstackbuf(Relationrel,BTStackstack,intaccess);
6261
staticvoid_bt_pgaddtup(Relationrel,Pagepage,
6362
Sizeitemsize,BTItembtitem,
6463
OffsetNumberitup_off,constchar*where);
@@ -666,7 +665,6 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
666665
rightoff;
667666
OffsetNumbermaxoff;
668667
OffsetNumberi;
669-
BTItemlhikey;
670668

671669
rbuf=_bt_getbuf(rel,P_NEW,BT_WRITE);
672670
origpage=BufferGetPage(buf);
@@ -730,7 +728,6 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
730728
itemsz=ItemIdGetLength(itemid);
731729
item= (BTItem)PageGetItem(origpage,itemid);
732730
}
733-
lhikey=item;
734731
if (PageAddItem(leftpage, (Item)item,itemsz,leftoff,
735732
LP_USED)==InvalidOffsetNumber)
736733
elog(PANIC,"btree: failed to add hikey to the left sibling");
@@ -1262,7 +1259,7 @@ _bt_insert_parent(Relation rel,
12621259
*
12631260
*Returns InvalidBuffer if item not found (should not happen).
12641261
*/
1265-
staticBuffer
1262+
Buffer
12661263
_bt_getstackbuf(Relationrel,BTStackstack,intaccess)
12671264
{
12681265
BlockNumberblkno;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp