Skip to content

CI only: logging stack #76 + #77 + #78 - #79

Closed
teknogeek0 wants to merge 4 commits into
mainfrom
feat/logging-subprocess-lines
Closed

teknogeek0 wants to merge 4 commits into
mainfrom
feat/logging-subprocess-lines

Conversation

@teknogeek0

Copy link
Copy Markdown
Collaborator

Draft PR to run the full CI matrix on the stacked logging PRs #76, #77, and #78. Do not merge. It will be closed after the run.

The PGCOPYDB_LOG_FILENAME file used a buffered FILE* that was not flushed
per record or before fork(), so lines from different processes were torn,
copied into children, or lost on a crash. JSON messages longer than 2048
bytes overflowed a stack buffer. Each record is now built in one buffer and
written with one write() to stderr, to the log file, and to a new JSON Lines
file at <dir>/log/pgcopydb.jsonl (PGCOPYDB_LOG_WORKDIR). The SIGQUIT handler
no longer logs from signal context. The new tests/logging suite checks that
the text and JSON output does not change and that concurrent writers do not
tear or duplicate records.
Remove the list indentation and the trailing space in a code span.
pgsql.c logged a Postgres error as one ERROR line per line of
PQerrorMessage, and an error in pgsql_execute_with_params was logged two
times. Each error is now one log record. The text output keeps the same
lines, each with its own prefix, and JSON output adds the endpoint, backend
PID, SQLSTATE, the PGresult diagnostic fields, and the query and params.
pgcopydb passed each 1024-byte read of pg_dump, pg_restore, and vacuumdb
output to the logger, which split lines that crossed a read boundary.
read_into_buf also stored the read() result in a size_t, so a failed read
wrote out of bounds. Output is now kept until a full line is read, and each
line is logged with an origin field. With more than one restore job,
pg_restore counts each failed item two times, so the restore tolerance now
uses the number of failed statements in its output.
@teknogeek0

Copy link
Copy Markdown
Collaborator Author

Full CI matrix passed (117 checks) for #76, #77, and #78. Closing this CI-only draft.

@teknogeek0 teknogeek0 closed this Oct 31, 2026
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