pgsql: Prevent GIN deleted pages from being reclaimed too early

Поиск
Список
Период
Сортировка
От Alexander Korotkov
Тема pgsql: Prevent GIN deleted pages from being reclaimed too early
Дата
Msg-id E1gXI70-0005UI-R2@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/52ac6cd2d0cd70e01291e0ac4ee6d068b69bc478

Modified Files
--------------
src/backend/access/gin/README      | 10 ++++------
src/backend/access/gin/ginutil.c   |  7 +------
src/backend/access/gin/ginvacuum.c |  6 +++++-
src/backend/access/gin/ginxlog.c   |  1 +
src/include/access/ginblock.h      | 10 ++++++++++
src/include/access/ginxlog.h       |  1 +
6 files changed, 22 insertions(+), 13 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Alexander Korotkov
Дата:
Сообщение: pgsql: Prevent deadlock in ginRedoDeletePage()
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Drop no-op CoerceToDomain nodes from expressions at planningtim