aboutsummaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2007-02-05 04:22:18 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2007-02-05 04:22:18 +0000
commit23c4978e6c3bea403408949f9b7ab0949d76bc3f (patch)
tree2ef8353001cc013e64044d9097bd2a39c350603d /src/backend
parenta2e092e1c7b9710c6b63ed226040971246323bff (diff)
downloadpostgresql-23c4978e6c3bea403408949f9b7ab0949d76bc3f.tar.gz
postgresql-23c4978e6c3bea403408949f9b7ab0949d76bc3f.zip
Rename MaxTupleSize to MaxHeapTupleSize to clarify that it's not meant to
describe the maximum size of index tuples (which is typically AM-dependent anyway); and consequently remove the bogus deduction for "special space" that was built into it. Adjust TOAST_TUPLE_THRESHOLD and TOAST_MAX_CHUNK_SIZE to avoid wasting two bytes per toast chunk, and to ensure that the calculation correctly tracks any future changes in page header size. The computation had been inaccurate in a way that didn't cause any harm except space wastage, but future changes could have broken it more drastically. Fix the calculation of BTMaxItemSize, which was formerly computed as 1 byte more than it could safely be. This didn't cause any harm in practice because it's only compared against maxalign'd lengths, but future changes in the size of page headers or btree special space could have exposed the problem. initdb forced because of change in TOAST_MAX_CHUNK_SIZE, which alters the storage of toast tables.
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/access/heap/heapam.c10
-rw-r--r--src/backend/access/heap/hio.c8
-rw-r--r--src/backend/commands/vacuum.c4
3 files changed, 11 insertions, 11 deletions
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index 042a33a5d2b..71ba6d2e52e 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.226 2007/02/04 20:00:37 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.227 2007/02/05 04:22:18 tgl Exp $
*
*
* INTERFACE ROUTINES
@@ -3463,7 +3463,7 @@ heap_xlog_insert(XLogRecPtr lsn, XLogRecord *record)
struct
{
HeapTupleHeaderData hdr;
- char data[MaxTupleSize];
+ char data[MaxHeapTupleSize];
} tbuf;
HeapTupleHeader htup;
xl_heap_header xlhdr;
@@ -3505,7 +3505,7 @@ heap_xlog_insert(XLogRecPtr lsn, XLogRecord *record)
elog(PANIC, "heap_insert_redo: invalid max offset number");
newlen = record->xl_len - SizeOfHeapInsert - SizeOfHeapHeader;
- Assert(newlen <= MaxTupleSize);
+ Assert(newlen <= MaxHeapTupleSize);
memcpy((char *) &xlhdr,
(char *) xlrec + SizeOfHeapInsert,
SizeOfHeapHeader);
@@ -3551,7 +3551,7 @@ heap_xlog_update(XLogRecPtr lsn, XLogRecord *record, bool move)
struct
{
HeapTupleHeaderData hdr;
- char data[MaxTupleSize];
+ char data[MaxHeapTupleSize];
} tbuf;
xl_heap_header xlhdr;
int hsize;
@@ -3668,7 +3668,7 @@ newsame:;
hsize += (2 * sizeof(TransactionId));
newlen = record->xl_len - hsize;
- Assert(newlen <= MaxTupleSize);
+ Assert(newlen <= MaxHeapTupleSize);
memcpy((char *) &xlhdr,
(char *) xlrec + SizeOfHeapUpdate,
SizeOfHeapHeader);
diff --git a/src/backend/access/heap/hio.c b/src/backend/access/heap/hio.c
index 4e033be4e0d..0bb617a8cdc 100644
--- a/src/backend/access/heap/hio.c
+++ b/src/backend/access/heap/hio.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/heap/hio.c,v 1.64 2007/01/05 22:19:22 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/heap/hio.c,v 1.65 2007/02/05 04:22:18 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -118,12 +118,12 @@ RelationGetBufferForTuple(Relation relation, Size len,
/*
* If we're gonna fail for oversize tuple, do it right away
*/
- if (len > MaxTupleSize)
+ if (len > MaxHeapTupleSize)
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
errmsg("row is too big: size %lu, maximum size %lu",
(unsigned long) len,
- (unsigned long) MaxTupleSize)));
+ (unsigned long) MaxHeapTupleSize)));
/* Compute desired extra freespace due to fillfactor option */
saveFreeSpace = RelationGetTargetPageFreeSpace(relation,
@@ -147,7 +147,7 @@ RelationGetBufferForTuple(Relation relation, Size len,
* When use_fsm is false, we either put the tuple onto the existing target
* page or extend the relation.
*/
- if (len + saveFreeSpace <= MaxTupleSize)
+ if (len + saveFreeSpace <= MaxHeapTupleSize)
targetBlock = relation->rd_targblock;
else
{
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 43647d7989f..5f9f787eeea 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -13,7 +13,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.344 2007/02/01 19:10:26 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.345 2007/02/05 04:22:18 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1236,7 +1236,7 @@ scan_heap(VRelStats *vacrelstats, Relation onerel,
nunused;
double free_space,
usable_free_space;
- Size min_tlen = MaxTupleSize;
+ Size min_tlen = MaxHeapTupleSize;
Size max_tlen = 0;
bool do_shrinking = true;
VTupleLink vtlinks = (VTupleLink) palloc(100 * sizeof(VTupleLinkData));