diff options
author | Simon Riggs <simon@2ndQuadrant.com> | 2013-03-18 13:46:42 +0000 |
---|---|---|
committer | Simon Riggs <simon@2ndQuadrant.com> | 2013-03-18 13:46:42 +0000 |
commit | bb7cc2623f242ffafae404f8ebbb331b9a7f2b68 (patch) | |
tree | f51b5ac06db0cd66387ac8581c0c439db66a936b /src/include | |
parent | 4c855750fc0ba9bd30fa397eafbfee354908bbca (diff) | |
download | postgresql-bb7cc2623f242ffafae404f8ebbb331b9a7f2b68.tar.gz postgresql-bb7cc2623f242ffafae404f8ebbb331b9a7f2b68.zip |
Remove PageSetTLI and rename pd_tli to pd_checksum
Remove use of PageSetTLI() from all page manipulation functions
and adjust README to indicate change in the way we make changes
to pages. Repurpose those bytes into the pd_checksum field and
explain how that works in comments about page header.
Refactoring ahead of actual feature patch which would make use
of the checksum field, arriving later.
Jeff Davis, with comments and doc changes by Simon Riggs
Direction suggested by Robert Haas; many others providing
review comments.
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/storage/bufpage.h | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/include/storage/bufpage.h b/src/include/storage/bufpage.h index 8c887cab735..42f8f2fa496 100644 --- a/src/include/storage/bufpage.h +++ b/src/include/storage/bufpage.h @@ -103,7 +103,7 @@ typedef struct * space management information generic to any page * * pd_lsn - identifies xlog record for last change to this page. - * pd_tli - ditto. + * pd_checksum - page checksum, if set. * pd_flags - flag bits. * pd_lower - offset to start of free space. * pd_upper - offset to end of free space. @@ -114,9 +114,17 @@ typedef struct * The LSN is used by the buffer manager to enforce the basic rule of WAL: * "thou shalt write xlog before data". A dirty buffer cannot be dumped * to disk until xlog has been flushed at least as far as the page's LSN. - * We also store the 16 least significant bits of the TLI for identification - * purposes (it is not clear that this is actually necessary, but it seems - * like a good idea). + * + * pd_checksum stores the page checksum, if it has been set for this page; + * zero is a valid value for a checksum. If a checksum is not in use then + * we leave the field unset. This will typically mean the field is zero + * though non-zero values may also be present if databases have been + * pg_upgraded from releases prior to 9.3, when the same byte offset was + * used to store the current timelineid when the page was last updated. + * Note that there is no indication on a page as to whether the checksum + * is valid or not, a deliberate design choice which avoids the problem + * of relying on the page contents to decide whether to verify it. Hence + * there are no flag bits relating to checksums. * * pd_prune_xid is a hint field that helps determine whether pruning will be * useful. It is currently unused in index pages. @@ -138,10 +146,9 @@ typedef struct typedef struct PageHeaderData { /* XXX LSN is member of *any* block, not only page-organized ones */ - PageXLogRecPtr pd_lsn; /* LSN: next byte after last byte of xlog + PageXLogRecPtr pd_lsn; /* LSN: next byte after last byte of xlog * record for last change to this page */ - uint16 pd_tli; /* least significant bits of the TimeLineID - * containing the LSN */ + uint16 pd_checksum; /* checksum */ uint16 pd_flags; /* flag bits, see below */ LocationIndex pd_lower; /* offset to start of free space */ LocationIndex pd_upper; /* offset to end of free space */ @@ -335,12 +342,6 @@ typedef PageHeaderData *PageHeader; #define PageSetLSN(page, lsn) \ PageXLogRecPtrSet(((PageHeader) (page))->pd_lsn, lsn) -/* NOTE: only the 16 least significant bits are stored */ -#define PageGetTLI(page) \ - (((PageHeader) (page))->pd_tli) -#define PageSetTLI(page, tli) \ - (((PageHeader) (page))->pd_tli = (uint16) (tli)) - #define PageHasFreeLinePointers(page) \ (((PageHeader) (page))->pd_flags & PD_HAS_FREE_LINES) #define PageSetHasFreeLinePointers(page) \ |