public inbox for [email protected]  
help / color / mirror / Atom feed
From: Fujii Masao <[email protected]>
To: Shinya Kato <[email protected]>
Cc: PostgreSQL-development <[email protected]>
Subject: Re: Call EndCopyFrom() after initial table sync in logical replication
Date: Fri, 8 May 2026 00:04:27 +0900
Message-ID: <CAHGQGwEpwuq9U=Hhx3BbfGY-RrJ5rFvdQopO+0xyAuLVsMdfWA@mail.gmail.com> (raw)
In-Reply-To: <CAOzEurQKuy3RiPkd=25PEwEzaqHuGvEOf=X7vaVzhgNjaukYzA@mail.gmail.com>
References: <CAOzEurQKuy3RiPkd=25PEwEzaqHuGvEOf=X7vaVzhgNjaukYzA@mail.gmail.com>

On Mon, May 4, 2026 at 4:58 PM Shinya Kato <[email protected]> wrote:
>
> Hi hackers,
>
> While reading the logical replication initial table sync code, I
> noticed that copy_table() calls BeginCopyFrom() and CopyFrom() but
> never calls the matching EndCopyFrom().
>
> EndCopyFrom() calls pgstat_progress_end_command(), which resets
> st_progress_command to PROGRESS_COMMAND_INVALID. Without that call,
> the backend status entry continues to report an active COPY operation
> while the tablesync worker proceeds to WAL catchup. As a result,
> pg_stat_progress_copy shows a stale entry for the entire WAL catchup
> phase.
>
> Attached patch adds EndCopyFrom(cstate) immediately after
> CopyFrom(cstate) returns.

Thanks for the patch! It looks good to me.
Barring any objections, I will commit the patch.

Regards,

-- 
Fujii Masao





view thread (11+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Call EndCopyFrom() after initial table sync in logical replication
  In-Reply-To: <CAHGQGwEpwuq9U=Hhx3BbfGY-RrJ5rFvdQopO+0xyAuLVsMdfWA@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox