fix: make set_more_retries() work when upstream_type is chash#2676
Merged
Conversation
spacewander
requested changes
Nov 13, 2020
|
|
||
| function _M.new(up_nodes, upstream) | ||
| local str_null = str_char(0) | ||
| local last_server_index |
Member
There was a problem hiding this comment.
The last_server_index should be in ctx scope, not the upstream one. We should not share the same index across different requests to an upstream.
spacewander
requested changes
Nov 17, 2020
| local id = picker:find(chash_key) | ||
| local id | ||
| if ctx.balancer_try_count > 1 and ctx.last_server_index then | ||
| id, ctx.last_server_index = picker:next(ctx.last_server_index) |
Member
There was a problem hiding this comment.
Better to use name like ctx.chash_last_server_index
Member
|
Please write new test to verify the fix and make sure the tests are passed. |
Member
|
ping @zfs123 |
This reverts commit 6cae977.
spacewander
approved these changes
Jan 7, 2021
tokers
approved these changes
Jan 7, 2021
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
chash will pick next if last doesn't work to enable set_more_retries().
Pre-submission checklist: