Re: repack: clarify final phase of concurrent mode in file header comment

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: Jakub Wartak <jakub(dot)wartak(at)enterprisedb(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Subject: Re: repack: clarify final phase of concurrent mode in file header comment
Date: 2026-06-10 09:21:40
Message-ID: 0BC524D0-D12E-49C0-93A3-D0AE91F89C41@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Jun 10, 2026, at 16:33, Jakub Wartak <jakub(dot)wartak(at)enterprisedb(dot)com> wrote:
>
> On Thu, Apr 16, 2026 at 5:33 AM Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> wrote:
>>
>> Hi,
>>
>> The file header comment in repack.c briefly explains the workflow of concurrent mode as:
>>
>> 1. Lock the table with ShareUpdateExclusiveLock
>> 2. Do an initial copy as non-concurrent mode
>> 3. While the initial copy is going on, accumulates concurrent changes to a file
>> 4. After the initial copy, read the file and re-apply the changes
>> 5. Upgrade to AccessExclusiveLock and swap the relfilenodes
>>
>> When I read the comment, I got confused at step 4. While that re-apply pass is running, concurrent changes can still occur, so what happens to those changes?
>>
>> After reading the code, I see that there is actually an extra step after upgrading to AccessExclusiveLock to process the remaining changes.
>>
>> I am afraid other readers may have the same confusion, so I am proposing this small patch to make the file header comment a bit clearer.
>
> LGTM, so +1
>
> -J.

Thanks for the review.

Rebased to v2.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

Attachment Content-Type Size
v2-0001-repack-clarify-final-phase-of-concurrent-mode-in-.patch application/octet-stream 1.5 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message shveta malik 2026-06-10 09:37:27 Re: Proposal: Conflict log history table for Logical Replication
Previous Message Chao Li 2026-06-10 09:15:38 Re: [PATCH] Rebuild CHECK constraints after generated column SET EXPRESSION