diff options
author | Alexander Korotkov <akorotkov@postgresql.org> | 2018-12-13 06:12:31 +0300 |
---|---|---|
committer | Alexander Korotkov <akorotkov@postgresql.org> | 2018-12-13 06:39:53 +0300 |
commit | dd951dc34a2ecde28cd8d686cd06de1d21f474a0 (patch) | |
tree | 947cab411ea225e838d7ebdc1227c52171bfa54d /src/include/access/ginxlog.h | |
parent | 225b5c9c480fa90d4734ce4a8d1a4b46ac5e826e (diff) | |
download | postgresql-dd951dc34a2ecde28cd8d686cd06de1d21f474a0.tar.gz postgresql-dd951dc34a2ecde28cd8d686cd06de1d21f474a0.zip |
Prevent GIN deleted pages from being reclaimed too early
When GIN vacuum deletes a posting tree page, it assumes that no concurrent
searchers can access it, thanks to ginStepRight() locking two pages at once.
However, since 9.4 searches can skip parts of posting trees descending from the
root. That leads to the risk that page is deleted and reclaimed before
concurrent search can access it.
This commit prevents the risk of above by waiting for every transaction, which
might wait to reference this page, to finish. Due to binary compatibility
we can't change GinPageOpaqueData to store corresponding transaction id.
Instead we reuse page header pd_prune_xid field, which is unused in index pages.
Discussion: https://postgr.es/m/31a702a.14dd.166c1366ac1.Coremail.chjischj%40163.com
Author: Andrey Borodin, Alexander Korotkov
Reviewed-by: Alexander Korotkov
Backpatch-through: 9.4
Diffstat (limited to 'src/include/access/ginxlog.h')
-rw-r--r-- | src/include/access/ginxlog.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/include/access/ginxlog.h b/src/include/access/ginxlog.h index 64a3c9e18b4..b2f3126aa8a 100644 --- a/src/include/access/ginxlog.h +++ b/src/include/access/ginxlog.h @@ -158,6 +158,7 @@ typedef struct ginxlogDeletePage { OffsetNumber parentOffset; BlockNumber rightLink; + TransactionId deleteXid; /* last Xid which could see this page in scan */ } ginxlogDeletePage; #define XLOG_GIN_UPDATE_META_PAGE 0x60 |