Re: GIN non-intrusive vacuum of posting tree
| От | Andrew Borodin |
|---|---|
| Тема | Re: GIN non-intrusive vacuum of posting tree |
| Дата | |
| Msg-id | CAJEAwVE4UAmm8fr+NW8XTnKV6M--ACoNhL3ES8yoKL2sKhbaiw@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: GIN non-intrusive vacuum of posting tree (Vladimir Borodin <root@simply.name>) |
| Ответы |
Re: GIN non-intrusive vacuum of posting tree
|
| Список | pgsql-hackers |
Here is v1 of the patch. Now it has changes for README and contains more comments clarifying changes of locking model. Also I will elaborate some more on what is patched. Main portion of changes is made to function ginVacuumPostingTreeLeaves(). Before the patch it was traversing tree in depth-first fashion, acquiring exclusive lock on each page and removing dead tuples from leafs. Also this function used to hold cleanup lock. Now this function is doing same DFS, but without cleanup lock, acquiring only read locks on inner pages and exclusive lock on leafs before eliminating dead tuples. If this function finds empty leafs, it computes minimal subtree, containing only empty pages and start scan for empty pages from parent page pointing to found subtree. This scan acquires cleanup lock on root of scan (not necessarily root of posting tree). Cleanup lock ensures no inserts are inside subtree. Scan traverses subtree DF taking exclusive locks from left to right. For any page being deleted all leftmost pages were locked and unlocked before. New reads cannot enter subtree, all old readscans were excluded by lock\unlock. Thus there shall not be deadlocks with ginStepRight(). We get lock on page being deleted, then on a left page. ginStepRight() takes lock on left page, than on right page. But it’s presence is excluded by cleanup lock and DFS scan with locks of upper and left parts of tree. Thank you for reading this. Concurrency bothers me a lot. If you see that anything is wrong or suspicious, please do not hesitate to post your thoughts. Best regards, Andrey Borodin.
Вложения
В списке pgsql-hackers по дате отправления: