Thank you for your suggestions, do not hesitate to ask any questions,
concurrency and GIN both are very interesting topics.

I had a look on patch and found some issue.
Look at ginvacuum.c around line 387, function ginVacuumPostingTreeLeaves():

         * All subtree is empty - just return TRUE to indicate that parent must
         * do a cleanup. Unless we are ROOT an there is way to go upper.

        if(isChildHasVoid && !isAnyNonempy && !isRoot)
            return TRUE;

                ginScanToDelete(gvs, blkno, TRUE, &root, InvalidOffsetNumber);

In first 'if' clause I see !isRoot, so second if and corresponding ginScanToDelete() could be called only for root in posting tree. If so, it seems to me, it wasn't a good idea to move ginScanToDelete() from ginVacuumPostingTree() and patch should just remove lock for cleanup over ginVacuumPostingTreeLeaves() and if it returns that tree contains empty page then lock the whole posting tree to do ginScanToDelete() work.

Teodor Sigaev                                   E-mail:

Sent via pgsql-hackers mailing list (
To make changes to your subscription:

Reply via email to