Re: Duplicate Item Pointers in Gin index
От | R, Siva |
---|---|
Тема | Re: Duplicate Item Pointers in Gin index |
Дата | |
Msg-id | 1519254138262.5657@amazon.com обсуждение исходный текст |
Ответ на | Re: Duplicate Item Pointers in Gin index (Masahiko Sawada <sawada.mshk@gmail.com>) |
Ответы |
Re: Duplicate Item Pointers in Gin index
|
Список | pgsql-hackers |
Hi Masahiko, Thanks for the response! On Tue, Feb 20, 2018 at 7:19PM, Masahiko Sawada <sawada.mshk@gmail.com> > On Wed, Feb 21, 2018 at 8:30 AM, R, Siva <sivasubr@amazon.com> wrote: >> User backend (let us call this backend 1) has released the lock on the >> metapage and is processing the pending list pages, adding the items to the >> build accumulator. Let us assume that there are currently 2 pages in the >> pending list and metadata->head is currently being processed (metadata->tail >> is not locked yet) and the old tuple id that was deleted is added to the >> accumulator. >> Another user backend (let us call this backend 2) uses the tid that was >> marked re-usable for a row that contains the same key datum as before, takes >> metapage lock and inserts into the pending list (metadata->tail) and returns >> (assume it does not do cleanup). > IIUC, ginInsertCleanup() holds ExclusiveLock on metapage during adding > tuples in the pending list to the accumulator. And inserting entries > to the pending list also requires ExclusiveLock on metapage. This > behavior is not relevant with that bug fix. So I don't think that >backend2 can inserts a tuple while backend1 is processing the pending >list. Did you mean pin on the metapage buffer during ginInsertCleanup and not lock during addition of tuples to the accumulator? The exclusive lock on metapage buffer is released after reading/locking head of pending list and before we process pages/add tuples to the accumulator in ginInsertCleanup [1]. The metapage (not metapage buffer) is locked using LockPage upon entry in ginInsertCleanup and unlocked after processing of pending list is complete. Does that prevent concurrent insertions into the pending list? Insertions take exclusive lock on the metabuffer but does not do a LockPage on the metapage. [2] There is a comment in ginInsertCleanup that mentions concurrent insertions into pending list is possible while cleanup is in progress. [3] [1] - https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/access/gin/ginfast.c;h=56a3ff590a45f00088ff9f0fd9fece0809bbe2fe;hb=refs/heads/REL9_6_STABLE#l808 [2] - https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/access/gin/ginfast.c;h=56a3ff590a45f00088ff9f0fd9fece0809bbe2fe;hb=refs/heads/REL9_6_STABLE#l255 [3] - https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/access/gin/ginfast.c;h=56a3ff590a45f00088ff9f0fd9fece0809bbe2fe;hb=refs/heads/REL9_6_STABLE#l754 Best Siva
В списке pgsql-hackers по дате отправления: