Re: repack: clarify final phase of concurrent mode in file header comment - Mailing list pgsql-hackers

From Jakub Wartak
Subject Re: repack: clarify final phase of concurrent mode in file header comment
Date
Msg-id CAKZiRmy__XBiGEYAQzsAujAZ-HUE_25Tr2tUVFuVDbWOQwDZZw@mail.gmail.com
Whole thread
In response to repack: clarify final phase of concurrent mode in file header comment  (Chao Li <li.evan.chao@gmail.com>)
Responses Re: repack: clarify final phase of concurrent mode in file header comment
List pgsql-hackers
On Thu, Apr 16, 2026 at 5:33 AM Chao Li <li.evan.chao@gmail.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
theremaining changes. 
>
> I am afraid other readers may have the same confusion, so I am proposing this small patch to make the file header
commenta bit clearer. 

LGTM, so +1

-J.



pgsql-hackers by date:

Previous
From: Álvaro Herrera
Date:
Subject: Re: Fix unqualified catalog references in psql describe queries
Next
From: Xuneng Zhou
Date:
Subject: Re: t/035_standby_logical_decoding.pl might fail on attempt to read wrong timeline