Skip to content

Conversation

@dreamerns
Copy link

When reading from completed files at maxBytesPerFileRead boundary, the reader would attempt to read the message header before checking if it should rotate to the next file. This caused EOF errors and incorrectly marked valid files as corrupted (.bad).

Added pre-rotation check in readOne() that rotates to the next file before attempting to read when readPos >= maxBytesPerFileRead. The check only applies to completed files (readFileNum < writeFileNum) to avoid advancing past the current write file.

Tests added:

  • TestLargeMessageBoundary: Verifies file rotation with large messages
  • TestReadCurrentWriteFile: Ensures reader doesn't advance past write file

When reading from completed files at maxBytesPerFileRead boundary, the
reader would attempt to read the message header before checking if it
should rotate to the next file. This caused EOF errors and incorrectly
marked valid files as corrupted (.bad).

Added pre-rotation check in readOne() that rotates to the next file
before attempting to read when readPos >= maxBytesPerFileRead. The
check only applies to completed files (readFileNum < writeFileNum) to
avoid advancing past the current write file.

Tests added:
- TestLargeMessageBoundary: Verifies file rotation with large messages
- TestReadCurrentWriteFile: Ensures reader doesn't advance past write file
@NoFacePeace
Copy link

NoFacePeace commented Dec 1, 2025 via email

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