Skip to content

feat: report the step a gzipInPlace error came from - #82

Merged
HaoZeke merged 1 commit into
developfrom
feat/gzip-step-report
Nov 25, 2026
Merged

HaoZeke merged 1 commit into
developfrom
feat/gzip-step-report

Conversation

@HaoZeke

@HaoZeke HaoZeke commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

gzipInPlace returns the same error set from every step. A caller cannot
tell a log left as it was from a log whose archive is in place with the
original removed and only the final directory sync failed. A rotate that
counts compressed logs needs that difference. Guessing it from the error
value or from a stat afterwards is wrong when another process changes
the same directory.

gzipInPlaceAtStep takes a GzipStep out-parameter. It starts as archive
and becomes directory_sync once the archive is renamed into place and
the original removed, right before the archive's directory is opened
and synced. On an archive error the original file stays in place and
the call left no archive. On a directory_sync error the archive is in
place and the original is gone. gzipInPlace keeps its signature and
calls gzipInPlaceAtStep with a step of its own.

One test refuses an existing archive and a missing log, and expects
archive both times with the log left in place. The other lowers the
soft descriptor limit to just above the two descriptors the archive
step needs, so the open of the directory for its sync is the first
call refused. It expects directory_sync, EMFILE, an archive that
gzip -t accepts and no original. Both fail to build on the parent,
which has no gzipInPlaceAtStep.

@HaoZeke
HaoZeke changed the base branch from main to develop November 21, 2026 05:32
gzipInPlace returns the same error set from every step. A caller cannot
tell a log left as it was from a log whose archive is in place with the
original removed and only the final directory sync failed. A rotate that
counts compressed logs needs that difference. Guessing it from the error
value or from a stat afterwards is wrong when another process changes
the same directory.

gzipInPlaceAtStep takes a GzipStep out-parameter. It starts as archive
and becomes directory_sync once the archive is renamed into place and
the original removed, right before the archive's directory is opened
and synced. On an archive error the original file stays in place and
the call left no archive. On a directory_sync error the archive is in
place and the original is gone. gzipInPlace keeps its signature and
calls gzipInPlaceAtStep with a step of its own.

One test refuses an existing archive and a missing log, and expects
archive both times with the log left in place. The other test lowers
the soft descriptor limit to just above the two descriptors the archive
step needs. Opening the directory for the sync is then the first call
refused. That test expects directory_sync, EMFILE, an archive that
gzip -t accepts and no original. Both tests fail to build on the
parent, which has no gzipInPlaceAtStep.
@HaoZeke
HaoZeke force-pushed the feat/gzip-step-report branch from e498079 to 2d442d1 Compare November 25, 2026 02:32
@HaoZeke
HaoZeke merged commit 68f0fe4 into develop Nov 25, 2026
8 checks passed
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