Code cleanup. gistfillbuffer accepts InvalidOffsetNumber.
This commit is contained in:
parent
365205dd2a
commit
88b49cdc95
|
@ -8,7 +8,7 @@
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/access/gist/gist.c,v 1.122 2005/06/27 12:45:21 teodor Exp $
|
* $PostgreSQL: pgsql/src/backend/access/gist/gist.c,v 1.123 2005/06/28 15:51:00 teodor Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -421,13 +421,10 @@ gistplacetopage(GISTInsertState *state, GISTSTATE *giststate) {
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* enough space */
|
/* enough space */
|
||||||
OffsetNumber l, off;
|
|
||||||
XLogRecPtr oldlsn;
|
XLogRecPtr oldlsn;
|
||||||
|
|
||||||
off = ( PageIsEmpty(state->stack->page) ) ?
|
gistfillbuffer(state->r, state->stack->page, state->itup, state->ituplen, InvalidOffsetNumber);
|
||||||
FirstOffsetNumber : OffsetNumberNext(PageGetMaxOffsetNumber(state->stack->page));
|
|
||||||
|
|
||||||
l = gistfillbuffer(state->r, state->stack->page, state->itup, state->ituplen, off);
|
|
||||||
oldlsn = PageGetLSN(state->stack->page);
|
oldlsn = PageGetLSN(state->stack->page);
|
||||||
if ( !state->r->rd_istemp ) {
|
if ( !state->r->rd_istemp ) {
|
||||||
OffsetNumber noffs=0, offs[ MAXALIGN( sizeof(OffsetNumber) ) / sizeof(OffsetNumber) ];
|
OffsetNumber noffs=0, offs[ MAXALIGN( sizeof(OffsetNumber) ) / sizeof(OffsetNumber) ];
|
||||||
|
@ -999,10 +996,9 @@ gistSplit(Relation r,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OffsetNumber l;
|
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
|
||||||
l = gistfillbuffer(r, right, rvectup, v.spl_nright, FirstOffsetNumber);
|
gistfillbuffer(r, right, rvectup, v.spl_nright, FirstOffsetNumber);
|
||||||
/* XLOG stuff */
|
/* XLOG stuff */
|
||||||
ROTATEDIST(*dist);
|
ROTATEDIST(*dist);
|
||||||
(*dist)->block.blkno = BufferGetBlockNumber(rightbuf);
|
(*dist)->block.blkno = BufferGetBlockNumber(rightbuf);
|
||||||
|
@ -1035,10 +1031,9 @@ gistSplit(Relation r,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OffsetNumber l;
|
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
|
||||||
l = gistfillbuffer(r, left, lvectup, v.spl_nleft, FirstOffsetNumber);
|
gistfillbuffer(r, left, lvectup, v.spl_nleft, FirstOffsetNumber);
|
||||||
/* XLOG stuff */
|
/* XLOG stuff */
|
||||||
ROTATEDIST(*dist);
|
ROTATEDIST(*dist);
|
||||||
(*dist)->block.blkno = BufferGetBlockNumber(leftbuf);
|
(*dist)->block.blkno = BufferGetBlockNumber(leftbuf);
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/access/gist/gistutil.c,v 1.3 2005/06/27 12:45:22 teodor Exp $
|
* $PostgreSQL: pgsql/src/backend/access/gist/gistutil.c,v 1.4 2005/06/28 15:51:00 teodor Exp $
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
#include "postgres.h"
|
#include "postgres.h"
|
||||||
|
@ -62,6 +62,10 @@ gistfillbuffer(Relation r, Page page, IndexTuple *itup,
|
||||||
OffsetNumber l = InvalidOffsetNumber;
|
OffsetNumber l = InvalidOffsetNumber;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if ( off == InvalidOffsetNumber )
|
||||||
|
off = ( PageIsEmpty(page) ) ? FirstOffsetNumber :
|
||||||
|
OffsetNumberNext(PageGetMaxOffsetNumber(page));
|
||||||
|
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
l = PageAddItem(page, (Item) itup[i], IndexTupleSize(itup[i]),
|
l = PageAddItem(page, (Item) itup[i], IndexTupleSize(itup[i]),
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/access/gist/gistvacuum.c,v 1.3 2005/06/27 12:45:22 teodor Exp $
|
* $PostgreSQL: pgsql/src/backend/access/gist/gistvacuum.c,v 1.4 2005/06/28 15:51:00 teodor Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -199,12 +199,7 @@ gistVacuumUpdate( GistVacuum *gv, BlockNumber blkno, bool needunion ) {
|
||||||
needunion = false; /* gistSplit already forms unions */
|
needunion = false; /* gistSplit already forms unions */
|
||||||
} else {
|
} else {
|
||||||
/* enough free space */
|
/* enough free space */
|
||||||
OffsetNumber off = (PageIsEmpty(page)) ?
|
gistfillbuffer(gv->index, page, addon, curlenaddon, InvalidOffsetNumber);
|
||||||
FirstOffsetNumber
|
|
||||||
:
|
|
||||||
OffsetNumberNext(PageGetMaxOffsetNumber(page));
|
|
||||||
|
|
||||||
gistfillbuffer(gv->index, page, addon, curlenaddon, off);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/access/gist/gistxlog.c,v 1.4 2005/06/27 12:45:22 teodor Exp $
|
* $PostgreSQL: pgsql/src/backend/access/gist/gistxlog.c,v 1.5 2005/06/28 15:51:00 teodor Exp $
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
#include "postgres.h"
|
#include "postgres.h"
|
||||||
|
@ -198,14 +198,8 @@ gistRedoEntryUpdateRecord(XLogRecPtr lsn, XLogRecord *record, bool isnewroot) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add tuples */
|
/* add tuples */
|
||||||
if ( xlrec.len > 0 ) {
|
if ( xlrec.len > 0 )
|
||||||
OffsetNumber off = (PageIsEmpty(page)) ?
|
gistfillbuffer(reln, page, xlrec.itup, xlrec.len, InvalidOffsetNumber);
|
||||||
FirstOffsetNumber
|
|
||||||
:
|
|
||||||
OffsetNumberNext(PageGetMaxOffsetNumber(page));
|
|
||||||
|
|
||||||
gistfillbuffer(reln, page, xlrec.itup, xlrec.len, off);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* special case: leafpage, nothing to insert, nothing to delete, then
|
/* special case: leafpage, nothing to insert, nothing to delete, then
|
||||||
vacuum marks page */
|
vacuum marks page */
|
||||||
|
@ -623,9 +617,7 @@ gistContinueInsert(gistIncompleteInsert *insert) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
gistfillbuffer( index, pages[numbuffer-1], itup, lenitup,
|
gistfillbuffer( index, pages[numbuffer-1], itup, lenitup, InvalidOffsetNumber);
|
||||||
(PageIsEmpty(pages[numbuffer-1])) ?
|
|
||||||
FirstOffsetNumber : OffsetNumberNext(PageGetMaxOffsetNumber(pages[numbuffer-1])) );
|
|
||||||
|
|
||||||
lenitup=numbuffer;
|
lenitup=numbuffer;
|
||||||
for(j=0;j<numbuffer;j++) {
|
for(j=0;j<numbuffer;j++) {
|
||||||
|
|
Loading…
Reference in New Issue