From: Tom Lane Date: Tue, 28 May 2002 15:22:44 +0000 (+0000) Subject: Repair error with not adjusting active scans properly after gistSplit. X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=e595bf9cddaf3b455829e0a8be346b5d447087e7;p=users%2Fbernd%2Fpostgres.git Repair error with not adjusting active scans properly after gistSplit. Patch from Teodor Sigaev. --- diff --git a/src/backend/access/gist/gist.c b/src/backend/access/gist/gist.c index 27111b42e2..509fe0feee 100644 --- a/src/backend/access/gist/gist.c +++ b/src/backend/access/gist/gist.c @@ -496,6 +496,14 @@ gistlayerinsert(Relation r, BlockNumber blkno, /* key is modified, so old version must be deleted */ ItemPointerSet(&oldtid, blkno, child); gistdelete(r, &oldtid); + + /* + * if child was splitted, new key for child will be inserted + * in the end list of child, so we must say to any scans + * that page is changed beginning from 'child' offset + */ + if ( ret & SPLITED ) + gistadjscans(r, GISTOP_SPLIT, blkno, child); } ret = INSERTED; @@ -1413,10 +1421,6 @@ gistSplit(Relation r, ItemPointerSet(&(newtup[nlen - 1]->t_tid), lbknum, 1); } - - /* adjust active scans */ - gistadjscans(r, GISTOP_SPLIT, BufferGetBlockNumber(buffer), FirstOffsetNumber); - /* !!! pfree */ pfree(rvectup); pfree(lvectup);