Re: Why doesn't GiST VACUUM require a super-exclusive lock, like nbtree VACUUM?

Поиск
Список
Период
Сортировка
От Peter Geoghegan
Тема Re: Why doesn't GiST VACUUM require a super-exclusive lock, like nbtree VACUUM?
Дата
Msg-id CAH2-WzntNrWepjjVHn2iN1hq7h_SXi9ZDBQN+4z7bj_-07t6Ug@mail.gmail.com
обсуждение исходный текст
Ответ на Why doesn't GiST VACUUM require a super-exclusive lock, like nbtree VACUUM?  (Peter Geoghegan <pg@bowt.ie>)
Ответы Re: Why doesn't GiST VACUUM require a super-exclusive lock, like nbtree VACUUM?  (Andrey Borodin <x4mmm@yandex-team.ru>)
Список pgsql-hackers
On Thu, Nov 4, 2021 at 8:52 AM Andrey Borodin <x4mmm@yandex-team.ru> wrote:
> Let's enumerate steps how things can go wrong.
>
> Backend1: Index-Only scan returns tid and xs_hitup with index_tuple1 on index_page1 pointing to heap_tuple1 on page1
>
> Backend2: Remove index_tuple1 and heap_tuple1
>
> Backend3: Mark page1 all-visible
> Backend1: Thinks that page1 is all-visible and shows index_tuple1 as visible
>
> To avoid this Backend1 must hold pin on index_page1 until it's done with checking visibility, and Backend2 must do
LockBufferForCleanup(index_page1).Do I get things right?
 

Almost. Backend3 is actually Backend2 here (there is no 3) -- it runs
VACUUM throughout.

Note that it's not particularly likely that Backend2/VACUUM will "win"
this race, because it typically has to do much more work than
Backend1. It has to actually remove the index tuples from the leaf
page, then any other index work (for this and other indexes). Then it
has to arrive back in vacuumlazy.c to set the VM bit in
lazy_vacuum_heap_page(). That's a pretty unlikely scenario. And even
if it happened it would only happen once (until the next time we get
unlucky). What are the chances of somebody noticing a more or less
once-off, slightly wrong answer?

-- 
Peter Geoghegan



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

Предыдущее
От: vignesh C
Дата:
Сообщение: Re: Skipping logical replication transactions on subscriber side
Следующее
От: Jeff Davis
Дата:
Сообщение: Re: Predefined role pg_maintenance for VACUUM, ANALYZE, CHECKPOINT.