From 9ee4d06f3fdde37b063b8a0f0fa0a2113ac12303 Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Thu, 17 Jan 2013 16:35:46 +0200 Subject: 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. --- src/include/access/gist.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/include/access/gist.h') diff --git a/src/include/access/gist.h b/src/include/access/gist.h index 69e4ec03fb6..a487a0be3ad 100644 --- a/src/include/access/gist.h +++ b/src/include/access/gist.h @@ -64,10 +64,15 @@ #define F_FOLLOW_RIGHT (1 << 3) /* page to the right has no downlink */ typedef XLogRecPtr GistNSN; +/* + * For on-disk compatibility with pre-9.3 servers, NSN is stored as two + * 32-bit fields on disk, same as LSNs. + */ +typedef PageXLogRecPtr PageGistNSN; typedef struct GISTPageOpaqueData { - GistNSN nsn; /* this value must change on page split */ + PageGistNSN nsn; /* this value must change on page split */ BlockNumber rightlink; /* next page if any */ uint16 flags; /* see bit definitions above */ uint16 gist_page_id; /* for identification of GiST indexes */ @@ -137,6 +142,9 @@ typedef struct GISTENTRY #define GistMarkFollowRight(page) ( GistPageGetOpaque(page)->flags |= F_FOLLOW_RIGHT) #define GistClearFollowRight(page) ( GistPageGetOpaque(page)->flags &= ~F_FOLLOW_RIGHT) +#define GistPageGetNSN(page) ( PageXLogRecPtrGet(GistPageGetOpaque(page)->nsn)) +#define GistPageSetNSN(page, val) ( PageXLogRecPtrSet(GistPageGetOpaque(page)->nsn, val)) + /* * Vector of GISTENTRY structs; user-defined methods union and picksplit * take it as one of their arguments -- cgit v1.2.3