aboutsummaryrefslogtreecommitdiff
path: root/src/include/access/gistxlog.h
diff options
context:
space:
mode:
authorAlexander Korotkov <akorotkov@postgresql.org>2018-12-21 02:37:37 +0300
committerAlexander Korotkov <akorotkov@postgresql.org>2018-12-21 02:37:37 +0300
commitc952eae52a33069e2e92d34f217b43d0eca3d7de (patch)
tree4d9d8d95f7c1602630af3f83d8efd3ade5d98d33 /src/include/access/gistxlog.h
parent7c15cef86d37924505b3bb49b5e1ad1740b1d8f7 (diff)
downloadpostgresql-c952eae52a33069e2e92d34f217b43d0eca3d7de.tar.gz
postgresql-c952eae52a33069e2e92d34f217b43d0eca3d7de.zip
Check for conflicting queries during replay of gistvacuumpage()
013ebc0a7b implements so-called GiST microvacuum. That is gistgettuple() marks index tuples as dead when kill_prior_tuple is set. Later, when new tuple insertion claims page space, those dead index tuples are physically deleted from page. When this deletion is replayed on standby, it might conflict with read-only queries. But 013ebc0a7b doesn't handle this. That may lead to disappearance of some tuples from read-only snapshots on standby. This commit implements resolving of conflicts between replay of GiST microvacuum and standby queries. On the master we implement new WAL record type XLOG_GIST_DELETE, which comprises necessary information. On stable releases we've to be tricky to keep WAL compatibility. Information required for conflict processing is just appended to data of XLOG_GIST_PAGE_UPDATE record. So, PostgreSQL version, which doesn't know about conflict processing, will just ignore that. Reported-by: Andres Freund Diagnosed-by: Andres Freund Discussion: https://postgr.es/m/20181212224524.scafnlyjindmrbe6%40alap3.anarazel.de Author: Alexander Korotkov Backpatch-through: 9.6
Diffstat (limited to 'src/include/access/gistxlog.h')
-rw-r--r--src/include/access/gistxlog.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/include/access/gistxlog.h b/src/include/access/gistxlog.h
index 1a2b9496d0d..b67c7100500 100644
--- a/src/include/access/gistxlog.h
+++ b/src/include/access/gistxlog.h
@@ -18,6 +18,7 @@
#include "lib/stringinfo.h"
#define XLOG_GIST_PAGE_UPDATE 0x00
+#define XLOG_GIST_DELETE 0x10 /* delete leaf index tuples for a page */
/* #define XLOG_GIST_NEW_ROOT 0x20 */ /* not used anymore */
#define XLOG_GIST_PAGE_SPLIT 0x30
/* #define XLOG_GIST_INSERT_COMPLETE 0x40 */ /* not used anymore */
@@ -41,6 +42,22 @@ typedef struct gistxlogPageUpdate
} gistxlogPageUpdate;
/*
+ * Backup Blk 0: Leaf page, whose index tuples are deleted.
+ */
+typedef struct gistxlogDelete
+{
+ RelFileNode hnode; /* RelFileNode of the heap the index currently
+ * points at */
+ uint16 ntodelete; /* number of deleted offsets */
+
+ /*
+ * In payload of blk 0 : todelete OffsetNumbers
+ */
+} gistxlogDelete;
+
+#define SizeOfGistxlogDelete (offsetof(gistxlogDelete, ntodelete) + sizeof(uint16))
+
+/*
* Backup Blk 0: If this operation completes a page split, by inserting a
* downlink for the split page, the left half of the split
* Backup Blk 1 - npage: split pages (1 is the original page)