ingest: add long polling to TestConcurrentFetchers #9971
Merged
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.
What this PR does
Some of the tests assume that we'd fetch all produced records in one go. The Kafka protocol doesn't guarantee that and sometimes kfake also returns less than that. This means that sometimes the tests would finish early before we've fetched all records.
This PR introduced
logPollFetches
which loops overfetchers.PollFetches
multiple times until a timeout or until we fetch the expected number of records.I also changed all places which had this assumption and all places which already did some form of log polling.
2s timeout
I set the timeout to 2s because of the MinBytesMaxWait of 1s in tests (code):
fetchResult
tofetchWant.result
fetchWant.result
becausestart()
isn't receiving on the channel;start()
is trying to send toorderedFetches
MaxWaitMillis
in the Fetch request)PollFetches
, reads from orderedFetches; receives the firstFetches
with 1 records;start()
goes back to waiting onfetchWant.result
PollFetches
,start()
is still waiting onfetchWant.result
Another solution to waiting for 2s is to make the merging of results in
start()
for example.Which issue(s) this PR fixes or relates to
Fixes #9970
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]
.about-versioning.md
updated with experimental features.