summaryrefslogtreecommitdiff
path: root/src/backend/storage
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-06-06 20:22:58 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-06-06 20:22:58 +0000
commitee7ac7b11e9e6623871833729958662a4598fbc5 (patch)
tree61d4f69957d8971b497bbc0cbcc42c4742a0b352 /src/backend/storage
parent4c8495a1f2ae7a027a4b3e8fdb2aa5b21a5be1fc (diff)
Modify XLogInsert API to make callers specify whether pages to be backed
up have the standard layout with unused space between pd_lower and pd_upper. When this is set, XLogInsert will omit the unused space without bothering to scan it to see if it's zero. That saves time in XLogInsert, and also allows reversion of my earlier patch to make PageRepairFragmentation et al explicitly re-zero freed space. Per suggestion by Heikki Linnakangas.
Diffstat (limited to 'src/backend/storage')
-rw-r--r--src/backend/storage/page/bufpage.c29
-rw-r--r--src/backend/storage/smgr/smgr.c6
2 files changed, 8 insertions, 27 deletions
diff --git a/src/backend/storage/page/bufpage.c b/src/backend/storage/page/bufpage.c
index 8f8ba9e0d2b..5b3f7bee95f 100644
--- a/src/backend/storage/page/bufpage.c
+++ b/src/backend/storage/page/bufpage.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/page/bufpage.c,v 1.64 2005/06/02 05:55:28 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/page/bufpage.c,v 1.65 2005/06/06 20:22:58 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -357,7 +357,7 @@ PageRepairFragmentation(Page page, OffsetNumber *unused)
lp = PageGetItemId(page, i + 1);
lp->lp_len = 0; /* indicate unused & deallocated */
}
- ((PageHeader) page)->pd_upper = pd_upper = pd_special;
+ ((PageHeader) page)->pd_upper = pd_special;
}
else
{ /* nused != 0 */
@@ -411,17 +411,11 @@ PageRepairFragmentation(Page page, OffsetNumber *unused)
lp->lp_off = upper;
}
- ((PageHeader) page)->pd_upper = pd_upper = upper;
+ ((PageHeader) page)->pd_upper = upper;
pfree(itemidbase);
}
- /*
- * Zero out the now-free space. This is not essential, but it allows
- * xlog.c to compress WAL data better.
- */
- MemSet((char *) page + pd_lower, 0, pd_upper - pd_lower);
-
return (nline - nused);
}
@@ -532,13 +526,6 @@ PageIndexTupleDelete(Page page, OffsetNumber offnum)
phdr->pd_lower -= sizeof(ItemIdData);
/*
- * Zero out the just-freed space. This is not essential, but it allows
- * xlog.c to compress WAL data better.
- */
- MemSet((char *) page + phdr->pd_lower, 0, sizeof(ItemIdData));
- MemSet(addr, 0, size);
-
- /*
* Finally, we need to adjust the linp entries that remain.
*
* Anything that used to be before the deleted tuple's data was moved
@@ -685,14 +672,8 @@ PageIndexMultiDelete(Page page, OffsetNumber *itemnos, int nitems)
lp->lp_off = upper;
}
- phdr->pd_lower = pd_lower = SizeOfPageHeaderData + nused * sizeof(ItemIdData);
- phdr->pd_upper = pd_upper = upper;
-
- /*
- * Zero out the now-free space. This is not essential, but it allows
- * xlog.c to compress WAL data better.
- */
- MemSet((char *) page + pd_lower, 0, pd_upper - pd_lower);
+ phdr->pd_lower = SizeOfPageHeaderData + nused * sizeof(ItemIdData);
+ phdr->pd_upper = upper;
pfree(itemidbase);
}
diff --git a/src/backend/storage/smgr/smgr.c b/src/backend/storage/smgr/smgr.c
index ca171a3b1a2..13ad72a3755 100644
--- a/src/backend/storage/smgr/smgr.c
+++ b/src/backend/storage/smgr/smgr.c
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/smgr/smgr.c,v 1.88 2005/06/06 17:01:24 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/smgr/smgr.c,v 1.89 2005/06/06 20:22:58 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -370,9 +370,9 @@ smgrcreate(SMgrRelation reln, bool isTemp, bool isRedo)
*/
xlrec.rnode = reln->smgr_rnode;
- rdata.buffer = InvalidBuffer;
rdata.data = (char *) &xlrec;
rdata.len = sizeof(xlrec);
+ rdata.buffer = InvalidBuffer;
rdata.next = NULL;
lsn = XLogInsert(RM_SMGR_ID, XLOG_SMGR_CREATE | XLOG_NO_TRAN, &rdata);
@@ -635,9 +635,9 @@ smgrtruncate(SMgrRelation reln, BlockNumber nblocks, bool isTemp)
xlrec.blkno = newblks;
xlrec.rnode = reln->smgr_rnode;
- rdata.buffer = InvalidBuffer;
rdata.data = (char *) &xlrec;
rdata.len = sizeof(xlrec);
+ rdata.buffer = InvalidBuffer;
rdata.next = NULL;
lsn = XLogInsert(RM_SMGR_ID, XLOG_SMGR_TRUNCATE | XLOG_NO_TRAN,