mirror of
https://github.com/postgres/postgres.git
synced 2025-11-24 00:23:06 +03:00
Make GiST indexes on-disk compatible with 9.2 again.
The patch that turned XLogRecPtr into a uint64 inadvertently changed the on-disk format of GiST indexes, because the NSN field in the GiST page opaque is an XLogRecPtr. That breaks pg_upgrade. Revert the format of that field back to the two-field struct that XLogRecPtr was before. This is the same we did to LSNs in the page header to avoid changing on-disk format. Bump catversion, as this invalidates any existing GiST indexes built on 9.3devel.
This commit is contained in:
@@ -82,6 +82,21 @@ typedef Pointer Page;
|
||||
typedef uint16 LocationIndex;
|
||||
|
||||
|
||||
/*
|
||||
* For historical reasons, the 64-bit LSN value is stored as two 32-bit
|
||||
* values.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32 xlogid; /* high bits */
|
||||
uint32 xrecoff; /* low bits */
|
||||
} PageXLogRecPtr;
|
||||
|
||||
#define PageXLogRecPtrGet(val) \
|
||||
((uint64) (val).xlogid << 32 | (val).xrecoff)
|
||||
#define PageXLogRecPtrSet(ptr, lsn) \
|
||||
((ptr).xlogid = (uint32) ((lsn) >> 32), (ptr).xrecoff = (uint32) (lsn))
|
||||
|
||||
/*
|
||||
* disk page organization
|
||||
*
|
||||
@@ -120,13 +135,6 @@ typedef uint16 LocationIndex;
|
||||
* are 15 bits.
|
||||
*/
|
||||
|
||||
/* for historical reasons, the LSN is stored as two 32-bit values. */
|
||||
typedef struct
|
||||
{
|
||||
uint32 xlogid; /* high bits */
|
||||
uint32 xrecoff; /* low bits */
|
||||
} PageXLogRecPtr;
|
||||
|
||||
typedef struct PageHeaderData
|
||||
{
|
||||
/* XXX LSN is member of *any* block, not only page-organized ones */
|
||||
@@ -319,13 +327,13 @@ typedef PageHeaderData *PageHeader;
|
||||
/ sizeof(ItemIdData)))
|
||||
|
||||
/*
|
||||
* Additional macros for access to page headers
|
||||
* Additional macros for access to page headers. (Beware multiple evaluation
|
||||
* of the arguments!)
|
||||
*/
|
||||
#define PageGetLSN(page) \
|
||||
((uint64) ((PageHeader) (page))->pd_lsn.xlogid << 32 | ((PageHeader) (page))->pd_lsn.xrecoff)
|
||||
PageXLogRecPtrGet(((PageHeader) (page))->pd_lsn)
|
||||
#define PageSetLSN(page, lsn) \
|
||||
(((PageHeader) (page))->pd_lsn.xlogid = (uint32) ((lsn) >> 32), \
|
||||
((PageHeader) (page))->pd_lsn.xrecoff = (uint32) (lsn))
|
||||
PageXLogRecPtrSet(((PageHeader) (page))->pd_lsn, lsn)
|
||||
|
||||
/* NOTE: only the 16 least significant bits are stored */
|
||||
#define PageGetTLI(page) \
|
||||
|
||||
Reference in New Issue
Block a user