1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-10 17:42:29 +03:00

Repair a number of places that didn't bother to check whether PageAddItem

succeeds or not.  Revise rtree page split algorithm to take care about
making a feasible split --- ie, will the incoming tuple actually fit?
Failure to make a feasible split, combined with failure to notice the
failure, account for Jim Stone's recent bug report.  I suspect that
hash and gist indices may have the same type of bug, but at least now
we'll get error messages rather than silent failures if so.  Also clean
up rtree code to use Datum rather than char* where appropriate.
This commit is contained in:
Tom Lane
2001-03-07 21:20:26 +00:00
parent 296c806dd5
commit b109b03fea
6 changed files with 336 additions and 192 deletions

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashinsert.c,v 1.21 2001/01/24 19:42:47 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashinsert.c,v 1.22 2001/03/07 21:20:26 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -230,7 +230,10 @@ _hash_pgaddtup(Relation rel,
_hash_checkpage(page, LH_BUCKET_PAGE | LH_OVERFLOW_PAGE);
itup_off = OffsetNumberNext(PageGetMaxOffsetNumber(page));
PageAddItem(page, (Item) hitem, itemsize, itup_off, LP_USED);
if (PageAddItem(page, (Item) hitem, itemsize, itup_off, LP_USED)
== InvalidOffsetNumber)
elog(ERROR, "_hash_pgaddtup: failed to add index item to %s",
RelationGetRelationName(rel));
/* write the buffer, but hold our lock */
_hash_wrtnorelbuf(rel, buf);

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashovfl.c,v 1.28 2001/01/24 19:42:47 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashovfl.c,v 1.29 2001/03/07 21:20:26 tgl Exp $
*
* NOTES
* Overflow pages look like ordinary relation pages.
@@ -564,7 +564,10 @@ _hash_squeezebucket(Relation rel,
* page.
*/
woffnum = OffsetNumberNext(PageGetMaxOffsetNumber(wpage));
PageAddItem(wpage, (Item) hitem, itemsz, woffnum, LP_USED);
if (PageAddItem(wpage, (Item) hitem, itemsz, woffnum, LP_USED)
== InvalidOffsetNumber)
elog(ERROR, "_hash_squeezebucket: failed to add index item to %s",
RelationGetRelationName(rel));
/*
* delete the tuple from the "read" page. PageIndexTupleDelete

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashpage.c,v 1.29 2001/01/24 19:42:47 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashpage.c,v 1.30 2001/03/07 21:20:26 tgl Exp $
*
* NOTES
* Postgres hash pages look like ordinary relation pages. The opaque
@@ -619,7 +619,10 @@ _hash_splitpage(Relation rel,
}
noffnum = OffsetNumberNext(PageGetMaxOffsetNumber(npage));
PageAddItem(npage, (Item) hitem, itemsz, noffnum, LP_USED);
if (PageAddItem(npage, (Item) hitem, itemsz, noffnum, LP_USED)
== InvalidOffsetNumber)
elog(ERROR, "_hash_splitpage: failed to add index item to %s",
RelationGetRelationName(rel));
_hash_wrtnorelbuf(rel, nbuf);
/*