Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

query: Add Store timeout to Thanos Query #920

Closed
wants to merge 6 commits into from

Conversation

povilasv
Copy link
Member

@povilasv povilasv commented Mar 13, 2019

Changes

Taking over #895 as I'm affected by it too #919

@d-ulyanov has done a great job and only one thing left from that PR to fix, which I'm fixing here:

#895 (comment)

I move time out from querier to proxy

@povilasv povilasv force-pushed the store-timeout branch 3 times, most recently from 0892fc5 to 4f385bd Compare March 15, 2019 10:21
@povilasv povilasv changed the title WIP: Store timeout tore timeout Mar 15, 2019
@povilasv povilasv changed the title tore timeout Add Store timeout to Thanos Query Mar 15, 2019
@bwplotka bwplotka requested review from bwplotka and GiedriusS and removed request for bwplotka March 15, 2019 12:02
@povilasv povilasv changed the title Add Store timeout to Thanos Query query: Add Store timeout to Thanos Query Mar 15, 2019
Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nits really, generally I like this! Thanks (:

@@ -10,7 +10,7 @@ NOTE: As semantic versioning states all 0.y.z releases can contain breaking chan
We use *breaking* word for marking changes that are not backward compatible (relates only to v0.y.z releases.)

## Unreleased

- [#920](https://github.com/improbable-eng/thanos/pull/920) Add Thanos store.read-timeout. Maximum time to read response from store, which defaults to 2 minutes. If request to one of stores is timed out and store.read-timeout < query.timeout partial response will be returned. If store.read-timeout >= query.timeout one of stores is timed out the client will get no data and timeout error.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move it to Added section and remove add word

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

partial response will be returned (if partial response is enabled)

queryMaxDuration := time.Duration(*queryTimeout)
storeReadMaxDuration := time.Duration(*storeReadTimeout)

if storeReadMaxDuration > queryMaxDuration {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove that. Context logic already ensures that

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@@ -270,5 +270,12 @@ Flags:
if no max_source_resolution param is specified.
--query.partial-response Enable partial response for queries if no
partial_response param is specified.
--store.read-timeout=2m Maximum time to read response from store. If
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here (mention about disabling partial response)

storeClient := &store.ClientMock{
StoreClientMock: &storepb.StoreClientMock{
SeriesCallback: func(ctx context.Context, in *storepb.SeriesRequest, opts ...grpc.CallOption) (storepb.Store_SeriesClient, error) {
// Just wait for ctx.Done() as it works internally in GRPC StoreClient
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing trailing period

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also I would remove this, I think it's obvious.

@@ -274,6 +277,54 @@ func TestDedupSeriesIterator(t *testing.T) {
}
}

func TestQuerier_StoreReadTimeout(t *testing.T) {
storeClient := &store.ClientMock{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be more comfortable if this test would have also another client that actually serves some metrics after 100 miliseconds.

}

storeReadTimeout := 1 * time.Millisecond
queryTimeout := 1 * time.Second
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's make it longer otherwise slow CI will make this test flaky


select {
case <-storeQueryDone:
// Do nothing - storeQuery expected to finish first
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing trailing periods at the end

import "github.com/improbable-eng/thanos/pkg/store/storepb"

// ClientMock is a structure for mocking storepb.Client interface
type ClientMock struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can move it to mock_test.go file instead

@@ -51,7 +51,7 @@ func TestProxyStore_Info(t *testing.T) {
q := NewProxyStore(nil,
func() []Client { return nil },
component.Query,
nil,
nil, 100*time.Second,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 * time.Minute?

)

// StoreClientMock is a structure for mocking StoreClient interface
type StoreClientMock struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is necessary. See my comment here: #895 (comment)

@d-ulyanov
Copy link
Contributor

@povilasv this diff seems strange, I see mock.go here (I've removed it) and some changes that I've removed too.

Lets re-create PR pls, don't you mind?

@povilasv
Copy link
Member Author

@d-ulyanov your PR is all good now, was outdated when I started doing mine. So let's just use yours.

@povilasv povilasv closed this Mar 15, 2019
@d-ulyanov
Copy link
Contributor

Okay, cool, thanks @povilasv
Let me know if you need any help :)

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.

3 participants