Skip to content

Report the target server state after a lost target connection - #71

Merged
teknogeek0 merged 2 commits into
mainfrom
feat/target-connection-diagnostics
Oct 29, 2026
Merged

teknogeek0 merged 2 commits into
mainfrom
feat/target-connection-diagnostics

Conversation

@teknogeek0

Copy link
Copy Markdown
Collaborator

At the start of the copy, pgcopydb logs the target pg_postmaster_start_time() and the CREATE INDEX memory budget (--index-jobs times maintenance_work_mem, with max_parallel_maintenance_workers). When a COPY, CREATE INDEX, or VACUUM worker loses its target connection, copydb_target_report() connects again and logs the SQLSTATE and one of these results: the target restarted, the target did not restart (a process terminated the session), or the target cannot be reached. The logic is in target_state.c.

The new index-target-terminate suite slows one CREATE INDEX with a target event trigger and ends it with pg_terminate_backend(). The log shows SQLSTATE 57P01 and "Target server did not restart".

Tests: full PG18 suite, 36 of 36 suites pass.

At the start of the copy, log the target server start time and the
CREATE INDEX memory budget (index jobs times maintenance_work_mem).
When a COPY, CREATE INDEX, or VACUUM worker loses its target
connection, connect again and log whether the target restarted,
terminated the session, or cannot be reached.
…n-diagnostics

# Conflicts:
#	.github/workflows/run-tests-tiered.yml
#	tests/Makefile
@teknogeek0
teknogeek0 merged commit de48ddf into main Oct 29, 2026
239 of 240 checks passed
@teknogeek0
teknogeek0 deleted the feat/target-connection-diagnostics branch October 29, 2026 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants