Add tests for nbtree empty index predicate locking.

Add coverage for predicate locking of completely empty nbtree indexes,
where we must predicate lock the entire relation (instead of some
individual leaf page).  Both paths that can find the index empty (and
must consider whether it's still empty after PredicateLockRelation
returns) are covered by a new isolation test that uses injection points.

Catalog relation scans skip the injection points.  The waiting session
runs catalog queries of its own after arming the (session-local) points,
and could otherwise suspend itself with nothing lined up to wake it.

Follow-up to bugfix commits ce3f19e2 (the _bt_endpoint fix) and f9b7fc65
(the _bt_first/_bt_search fix).

Author: Peter Geoghegan <[email protected]>
Discussion: 
https://postgr.es/m/cah2-wzknotn3yxy0igksuavj+sl8erof+kitw+_2v2tjvwu...@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/62c05d6f2fa64cce44e57871b4cfcd7b34589fcf

Modified Files
--------------
src/backend/access/nbtree/nbtsearch.c              | 12 +++
src/test/modules/nbtree/Makefile                   |  2 +
.../nbtree/expected/predicate-empty-index.out      | 87 ++++++++++++++++++++++
src/test/modules/nbtree/meson.build                |  5 ++
.../nbtree/specs/predicate-empty-index.spec        | 73 ++++++++++++++++++
5 files changed, 179 insertions(+)

Reply via email to