Re: Loading table with indexed jsonb field is stalling - Mailing list pgsql-general

From Tom Lane
Subject Re: Loading table with indexed jsonb field is stalling
Date
Msg-id 20505.1558202555@sss.pgh.pa.us
Whole thread Raw
In response to Loading table with indexed jsonb field is stalling  (Will Hartung <willhartung@gmail.com>)
Responses Re: Loading table with indexed jsonb field is stalling
List pgsql-general
Will Hartung <willhartung@gmail.com> writes:
> I am trying to load data in to a table with a jsonb field that is indexed
> as gin (field jsonb_path_ops).
> ...
> The current file is "stuck", pushing past 20hrs so far.

In addition to the questions about what PG version you're using, is
the backend process that's doing the load actually consuming CPU time,
or is it just sitting?

If the latter, I wonder whether you're seeing the deadlock against
VACUUM that was fixed a few months ago.  A similarly-stuck vacuum
or autovacuum process would be pretty conclusive ...

Author: Alexander Korotkov <akorotkov@postgresql.org>
Branch: master [fd83c83d0] 2018-12-13 06:55:34 +0300
Branch: REL_11_STABLE Release: REL_11_2 [9aa94d853] 2018-12-13 06:15:23 +0300
Branch: REL_10_STABLE Release: REL_10_7 [2e3bd064e] 2018-12-13 06:22:39 +0300

    Fix deadlock in GIN vacuum introduced by 218f51584d5

    Before 218f51584d5 if posting tree page is about to be deleted, then the whole
    posting tree is locked by LockBufferForCleanup() on root preventing all the
    concurrent inserts.  218f51584d5 reduced locking to the subtree containing
    page to be deleted.  However, due to concurrent parent split, inserter doesn't
    always holds pins on all the pages constituting path from root to the target
    leaf page.  That could cause a deadlock between GIN vacuum process and GIN
    inserter.  And we didn't find non-invasive way to fix this.

    This commit reverts VACUUM behavior to lock the whole posting tree before
    delete any page.  However, we keep another useful change by 218f51584d5: the
    tree is locked only if there are pages to be deleted.

            regards, tom lane



pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: bigint out of range
Next
From: "Peter J. Holzer"
Date:
Subject: Re: bigint out of range