On 02/13/2014 10:58 AM, Heikki Linnakangas wrote:
>>> Perhaps we should use a lock to enforce that only one process tries to
>>> clean up the pending list at a time.
>>
>> Is that going to serialize all these inserts?
>
> It will serialize the cleanup process, which moves entries from the
> pending list to the tree proper. But that's better than the current
> situation. Currently, when two processes attempt it, they will both
> try to insert into the GIN tree, but one of them will notice that the
> other one already did the cleanup, and bail out. So only one process
> contributes to progress, while the others just waste their effort.
>
> The processes should try to get the lock, and just give up if it's
> already held rather than wait. If someone else is already doing the
> cleanup, there's no need for the current process to do it.
>
Sounds good.
cheers
andrew