Repository navigation
Fix Lucene error from ChecksumException to TimeoutException - #4844
Merged
Merged
Conversation
…ut should have the cause be the original exception
… the byte read unless the read actually succeeded
ScottDugas
requested changes
Nov 6, 2026
Comment on lines
268
to
269
| position++; | ||
| verify(data != null, "current Data is null: " + fileName + " " + fileReference.getId()); |
Collaborator
There was a problem hiding this comment.
It seems like this should be after the verify call. If the verify fails (which it shouldn't), it would mean the position advanced, and you could potentially get the same issue with reading the footer and seeing a different hash (although that would require the second read to not have getCurrentData() return null).
Suggested change
| position++; | |
| verify(data != null, "current Data is null: " + fileName + " " + fileReference.getId()); | |
| verify(data != null, "current Data is null: " + fileName + " " + fileReference.getId()); | |
| position++; |
| new LuceneConcurrency.AsyncToSyncTimeoutException("Blah", new TimeoutException("Blah")), 0); | ||
|
|
||
| try (FDBIndexInput input = new FDBIndexInput("testReadByte", directory)) { | ||
| final IOException ex = assertThrows(IOException.class, input::readByte); |
Collaborator
There was a problem hiding this comment.
Adjacent to this issue, perhaps it would make sense to add the same test for readBytes. Looking at the code, I don't see a bug, but it's worth having for regression and consistency.
Contributor
Author
There was a problem hiding this comment.
Added another case for the unit test. The system-wide test is harder as creating a scenario for readBytes is more involved
ScottDugas
approved these changes
Nov 10, 2026
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.
This PR fixes an issue with the way Lucene handles a read failure. Before the change, a timeout error when opening an Index Input would fail with a checksum error due to the Input recording the byte as read although it was not. With this fix, a byte will only count as read if the operation succeeded.The issue that actually exposed this bug is that the checksum would be miscalculated as the reader would continue to read bytes trying to get to the footer.