Repository navigation
fix(file): preserve records buffered before rotation - #2653
Draft
Huzaifa-Asif wants to merge 1 commit into
Draft
Huzaifa-Asif wants to merge 1 commit into
Huzaifa-Asif wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2354.
When records buffered before the first file opens exceed
maxsize, the opening-rotation path destroys the destination before its writes finish. This can discard the entire initial batch. Wait for that destination to finish before cleanup, compression or renaming, and opening the next file. A write error also releases the wait and advances rotation, preserving the existing error-reporting behavior; bytes from a failed write are not recoverable.Add real-file logger regressions for ordinary, tailable and compressed rotation, ending before the first open, and accepting later records after an injected native write failure. The compressed cases also check that archiving starts after the source destination finishes. Restore existing assertions that documented lost initial records, and make the steady-state size test wait for opening and each logged record.
maxsizeremains a best-effort rotation threshold: a batch buffered before opening, or a single oversized record, can exceed it.Validation on macOS arm64, Node 24.18.1:
--watchman=false --runInBand --forceExit; existing open handles leave ordinary Jest running after assertions finish.git diff --checkpassed.AI assistance: Codex implemented and tested this patch, and a separate Codex reviewer investigated it independently. No personal human review is claimed.