summaryrefslogtreecommitdiff
path: root/src/include/access/xlog.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-06-02 05:55:29 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-06-02 05:55:29 +0000
commit21fda22ec46deb7734f793ef4d7fa6c226b4c78e (patch)
treecc1b5b2b79f41801cdd4123bdbcf475d1181024f /src/include/access/xlog.h
parentc196c7ae8b9a81c0427402ff19f510f884d1389a (diff)
downloadpostgresql-21fda22ec46deb7734f793ef4d7fa6c226b4c78e.tar.gz
Change CRCs in WAL records from 64bit to 32bit for performance reasons.
Instead of a separate CRC on each backup block, include backup blocks in their parent WAL record's CRC; this is important to ensure that the backup block really goes with the WAL record, ie there was not a page tear right at the start of the backup block. Implement a simple form of compression of backup blocks: drop any run of zeroes starting at pd_lower, so as not to store the unused 'hole' that commonly exists in PG heap and index pages. Tweak PageRepairFragmentation and related routines to ensure they keep the unused space zeroed, so that the above compression method remains effective. All per recent discussions.
Diffstat (limited to 'src/include/access/xlog.h')
-rw-r--r--src/include/access/xlog.h30
1 files changed, 19 insertions, 11 deletions
diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h
index ab47173897..1d1aa9c152 100644
--- a/src/include/access/xlog.h
+++ b/src/include/access/xlog.h
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/access/xlog.h,v 1.61 2005/05/20 14:53:26 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/access/xlog.h,v 1.62 2005/06/02 05:55:29 tgl Exp $
*/
#ifndef XLOG_H
#define XLOG_H
@@ -19,23 +19,31 @@
/*
- * Header for each record in XLOG
+ * The overall layout of an XLOG record is:
+ * Fixed-size header (XLogRecord struct)
+ * rmgr-specific data
+ * BkpBlock
+ * backup block data
+ * BkpBlock
+ * backup block data
+ * ...
*
- * NOTE: xl_len counts only the rmgr data, not the XLogRecord header,
- * and also not any backup blocks appended to the record (which are signaled
- * by xl_info flag bits). The total space needed for an XLOG record is
- * really:
- *
- * SizeOfXLogRecord + xl_len + n_backup_blocks * (sizeof(BkpBlock) + BLCKSZ)
+ * where there can be zero to three backup blocks (as signaled by xl_info flag
+ * bits). XLogRecord structs always start on MAXALIGN boundaries in the WAL
+ * files, and we round up SizeOfXLogRecord so that the rmgr data is also
+ * guaranteed to begin on a MAXALIGN boundary. However, no padding is added
+ * to align BkpBlock structs or backup block data.
*
- * rounded up to a MAXALIGN boundary (so that all xlog records start on
- * MAXALIGN boundaries).
+ * NOTE: xl_len counts only the rmgr data, not the XLogRecord header,
+ * and also not any backup blocks. xl_tot_len counts everything. Neither
+ * length field is rounded up to an alignment boundary.
*/
typedef struct XLogRecord
{
- crc64 xl_crc; /* CRC for this record */
+ pg_crc32 xl_crc; /* CRC for this record */
XLogRecPtr xl_prev; /* ptr to previous record in log */
TransactionId xl_xid; /* xact id */
+ uint32 xl_tot_len; /* total len of entire record */
uint32 xl_len; /* total len of rmgr data */
uint8 xl_info; /* flag bits, see below */
RmgrId xl_rmid; /* resource manager for this record */