From c8e03f93912299cfd6e0e94e8571c44bcdc6932f Mon Sep 17 00:00:00 2001 From: Datong Sun Date: Thu, 23 Dec 2021 19:01:44 -0800 Subject: [PATCH] addressed review comments from Wangchong --- kong/api/routes/config.lua | 2 +- kong/clustering/data_plane.lua | 4 ---- kong/db/declarative/init.lua | 5 ++++- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/kong/api/routes/config.lua b/kong/api/routes/config.lua index b31e3380a395..67be493f59ad 100644 --- a/kong/api/routes/config.lua +++ b/kong/api/routes/config.lua @@ -118,7 +118,7 @@ return { }) end - if err:find("MDB_MAP_FULL", nil, true) then + if err == "map full" then kong.log.err("not enough space for declarative config") return kong.response.exit(413, { message = "Configuration does not fit in LMDB database, " .. diff --git a/kong/clustering/data_plane.lua b/kong/clustering/data_plane.lua index 32a191ad04b3..8e3a1988a510 100644 --- a/kong/clustering/data_plane.lua +++ b/kong/clustering/data_plane.lua @@ -186,10 +186,6 @@ local function send_ping(c, log_suffix) local hash = declarative.get_current_hash() - if hash == "true" then - hash = string.rep("0", 32) - end - local _, err = c:send_ping(hash) if err then ngx_log(is_timeout(err) and ngx_NOTICE or ngx_WARN, _log_prefix, diff --git a/kong/db/declarative/init.lua b/kong/db/declarative/init.lua index 69cf6ff27911..60382e0b4bb5 100644 --- a/kong/db/declarative/init.lua +++ b/kong/db/declarative/init.lua @@ -816,7 +816,7 @@ function declarative.load_into_cache(entities, meta, hash) t:set("tags||@list", tags) - hash = hash or "true" + hash = hash or string.rep("0", 32) t:set(DECLARATIVE_HASH_KEY, hash) kong.default_workspace = default_workspace @@ -846,6 +846,9 @@ do return nil, "failed to broadcast reconfigure event: " .. (err or ok) end + elseif err:find("MDB_MAP_FULL", nil, true) then + return nil, "map full" + else return nil, err end