Re: WIP: parallel GiST index builds

From: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
To: "Andrey M(dot) Borodin" <x4mmm(at)yandex-team(dot)ru>
Cc: Andreas Karlsson <andreas(at)proxel(dot)se>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: WIP: parallel GiST index builds
Date: 2024-07-30 12:46:39
Message-ID: 1623fcb5-8bcb-4e99-af99-45c76a3797e3@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 7/30/24 13:31, Andrey M. Borodin wrote:
>
>
>> On 30 Jul 2024, at 14:57, Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com> wrote:
>>
>>>
>>> How do we synchronize Shared Fake LSN with global XLogCtl->unloggedLSN? Just bump XLogCtl->unloggedLSN if necessary?
>>> Perhaps, consider using GetFakeLSNForUnloggedRel() instead of shared counter? As long as we do not care about FakeLSN>RealLSN.
>>>
>>
>> I'm confused. How is this related to unloggedLSN at all?
>
> Parallel build should work for both logged and unlogged indexes.

Agreed, no argument here.

> If we use fake LSN in shared memory, we have to make sure that FakeLSN < XLogCtl->unloggedLSN after build.
> Either way we can just use XLogCtl->unloggedLSN instead of FakeLSN in shared memory.
>

Ah, right. For unlogged relations we won't invoke log_newpage_range(),
so we'd end up with the bogus page LSNs ...

> In other words I propose to use GetFakeLSNForUnloggedRel() instead of "pg_atomic_uint64 *fakelsn;”.
>

Interesting idea. IIRC you suggested this earlier, but I didn't realize
it has the benefit of already using an atomic counter - which solves the
"ugliness" of my patch.

regards

--
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2024-07-30 12:54:59 Re: Conflict Detection and Resolution
Previous Message Thomas Munro 2024-07-30 12:33:05 Re: PG17beta2: SMGR: inconsistent type for nblocks