Fix chashsubset backend with canary (#7235)

* Fix chashsubset backend with canary

* use floor for buckets calculation to remove hot spot

* Remove testing code
This commit is contained in:
Wei Wu 2021-12-29 16:14:50 -08:00 committed by GitHub
parent a14edba8d5
commit e625c2507a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 2 deletions

View file

@ -25,7 +25,6 @@ local function build_subset_map(backend)
local set_count = math.ceil(#endpoints/subset_size)
local node_count = set_count * subset_size
-- if we don't have enough endpoints, we reuse endpoints in the last set to
-- keep the same number on all of them.
local j = 1
@ -61,7 +60,9 @@ function _M.new(self, backend)
instance = resty_chash:new(subset_map),
hash_by = complex_val,
subsets = subsets,
current_endpoints = backend.endpoints
current_endpoints = backend.endpoints,
traffic_shaping_policy = backend.trafficShapingPolicy,
alternative_backends = backend.alternativeBackends,
}
setmetatable(o, self)
self.__index = self