| From: | Shinya Kato <shinya11(dot)kato(at)gmail(dot)com> |
|---|---|
| To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Call EndCopyFrom() after initial table sync in logical replication |
| Date: | 2026-05-04 07:58:12 |
| Message-ID: | CAOzEurQKuy3RiPkd=25PEwEzaqHuGvEOf=X7vaVzhgNjaukYzA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
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.
--
Best regards,
Shinya Kato
NTT OSS Center
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Call-EndCopyFrom-during-initial-table-sync-in-log.patch | application/octet-stream | 1.4 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tomas Vondra | 2026-05-04 08:18:31 | PoC: VALGRIND_MAKE_MEM_NOACCESS for dynamic shared memory |
| Previous Message | Bertrand Drouvot | 2026-05-04 05:57:45 | Re: meson/testwrap: support EXTRA_REGRESS_OPTS environment variable |