Call EndCopyFrom() after initial table sync in logical replication - Mailing list pgsql-hackers

From Shinya Kato
Subject Call EndCopyFrom() after initial table sync in logical replication
Date
Msg-id CAOzEurQKuy3RiPkd=25PEwEzaqHuGvEOf=X7vaVzhgNjaukYzA@mail.gmail.com
Whole thread
List 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

pgsql-hackers by date:

Previous
From: Bertrand Drouvot
Date:
Subject: Re: meson/testwrap: support EXTRA_REGRESS_OPTS environment variable
Next
From: Tomas Vondra
Date:
Subject: PoC: VALGRIND_MAKE_MEM_NOACCESS for dynamic shared memory