SOLR-18294: Fix flaky IndexFetcherPacketProtocolTest#4624
Open
shubhamranjan wants to merge 12 commits into
Open
SOLR-18294: Fix flaky IndexFetcherPacketProtocolTest#4624shubhamranjan wants to merge 12 commits into
shubhamranjan wants to merge 12 commits into
Conversation
The test wrote its sample file into the core index directory acquired with DirContext.DEFAULT, while the sender (DirectoryFileStream) reads it with DirContext.REPLICATION. CachingDirectoryFactory.filterDirectory() unwraps REPLICATION/BACKUP directories via FilterDirectory.unwrap() to the raw delegate, so under the randomized test DirectoryFactory the file written through the wrapped view could be invisible through the unwrapped view, intermittently throwing NoSuchFileException -> empty stream -> NO_CONTENT and failing the round-trip assertion. Acquire the directory with the same REPLICATION DirContext the sender uses, so the write and the read target the same delegate.
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.
https://issues.apache.org/jira/browse/SOLR-18294
Description
IndexFetcherPacketProtocolTestfails intermittently (~5%) with:java.lang.AssertionError: fetchPackets return code mismatch expected:<0> but was:<1>The test writes its sample file into the core index directory obtained with
DirContext.DEFAULT, then has the sender (ReplicationAPIBase.DirectoryFileStream) serialize it. The sender reads viaDirContext.REPLICATION, whichCachingDirectoryFactory.filterDirectory()resolves throughFilterDirectory.unwrap()to the raw delegate. Under the randomized testDirectoryFactory, a file written through the wrapped (DEFAULT) view can be invisible through the unwrapped (REPLICATION) view, so the sender throwsNoSuchFileException, emits an empty stream, and the receiver returnsNO_CONTENT(1) — failing the assertion.Solution
Acquire the directory in the test with the same
REPLICATIONDirContextthe sender uses, so the write and the read target the same delegateDirectory. Test-only change; production replication is unaffected (it serves committed, fsync'd segments that are always present on the delegate).Tests
IndexFetcherPacketProtocolTestpasses.-Ptests.nightly=trueand-Ptests.directory=ByteBuffersDirectory, with no failures.Checklist
mainbranch../gradlew check.