postgresql/src/include/access
Teodor Sigaev 0bef1c0678 Re-think predicate locking on GIN indexes.
The principle behind the locking was not very well thought-out, and not
documented. Add a section in the README to explain how it's supposed to
work, and change the code so that it actually works that way.

This fixes two bugs:

1. If fast update was turned on concurrently, subsequent inserts to the
   pending list would not conflict with predicate locks that were acquired
   earlier, on entry pages. The included 'predicate-gin-fastupdate' test
   demonstrates that. To fix, make all scans acquire a predicate lock on
   the metapage. That lock represents a scan of the pending list, whether
   or not there is a pending list at the moment. Forget about the
   optimization to skip locking/checking for locks, when fastupdate=off.
2. If a scan finds no match, it still needs to lock the entry page. The
   point of predicate locks is to lock the gabs between values, whether
   or not there is a match. The included 'predicate-gin-nomatch' test
   tests that case.

In addition to those two bug fixes, this removes some unnecessary locking,
following the principle laid out in the README. Because all items in
a posting tree have the same key value, a lock on the posting tree root is
enough to cover all the items. (With a very large posting tree, it would
possibly be better to lock the posting tree leaf pages instead, so that a
"skip scan" with a query like "A & B", you could avoid unnecessary conflict
if a new tuple is inserted with A but !B. But let's keep this simple.)

Also, some spelling  fixes.

Author: Heikki Linnakangas with some editorization by me
Review: Andrey Borodin, Alexander Korotkov
Discussion: https://www.postgresql.org/message-id/0b3ad2c2-2692-62a9-3a04-5724f2af9114@iki.fi
2018-05-04 11:27:50 +03:00
..
amapi.h Support index INCLUDE in the AM properties interface. 2018-04-08 06:02:05 +01:00
amvalidate.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
attnum.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
brin_internal.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
brin_page.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
brin_pageops.h Improve FSM management for BRIN indexes. 2018-04-04 14:26:04 -04:00
brin_revmap.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
brin_tuple.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
brin_xlog.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
brin.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
bufmask.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
clog.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
commit_ts.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
genam.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
generic_xlog.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
gin_private.h Re-think predicate locking on GIN indexes. 2018-05-04 11:27:50 +03:00
gin.h Use stdbool.h if suitable 2018-03-22 20:42:25 -04:00
ginblock.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
ginxlog.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
gist_private.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
gist.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
gistscan.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
gistxlog.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
hash_xlog.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
hash.h Indexes with INCLUDE columns and their support in B-tree 2018-04-07 23:00:39 +03:00
heapam_xlog.h Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
heapam.h Revert MERGE patch 2018-04-12 11:22:56 +01:00
hio.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
htup_details.h Improve representation of 'moved partitions' indicator on deleted tuples. 2018-05-01 13:30:12 -07:00
htup.h Add FIELDNO_* macro designating offset into structs required for JIT. 2018-03-22 14:45:59 -07:00
itup.h Adjust INCLUDE index truncation comments and code. 2018-04-19 08:45:58 +03:00
multixact.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nbtree.h Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
nbtxlog.h Fix datatype for number of heap tuples during last cleanup 2018-04-19 11:28:03 +03:00
parallel.h Support parallel btree index builds. 2018-02-02 13:32:44 -05:00
printsimple.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
printtup.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
reloptions.h Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
relscan.h Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
rewriteheap.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
rmgr.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
rmgrlist.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
sdir.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
session.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
skey.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
slru.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
spgist_private.h Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
spgist.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
spgxlog.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
stratnum.h Add prefix operator for TEXT type. 2018-04-03 19:46:45 +03:00
subtrans.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
sysattr.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
timeline.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
transam.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
tsmapi.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
tupconvert.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
tupdesc_details.h Fast ALTER TABLE ADD COLUMN with a non-NULL default 2018-03-28 10:43:52 +10:30
tupdesc.h Fast ALTER TABLE ADD COLUMN with a non-NULL default 2018-03-28 10:43:52 +10:30
tupmacs.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
tuptoaster.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
twophase_rmgr.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
twophase.h Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
valid.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
visibilitymap.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
xact.h Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
xlog_internal.h Fix confusion on the padding of GIDs in on commit and abort records. 2018-04-17 16:10:42 -04:00
xlog.h Revert "Allow on-line enabling and disabling of data checksums" 2018-04-09 19:03:42 +02:00
xlogdefs.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
xloginsert.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
xlogreader.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
xlogrecord.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
xlogutils.h Update copyright for 2018 2018-01-02 23:30:12 -05:00