This is an automated email from the ASF dual-hosted git repository.
spacewander pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git
The following commit(s) were added to refs/heads/master by this push:
new fd0bcc0 fix(stream): missing shdict to store etcd health check info
(#4608)
fd0bcc0 is described below
commit fd0bcc034f0b79a54d71857cb5063895508fad04
Author: 罗泽轩 <[email protected]>
AuthorDate: Fri Jul 16 14:54:47 2021 +0800
fix(stream): missing shdict to store etcd health check info (#4608)
Signed-off-by: spacewander <[email protected]>
---
apisix/cli/ngx_tpl.lua | 1 +
apisix/core/config_etcd.lua | 6 +++++-
conf/config-default.yaml | 1 +
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/apisix/cli/ngx_tpl.lua b/apisix/cli/ngx_tpl.lua
index 5909691..d538937 100644
--- a/apisix/cli/ngx_tpl.lua
+++ b/apisix/cli/ngx_tpl.lua
@@ -68,6 +68,7 @@ stream {
lua_shared_dict lrucache-lock-stream {*
stream.lua_shared_dict["lrucache-lock-stream"] *};
lua_shared_dict plugin-limit-conn-stream {*
stream.lua_shared_dict["plugin-limit-conn-stream"] *};
+ lua_shared_dict etcd-cluster-health-check-stream {*
stream.lua_shared_dict["etcd-cluster-health-check-stream"] *};
resolver {% for _, dns_addr in ipairs(dns_resolver or {}) do %}
{*dns_addr*} {% end %} {% if dns_resolver_valid then %}
valid={*dns_resolver_valid*}{% end %};
resolver_timeout {*resolver_timeout*};
diff --git a/apisix/core/config_etcd.lua b/apisix/core/config_etcd.lua
index 94e91af..2cbd4e9 100644
--- a/apisix/core/config_etcd.lua
+++ b/apisix/core/config_etcd.lua
@@ -47,6 +47,10 @@ local health_check = require("resty.etcd.health_check")
local is_http = ngx.config.subsystem == "http"
local err_etcd_unhealthy_all = "has no healthy etcd endpoint available"
+local health_check_shm_name = "etcd-cluster-health-check"
+if not is_http then
+ health_check_shm_name = health_check_shm_name .. "-stream"
+end
local created_obj = {}
local loaded_configuration = {}
@@ -543,7 +547,7 @@ local function _automatic_fetch(premature, self)
if not health_check.conf then
local _, err = health_check.init({
- shm_name = "etcd-cluster-health-check",
+ shm_name = health_check_shm_name,
fail_timeout = self.health_check_timeout,
max_fails = 3,
retry = true,
diff --git a/conf/config-default.yaml b/conf/config-default.yaml
index 2e6b4da..e221a4a 100644
--- a/conf/config-default.yaml
+++ b/conf/config-default.yaml
@@ -148,6 +148,7 @@ nginx_config: # config for render the
template to generate n
stream:
lua_shared_dict:
+ etcd-cluster-health-check-stream: 10m
lrucache-lock-stream: 10m
plugin-limit-conn-stream: 10m