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.
c952eae52a Check for conflicting queries during replay of gistvacuumpage()
src/backend/access/gist/gist.c | 23 ++--
src/backend/access/gist/gistbuild.c | 7 +-
src/backend/access/gist/gistxlog.c | 243 +++++++++++++++++++++++++++++++++
src/backend/access/rmgrdesc/gistdesc.c | 11 ++
src/include/access/gist_private.h | 10 +-
src/include/access/gistxlog.h | 17 +++
6 files changed, 298 insertions(+), 13 deletions(-)