Skip to content

Commit a71a530

Browse files
committed
Repair error with not adjusting active scans properly after gistSplit.
Patch from Teodor Sigaev.
1 parent 6005c50 commit a71a530

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/backend/access/gist/gist.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.93 2002/05/24 18:57:55 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.94 2002/05/28 15:22:33 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -494,6 +494,14 @@ gistlayerinsert(Relation r, BlockNumber blkno,
494494
/* key is modified, so old version must be deleted */
495495
ItemPointerSet(&oldtid, blkno, child);
496496
gistdelete(r, &oldtid);
497+
498+
/*
499+
* if child was splitted, new key for child will be inserted
500+
* in the end list of child, so we must say to any scans
501+
* that page is changed beginning from 'child' offset
502+
*/
503+
if ( ret & SPLITED )
504+
gistadjscans(r, GISTOP_SPLIT, blkno, child);
497505
}
498506

499507
ret = INSERTED;
@@ -1411,10 +1419,6 @@ gistSplit(Relation r,
14111419
ItemPointerSet(&(newtup[nlen - 1]->t_tid), lbknum, 1);
14121420
}
14131421

1414-
1415-
/* adjust active scans */
1416-
gistadjscans(r, GISTOP_SPLIT, BufferGetBlockNumber(buffer), FirstOffsetNumber);
1417-
14181422
/* !!! pfree */
14191423
pfree(rvectup);
14201424
pfree(lvectup);

0 commit comments

Comments
 (0)