summaryrefslogtreecommitdiff
path: root/src/include/access/gist_private.h
diff options
context:
space:
mode:
authorAlexander Korotkov <akorotkov@postgresql.org>2018-12-21 02:33:37 +0300
committerAlexander Korotkov <akorotkov@postgresql.org>2018-12-21 02:33:37 +0300
commit1b02807457318fa61cb564b101669f82e1b7be23 (patch)
tree36076a6287cfa8efc6bc3df75f04418bd443f26f /src/include/access/gist_private.h
parente13d8a783d25691a63370c4b03acb7254934a041 (diff)
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/gist_private.h')
-rw-r--r--src/include/access/gist_private.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/include/access/gist_private.h b/src/include/access/gist_private.h
index 78e87a60771..dcd7bd54662 100644
--- a/src/include/access/gist_private.h
+++ b/src/include/access/gist_private.h
@@ -285,6 +285,7 @@ typedef struct GistSplitVector
typedef struct
{
Relation r;
+ Relation heapRel;
Size freespace; /* free space to be left */
GISTInsertStack *stack;
@@ -434,7 +435,8 @@ extern void freeGISTstate(GISTSTATE *giststate);
extern void gistdoinsert(Relation r,
IndexTuple itup,
Size freespace,
- GISTSTATE *GISTstate);
+ GISTSTATE *GISTstate,
+ Relation heapRel);
/* A List of these is returned from gistplacetopage() in *splitinfo */
typedef struct
@@ -449,7 +451,8 @@ extern bool gistplacetopage(Relation rel, Size freespace, GISTSTATE *giststate,
OffsetNumber oldoffnum, BlockNumber *newblkno,
Buffer leftchildbuf,
List **splitinfo,
- bool markleftchild);
+ bool markleftchild,
+ Relation heapRel);
extern SplitedPageLayout *gistSplit(Relation r, Page page, IndexTuple *itup,
int len, GISTSTATE *giststate);
@@ -464,7 +467,7 @@ extern void gist_xlog_cleanup(void);
extern XLogRecPtr gistXLogUpdate(Buffer buffer,
OffsetNumber *todelete, int ntodelete,
IndexTuple *itup, int ntup,
- Buffer leftchild);
+ Buffer leftchild, RelFileNode *hnode);
extern XLogRecPtr gistXLogSplit(bool page_is_leaf,
SplitedPageLayout *dist,