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

Add memcached server address to Set() error #2775

Merged
merged 2 commits into from
Jun 18, 2020

Conversation

pracucci
Copy link
Contributor

  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Changes

Today I was investigating the error memcache: unexpected response line from \"set\": \"SERVER_ERROR Out of memory during read\\r\\n\ in Cortex and I had some hard time figuring out which was the memcached server.

In this PR I propose to inject the server address to the Set() error.

Note: the same thing is difficult to do with the GetMulti() because we may potentially touch many (sometimes all) memcached server during a multi get request.

Verification

Existing tests.

Copy link
Member

@squat squat left a comment

Choose a reason for hiding this comment

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

looks good generally :)

@@ -463,3 +464,8 @@ func (c *memcachedClient) resolveAddrs() error {

return c.selector.SetServers(servers...)
}

func (c *memcachedClient) getServerAddrByKey(key string) net.Addr {
addr, _ := c.selector.PickServer(key)
Copy link
Member

Choose a reason for hiding this comment

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

could we be strict check the error? Or at least document why we are 100% confident the error does not need checking?

Copy link
Member

Choose a reason for hiding this comment

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

IMO if this fails we just log empty addr, which is fine, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IMO if this fails we just log empty addr, which is fine, no?

Correct. That was my intention. What's your take @squat ?

Copy link
Member

Choose a reason for hiding this comment

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

that's OK but nothing is preventing anyone from using this internally and getting surprised later when something doesn't work and there's no error. Any reason this really needs to be a new func vs simply inlined above 291? Otherwise I would suggest to add this exact thing as a comment :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right. I removed the function. What's about now?

Signed-off-by: Marco Pracucci <[email protected]>
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.

LGTM, I was initially confused by ignoring error, but for logging purposes it's totally ok, I think it does not need commenting even. Anyway works both ways.

@bwplotka bwplotka merged commit 2c4697f into thanos-io:master Jun 18, 2020
Harshitha1234 pushed a commit to Harshitha1234/thanos that referenced this pull request Jun 18, 2020
* Add memcached server address to Set() error

Signed-off-by: Marco Pracucci <[email protected]>

* Addressed review comments

Signed-off-by: Marco Pracucci <[email protected]>
Signed-off-by: Harshitha1234 <[email protected]>
@pracucci pracucci deleted the log-memcached-server-on-set-error branch June 19, 2020 15:06
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.

4 participants