postgresql/src/backend
Alexander Korotkov ad6ebcfcbb 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
2018-12-13 06:52:33 +03:00
..
access Prevent GIN deleted pages from being reclaimed too early 2018-12-13 06:52:33 +03:00
bootstrap pgindent run for 9.5 2015-05-23 21:35:49 -04:00
catalog Fix missing role dependencies for some schema and type ACLs. 2018-11-09 20:42:03 -05:00
commands Fix misapplication of pgstat_count_truncate to wrong relation. 2018-12-07 12:12:00 -05:00
executor Allow btree comparison functions to return INT_MIN. 2018-10-05 16:01:30 -04:00
foreign Code review for foreign/custom join pushdown patch. 2015-05-10 14:36:36 -04:00
lib Revert "Permit dump/reload of not-too-large >1GB tuples" 2016-12-06 12:45:49 -03:00
libpq Server-side fix for delayed NOTIFY and SIGTERM processing. 2018-10-19 21:39:22 -04:00
main Install Windows crash dump handler before all else. 2017-11-12 14:31:04 -08:00
nodes Add stack depth checks to key recursive functions in backend/nodes/*.c. 2018-12-10 11:12:43 -05:00
optimizer Repair bogus handling of multi-assignment Params in upper plan levels. 2018-12-12 13:49:42 -05:00
parser Fix lexing of standard multi-character operators in edge cases. 2018-08-23 21:35:53 +01:00
po Translation updates 2018-11-05 15:10:54 +01:00
port Fix and improve pg_atomic_flag fallback implementation. 2018-04-06 20:02:12 -07:00
postmaster Stop bgworkers during fast shutdown with postmaster in startup phase 2018-08-29 17:11:40 -07:00
regex Fix regexport.c to behave sanely with lookaround constraints. 2017-04-13 17:18:35 -04:00
replication Fix handling of synchronous replication for stopping WAL senders 2018-11-29 09:12:57 +09:00
rewrite Fix set of NLS translation issues 2018-08-21 15:18:14 +09:00
snowball Remove no-longer-required function declarations. 2015-05-24 12:20:23 -04:00
storage PANIC on fsync() failure. 2018-11-19 14:13:22 +13:00
tcop Server-side fix for delayed NOTIFY and SIGTERM processing. 2018-10-19 21:39:22 -04:00
tsearch Make ts_locale.c's character-type functions cope with UTF-16. 2018-11-03 13:56:10 -04:00
utils Fix float-to-integer coercions to handle edge cases correctly. 2018-11-24 12:45:50 -05:00
.gitignore Add gitignore for mingw/cygwin build outputs 2011-06-09 18:11:47 +02:00
common.mk Remove maintainer-check target, fold into normal build 2013-10-10 20:11:56 -04:00
Makefile Fix make rules that generate multiple output files. 2018-03-23 13:45:38 -04:00
nls.mk Translation updates 2015-02-01 23:23:40 -05:00