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

Commitb109b03

Browse files
committed
Repair a number of places that didn't bother to check whether PageAddItem
succeeds or not. Revise rtree page split algorithm to take care aboutmaking a feasible split --- ie, will the incoming tuple actually fit?Failure to make a feasible split, combined with failure to notice thefailure, account for Jim Stone's recent bug report. I suspect thathash and gist indices may have the same type of bug, but at least nowwe'll get error messages rather than silent failures if so. Also cleanup rtree code to use Datum rather than char* where appropriate.
1 parent296c806 commitb109b03

File tree

6 files changed

+336
-192
lines changed

6 files changed

+336
-192
lines changed

‎src/backend/access/gist/gist.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
*
88
* IDENTIFICATION
9-
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.70 2001/02/22 21:48:48 momjian Exp $
9+
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.71 2001/03/07 21:20:26 tgl Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -395,6 +395,9 @@ gistPageAddItem(GISTSTATE *giststate,
395395
*newtup=gist_tuple_replacekey(r,tmpcentry,itup);
396396
retval=PageAddItem(page, (Item)*newtup,IndexTupleSize(*newtup),
397397
offsetNumber,flags);
398+
if (retval==InvalidOffsetNumber)
399+
elog(ERROR,"gist: failed to add index item to %s",
400+
RelationGetRelationName(r));
398401
/* be tidy */
399402
if (tmpcentry.pred&&tmpcentry.pred!=dentry->pred
400403
&&tmpcentry.pred!= (((char*)itup)+sizeof(IndexTupleData)))

‎src/backend/access/hash/hashinsert.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashinsert.c,v 1.21 2001/01/24 19:42:47 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashinsert.c,v 1.22 2001/03/07 21:20:26 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -230,7 +230,10 @@ _hash_pgaddtup(Relation rel,
230230
_hash_checkpage(page,LH_BUCKET_PAGE |LH_OVERFLOW_PAGE);
231231

232232
itup_off=OffsetNumberNext(PageGetMaxOffsetNumber(page));
233-
PageAddItem(page, (Item)hitem,itemsize,itup_off,LP_USED);
233+
if (PageAddItem(page, (Item)hitem,itemsize,itup_off,LP_USED)
234+
==InvalidOffsetNumber)
235+
elog(ERROR,"_hash_pgaddtup: failed to add index item to %s",
236+
RelationGetRelationName(rel));
234237

235238
/* write the buffer, but hold our lock */
236239
_hash_wrtnorelbuf(rel,buf);

‎src/backend/access/hash/hashovfl.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashovfl.c,v 1.28 2001/01/24 19:42:47 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashovfl.c,v 1.29 2001/03/07 21:20:26 tgl Exp $
1212
*
1313
* NOTES
1414
* Overflow pages look like ordinary relation pages.
@@ -564,7 +564,10 @@ _hash_squeezebucket(Relation rel,
564564
* page.
565565
*/
566566
woffnum=OffsetNumberNext(PageGetMaxOffsetNumber(wpage));
567-
PageAddItem(wpage, (Item)hitem,itemsz,woffnum,LP_USED);
567+
if (PageAddItem(wpage, (Item)hitem,itemsz,woffnum,LP_USED)
568+
==InvalidOffsetNumber)
569+
elog(ERROR,"_hash_squeezebucket: failed to add index item to %s",
570+
RelationGetRelationName(rel));
568571

569572
/*
570573
* delete the tuple from the "read" page. PageIndexTupleDelete

‎src/backend/access/hash/hashpage.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashpage.c,v 1.29 2001/01/24 19:42:47 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashpage.c,v 1.30 2001/03/07 21:20:26 tgl Exp $
1212
*
1313
* NOTES
1414
* Postgres hash pages look like ordinary relation pages. The opaque
@@ -619,7 +619,10 @@ _hash_splitpage(Relation rel,
619619
}
620620

621621
noffnum=OffsetNumberNext(PageGetMaxOffsetNumber(npage));
622-
PageAddItem(npage, (Item)hitem,itemsz,noffnum,LP_USED);
622+
if (PageAddItem(npage, (Item)hitem,itemsz,noffnum,LP_USED)
623+
==InvalidOffsetNumber)
624+
elog(ERROR,"_hash_splitpage: failed to add index item to %s",
625+
RelationGetRelationName(rel));
623626
_hash_wrtnorelbuf(rel,nbuf);
624627

625628
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp