Skip to content

Add check-copy-stall.sh COPY stall diagnostic#65

Open
teknogeek0 wants to merge 2 commits into
mainfrom
feat/migration-diagnostics
Open

Add check-copy-stall.sh COPY stall diagnostic#65
teknogeek0 wants to merge 2 commits into
mainfrom
feat/migration-diagnostics

Conversation

@teknogeek0

Copy link
Copy Markdown
Contributor

Adds a read-only, target-side diagnostic for a stalled or slow pgcopydb COPY during the initial copy phase.

What

check-copy-stall.sh answers the two questions that matter when a migration looks stuck:

  1. Is anything actually lock-blocked (and who holds it)?
  2. Where is time being spent — source feed, disk IO, WAL, or a lock — and is data still landing?

Sections: blocking tree, ungranted locks, wait-event summary, active COPY progress, running vacuums, idle-in-transaction sessions, and an optional throughput sample (--no-sample / --sample-secs N).

Notes

  • Read-only: connects with default_transaction_read_only=on plus statement/lock timeouts; makes no modifications to the target.
  • Documented in README.md and AGENTS.md.

No automated test suite in this repo; validated by syntax check and code inspection.

teknogeek0 and others added 2 commits June 18, 2026 18:11
Read-only target-side diagnostic: blocking tree, ungranted locks, wait-event
summary, active COPY/vacuum progress, idle-in-transaction sessions, and an
optional throughput sample. Documents it in README and AGENTS.
@DmitriiAn

Copy link
Copy Markdown
Contributor

looks good. two minor changes:

  • Validate --sample-secs - rejects non-numeric, zero, and negative values with a clear error instead of failing mid-run on sleep/divide-by-zero
  • Guard the throughput sample - section 7 now checks the DB-size values (B0/B1), not just the LSNs, before building the SQL, avoiding a silently-swallowed query error on a partial sample

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