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

health: use blocking queries for near query parameter #10068

Closed
wants to merge 3 commits into from

Conversation

dnephin
Copy link
Contributor

@dnephin dnephin commented Apr 19, 2021

Effectively reverts the changes in #9758

There's no reason to error here. We can still satisfy the request using blocking queries.

@dnephin dnephin added the pr/no-changelog PR does not need a corresponding .changelog entry label Apr 19, 2021
@github-actions github-actions bot added theme/health-checks Health Check functionality type/docs Documentation needs to be created/updated/clarified labels Apr 19, 2021
@hashicorp-ci
Copy link
Contributor

🤔 This PR has changes in the website/ directory but does not have a type/docs-cherrypick label. If the changes are for the next version, this can be ignored. If they are updates to current docs, attach the label to auto cherrypick to the stable-website branch after merging.

@rboyer
Copy link
Member

rboyer commented Apr 19, 2021

Would a test be feasible?

@dnephin
Copy link
Contributor Author

dnephin commented Apr 19, 2021

Ya, probably good to setup a table test for this. Ideally this could be tested entirely in the rpcclient/health package, but until we remove agent/cache from streaming we need some additional logic in the http handler to check if the agent.cconfig.HTTPUseCache is enabled.

Testing the HTTP handler is unfortunately not as easy as it should be, because it doesn't use an interface for the backend.

dnephin added 2 commits April 19, 2021 17:14
Setting this field to a value is equivalent to using the 'near' query paramter.
The intent is to sort the results by proximity to the node requesting
them. However with connect we send the results to envoy, which doesn't
care about the order, so setting this field is increasing the work
performed for no gain.

It is necessary to unset this field now because we would like connect
to use streaming, but streaming does not support sorting by proximity.
This will be much easier once agent/cache is removed from streaming, so putting this on hold
for now.
@dnephin dnephin marked this pull request as draft April 19, 2021 21:51
@vercel vercel bot temporarily deployed to Preview – consul April 19, 2021 21:51 Inactive
@vercel vercel bot temporarily deployed to Preview – consul-ui-staging April 19, 2021 21:51 Inactive
@@ -81,8 +81,16 @@ func (c *Client) Notify(
ch chan<- cache.UpdateEvent,
) error {
cacheName := c.CacheName
if req.Ingress {
cacheName = c.CacheNameIngress
if req.Ingress || req.Source.Node != "" {
Copy link
Member

Choose a reason for hiding this comment

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

It's not a straight replacement, but it would be neat if you could share this potentially variable conditional line with the same line in UseStreaming to avoid drift should either one pick up another clause.

return false
}

return req.QueryOptions.UseCache || req.QueryOptions.MinQueryIndex > 0
Copy link
Member

Choose a reason for hiding this comment

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

why is args.QueryOptions.UseCache here? It wasn't here in the pre-PR equivalent, and the place it was present is used differently when evaluating the chain of boolean expressions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I realized while working on this that it will be easier to do after the change to remove agent/cache from streaming, so I marked this PR as a draft.

The goal here is to move all of the "backend selection" logic to a single place. Right now it is still split across two places. The other places (the http handler) included UseCache, as did another condition in this file above.

Once that is done I should also be able to remove the duplication you called out in the other comment.

@dnephin
Copy link
Contributor Author

dnephin commented Apr 28, 2021

This change was merged as part of #10112, because that change made it possible to test this one.

@dnephin dnephin closed this Apr 28, 2021
@dnephin dnephin deleted the dnephin/health-fall-back-to-blocking-query branch April 28, 2021 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr/no-changelog PR does not need a corresponding .changelog entry theme/health-checks Health Check functionality type/docs Documentation needs to be created/updated/clarified
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants