Skip to content

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

Open
teknogeek0 wants to merge 1 commit into
mainfrom
feat/target-connection-diagnostics
Open

teknogeek0 wants to merge 1 commit 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.
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.

1 participant