pgsql: Add fake LSN support to hash index AM.
| От | Peter Geoghegan |
|---|---|
| Тема | pgsql: Add fake LSN support to hash index AM. |
| Дата | |
| Msg-id | E1w4QOw-000zJc-1s@gemulon.postgresql.org обсуждение исходный текст |
| Список | pgsql-committers |
Add fake LSN support to hash index AM. Use fake LSNs in all hash AM critical sections that write a WAL record. This gives us a reliable way (a way that works during scans of both logged and unlogged relations) to detect when an index page was concurrently modified during the window between when the page is initially read (by _hash_readpage) and when the page has any known-dead items LP_DEAD-marked (by _hash_kill_items). Preparation for an upcoming patch that makes the hash index AM use the amgetbatch interface, enabling I/O prefetching during hash index scans. The amgetbatch design imposes certain rules on index AMs with respect to how they hold on to index page buffer pins (at least in the case of pins held as an interlock against unsafe concurrent TID recycling by VACUUM). These rules have consequences for routines that set LP_DEAD bits on index tuples from an amgetbatch index AM: such routines have an inherent need to reason about concurrent TID recycling by VACUUM, but can no longer rely on their amgettuple routine holding on to a buffer pin (during the aforementioned window) as an interlock against such recycling. Instead, they have to follow a new, standardized approach. The new approach taken by amgetbatch index AMs when setting LP_DEAD bits is heavily based on the current nbtree dropPin design, which was added by commit 2ed5b87f. It also works by checking if the page's LSN advanced during the window where unsafe concurrent TID recycling might have taken place. This commit is similar to commit 8a879119, which taught nbtree to use fake LSNs to improve its dropPin behavior. However, unlike that commit, this is not an independently useful enhancement, since hash doesn't implement anything like nbtree's dropPin behavior (not yet). Author: Peter Geoghegan <pg@bowt.ie> Reviewed-By: Andres Freund <andres@anarazel.de> Discussion: https://postgr.es/m/CAH2-WzkehuhxyuA8quc7rRN3EtNXpiKsjPfO8mhb+0Dr2K0Dtg@mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/e5836f7b7d9a2949414ae022c74c18070202d429 Modified Files -------------- src/backend/access/hash/hash.c | 21 +++++--- src/backend/access/hash/hashinsert.c | 20 ++++--- src/backend/access/hash/hashovfl.c | 100 ++++++++++++++++++----------------- src/backend/access/hash/hashpage.c | 22 ++++---- 4 files changed, 91 insertions(+), 72 deletions(-)
В списке pgsql-committers по дате отправления: