-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: etcd compact err【do not merge me! only for discussion】 #11149
Changes from 6 commits
1860153
5cdc0d7
66e2f57
dd1e3d9
1bfbe6c
2e24219
c3bc26e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,6 @@ | |
--- Get configuration information. | ||
-- | ||
-- @module core.config_etcd | ||
|
||
local table = require("apisix.core.table") | ||
local config_local = require("apisix.core.config_local") | ||
local log = require("apisix.core.log") | ||
|
@@ -328,21 +327,43 @@ local function sync_data(self) | |
return true | ||
end | ||
|
||
::waitdir:: | ||
-- get latest uncompacted revision | ||
local res, err = self.etcd_cli:get('/nonexisting',{ | ||
count_only = true, | ||
range_end = "\0" | ||
}) | ||
if err then | ||
log.error("failed to get latest uncompacted revision: ", err) | ||
end | ||
local rev | ||
if res and res.body and res.body.header and res.body.header.revision then | ||
rev = tonumber(res.body.header.revision) | ||
end | ||
local dir_res, err = waitdir(self.etcd_cli, self.key, self.prev_index + 1, self.timeout) | ||
log.info("waitdir key: ", self.key, " prev_index: ", self.prev_index + 1) | ||
log.info("res: ", json.delay_encode(dir_res, true)) | ||
|
||
if not dir_res then | ||
if err == "timeout" then | ||
log.info("updating prev_index from "..self.prev_index.." to "..rev ) | ||
if rev then | ||
if rev == self.prev_index then | ||
goto fail | ||
end | ||
self.prev_index = rev | ||
end | ||
goto waitdir | ||
end | ||
if err == "compacted" then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please don't remove these codes, we should keep them. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. okay |
||
self.need_reload = true | ||
log.warn("waitdir [", self.key, "] err: ", err, | ||
", will read the configuration again via readdir") | ||
return false | ||
goto fail | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we don't need to change the workflow |
||
end | ||
|
||
::fail:: | ||
return false, err | ||
end | ||
|
||
log.info("waitdir success") | ||
local res = dir_res.body.node | ||
local err_msg = dir_res.body.message | ||
if err_msg then | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about the change?