pgsql: Confine vacuum skip logic to lazy_scan_skip()

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема pgsql: Confine vacuum skip logic to lazy_scan_skip()
Дата
Msg-id E1rjket-003IAH-TV@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Confine vacuum skip logic to lazy_scan_skip()

Rename lazy_scan_skip() to heap_vac_scan_next_block() and move more
code into the function, so that the caller doesn't need to know about
ranges or skipping anymore. heap_vac_scan_next_block() returns the
next block to process, and the logic for determining that block is all
within the function. This makes the skipping logic easier to
understand, as it's all in the same function, and makes the calling
code easier to understand as it's less cluttered. The state variables
needed to manage the skipping logic are moved to LVRelState.

heap_vac_scan_next_block() now manages its own VM buffer separately
from the caller's vmbuffer variable. The caller's vmbuffer holds the
VM page for the current block its processing, while
heap_vac_scan_next_block() keeps a pin on the VM page for the next
unskippable block. Most of the time they are the same, so we hold two
pins on the same buffer, but it's more convenient to manage them
separately.

For readability inside heap_vac_scan_next_block(), move the logic of
finding the next unskippable block to separate function, and add some
comments.

This refactoring will also help future patches to switch to using a
streaming read interface, and eventually AIO
(https://postgr.es/m/CA%2BhUKGJkOiOCa%2Bmag4BF%2BzHo7qo%3Do9CFheB8%3Dg6uT5TUm2gkvA%40mail.gmail.com)

Author: Melanie Plageman, Heikki Linnakangas
Reviewed-by: Andres Freund (older version)
Discussion: https://postgr.es/m/CAAKRu_Yf3gvXGcCnqqfoq0Q8LX8UM-e-qbm_B1LeZh60f8WhWA%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4e76f984a7730cde81e2cfc015de6c2b3dadca99

Modified Files
--------------
src/backend/access/heap/vacuumlazy.c | 239 ++++++++++++++++++++++-------------
1 file changed, 150 insertions(+), 89 deletions(-)


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

Предыдущее
От: Nathan Bossart
Дата:
Сообщение: pgsql: clusterdb: Allow specifying tables to process in all databases.
Следующее
От: Jeff Davis
Дата:
Сообщение: Re: pgsql: Catalog changes preparing for builtin collation provider.