diff options
| author | Heikki Linnakangas | 2013-02-11 20:50:15 +0000 |
|---|---|---|
| committer | Heikki Linnakangas | 2013-02-11 21:07:09 +0000 |
| commit | 62401db45c4feff9be296fa78a8bb7b9947d69de (patch) | |
| tree | 5d572267b5a2eae75049ba720bc1faf9f6a6694d /src/include | |
| parent | b669f416cee77ef9025b80f9c4201688578447d1 (diff) | |
Support unlogged GiST index.
The reason this wasn't supported before was that GiST indexes need an
increasing sequence to detect concurrent page-splits. In a regular WAL-
logged GiST index, the LSN of the page-split record is used for that
purpose, and in a temporary index, we can get away with a backend-local
counter. Neither of those methods works for an unlogged relation.
To provide such an increasing sequence of numbers, create a "fake LSN"
counter that is saved and restored across shutdowns. On recovery, unlogged
relations are blown away, so the counter doesn't need to survive that
either.
Jeevan Chalke, based on discussions with Robert Haas, Tom Lane and me.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/access/gist_private.h | 2 | ||||
| -rw-r--r-- | src/include/access/xlog.h | 1 | ||||
| -rw-r--r-- | src/include/catalog/pg_control.h | 4 |
3 files changed, 5 insertions, 2 deletions
diff --git a/src/include/access/gist_private.h b/src/include/access/gist_private.h index c2f9031b4fe..cae6dbc225c 100644 --- a/src/include/access/gist_private.h +++ b/src/include/access/gist_private.h @@ -512,7 +512,7 @@ extern void gistMakeUnionKey(GISTSTATE *giststate, int attno, GISTENTRY *entry2, bool isnull2, Datum *dst, bool *dstisnull); -extern XLogRecPtr GetXLogRecPtrForTemp(void); +extern XLogRecPtr gistGetFakeLSN(Relation rel); /* gistvacuum.c */ extern Datum gistbulkdelete(PG_FUNCTION_ARGS); diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h index 72e32425964..8a65492a346 100644 --- a/src/include/access/xlog.h +++ b/src/include/access/xlog.h @@ -294,6 +294,7 @@ extern char *XLogFileNameP(TimeLineID tli, XLogSegNo segno); extern void UpdateControlFile(void); extern uint64 GetSystemIdentifier(void); +extern XLogRecPtr GetFakeLSNForUnloggedRel(void); extern Size XLOGShmemSize(void); extern void XLOGShmemInit(void); extern void BootStrapXLOG(void); diff --git a/src/include/catalog/pg_control.h b/src/include/catalog/pg_control.h index 0c647e77ad7..306d1888540 100644 --- a/src/include/catalog/pg_control.h +++ b/src/include/catalog/pg_control.h @@ -21,7 +21,7 @@ /* Version identifier for this pg_control format */ -#define PG_CONTROL_VERSION 934 +#define PG_CONTROL_VERSION 935 /* * Body of CheckPoint XLOG records. This is declared here because we keep @@ -126,6 +126,8 @@ typedef struct ControlFileData CheckPoint checkPointCopy; /* copy of last check point record */ + XLogRecPtr unloggedLSN; /* current fake LSN value, for unlogged rels */ + /* * These two values determine the minimum point we must recover up to * before starting up: |
