diff options
author | HuabingZhao <zhao.huabing@zte.com.cn> | 2018-03-07 02:51:22 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-03-07 02:51:22 +0000 |
commit | dcdaf85627b6930ee89ef69991c8780955c4c7dd (patch) | |
tree | a9b557cf977a848eeeda7bfbdb332a971adf244f | |
parent | e3fe9e031dbff934a911fbb8c4ca795daecea86a (diff) | |
parent | 243e817e999324ac8d5b23037876aee7a5720100 (diff) |
Merge "Solve IP-Hash issue"
-rw-r--r-- | openresty-ext/src/assembly/resources/openresty/nginx/luaext/loadbalance/policy/consistent_hash.lua | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/openresty-ext/src/assembly/resources/openresty/nginx/luaext/loadbalance/policy/consistent_hash.lua b/openresty-ext/src/assembly/resources/openresty/nginx/luaext/loadbalance/policy/consistent_hash.lua index b3cd46e..344b261 100644 --- a/openresty-ext/src/assembly/resources/openresty/nginx/luaext/loadbalance/policy/consistent_hash.lua +++ b/openresty-ext/src/assembly/resources/openresty/nginx/luaext/loadbalance/policy/consistent_hash.lua @@ -31,7 +31,7 @@ local LUCKY_NUM = 13 local tbl_util = require('lib.utils.table_util') local tbl_isempty = tbl_util.isempty -local tbl_isequal = require('pl.tablex') +local tablex = require('pl.tablex') local peerwatcher = require "core.peerwatcher" local ngx_var = ngx.var local hash_data = {} @@ -73,10 +73,10 @@ end local function update_consistent_hash_state(hash_data,servers,svckey) -- compare servers in ctx with servers in cache -- update the hash data if changes occur - local serverscache = hash_data[svckey].servers + local serverscache = tablex.deepcopy(hash_data[svckey].servers) tab_sort(serverscache, function(a, b) return a.ip < b.ip end) tab_sort(servers, function(a, b) return a.ip < b.ip end) - if not tbl_isequal.deepcompare(serverscache, servers, false) then + if not tablex.deepcompare(serverscache, servers, false) then local tmp_chash = init_consistent_hash_state(servers) hash_data[svckey].servers =servers hash_data[svckey].chash = tmp_chash |