Re: Duplicate Item Pointers in Gin index

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: "R, Siva" <sivasubr(at)amazon(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Duplicate Item Pointers in Gin index
Date: 2018-02-21 03:19:45
Message-ID: CAD21AoDx1C0Y1QJ7oBcoWJEf46W_RvwPJkmUpLYAn1bM17t6YQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Feb 21, 2018 at 8:30 AM, R, Siva <sivasubr(at)amazon(dot)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.

Regards,

--
Masahiko Sawada
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2018-02-21 03:31:12 Re: Duplicate Item Pointers in Gin index
Previous Message Peter Eisentraut 2018-02-21 03:00:04 file cloning in pg_upgrade and CREATE DATABASE