diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2001-01-04 21:51:49 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2001-01-04 21:51:49 +0000 |
commit | de9b43f3f55429925fde61a422470f49d9d4fdb8 (patch) | |
tree | 6d15f2e5a7fa81343a2ca72a2c3c05fd7d2ca9c0 | |
parent | a860a403a92994741041e8f93b9b51848117c6cb (diff) | |
download | postgresql-de9b43f3f55429925fde61a422470f49d9d4fdb8.tar.gz |
Back-patch fix for 'btree: failed to add item to the page in _bt_sort (2)'
failure during index creation. This problem should be gone in current
sources, but I just thought I'd commit the 7.0.* patch in case anyone
else needs it.
-rw-r--r-- | src/backend/access/nbtree/nbtsort.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/backend/access/nbtree/nbtsort.c b/src/backend/access/nbtree/nbtsort.c index 65e757e42b..3b35200194 100644 --- a/src/backend/access/nbtree/nbtsort.c +++ b/src/backend/access/nbtree/nbtsort.c @@ -28,7 +28,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsort.c,v 1.52 2000/04/12 17:14:49 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsort.c,v 1.52.2.1 2001/01/04 21:51:49 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -321,7 +321,7 @@ _bt_buildadd(Relation index, Size keysz, ScanKey scankey, btisz, (PageGetPageSize(npage) - sizeof(PageHeaderData) - MAXALIGN(sizeof(BTPageOpaqueData))) /3 - sizeof(ItemIdData)); - if (pgspc < btisz) + while (pgspc < btisz) { Buffer obuf = nbuf; Page opage = npage; @@ -436,6 +436,13 @@ _bt_buildadd(Relation index, Size keysz, ScanKey scankey, * we aren't locking). */ _bt_wrtbuf(index, obuf); + + /* + * Recompute pgspc and loop back to check free space again. If + * we were forced to split at a bad split point, we might need + * to split again. + */ + pgspc = PageGetFreeSpace(npage); } /* |