-
Notifications
You must be signed in to change notification settings - Fork 561
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ingest: add long polling to TestConcurrentFetchers (#9971)
* ingest: add long polling to TestConcurrentFetchers 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 over `fetchers.PollFetches` multiple times until a timeout or until we fetch the expected number of records. I set the timeout to 2s because of the MinBytesMaxWait of 1s in tests ([code](https://github.com/grafana/mimir/blob/96c92c99ef5599d4507c2aa9f6d7ddf42d5beec2/pkg/storage/ingest/fetcher_test.go#L1373)): * fetcher receives 1 record (1st request) * fetcher sends the `fetchResult` to `fetchWant.result` * fetcher receives 2 records (2nd request) * fetcher can't send the result to `fetchWant.result` because `start()` isn't receiving on the channel; `start()` is trying to send to `orderedFetches` * fetcher start another (3rd) attempt; the attempt takes 1s (`MaxWaitMillis` in the Fetch request) * client calls `PollFetches`, reads from orderedFetches; receives the first `Fetches` with 1 records; `start()` goes back to waiting on `fetchWant.result` * client calls `PollFetches`, `start()` is still waiting on `fetchWant.result` * fetcher receives the response to 3rd request with no records; sends the buffered 2 records from 2nd request * client receives 2 records Another solution to waiting for 2s is to make the merging of results in `start()` for example. Signed-off-by: Dimitar Dimitrov <[email protected]> * Undo testing logger Signed-off-by: Dimitar Dimitrov <[email protected]> * Add 2s to remaining places Signed-off-by: Dimitar Dimitrov <[email protected]> * Use testing logger Signed-off-by: Dimitar Dimitrov <[email protected]> * Don't immediately abort test when there are some buffered records Signed-off-by: Dimitar Dimitrov <[email protected]> * Increase timeout Signed-off-by: Dimitar Dimitrov <[email protected]> --------- Signed-off-by: Dimitar Dimitrov <[email protected]>
- Loading branch information
1 parent
fbebaf8
commit d9c223f
Showing
1 changed file
with
77 additions
and
101 deletions.
There are no files selected for viewing
This file contains 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