Re: [PR] fix: resync etcd when a lower revision is found [apisix]
guoqqqi merged PR #12015: URL: https://github.com/apache/apisix/pull/12015 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] fix: resync etcd when a lower revision is found [apisix]
Revolyssup commented on code in PR #12015: URL: https://github.com/apache/apisix/pull/12015#discussion_r1980752912 ## apisix/core/config_etcd.lua: ## @@ -262,9 +262,15 @@ local function do_run_watch(premature) cancel_watch(http_cli) break end -if rev > watch_ctx.rev then -watch_ctx.rev = rev + 1 + +if rev < watch_ctx.rev then +log.error("received smaller revision, rev=", rev, ", watch_ctx.rev=", + watch_ctx.rev,". etcd may be restarted. resyncing") +produce_res(nil, "restarted") +cancel_watch(http_cli) +break end +watch_ctx.rev = rev + 1 Review Comment: updated the code. 1. Smaller revision -> Cause resync 2. Equal revision -> Do nothing like previous 3. Bigger revision -> Increment watch_ctx.rev -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] fix: resync etcd when a lower revision is found [apisix]
nic-chen commented on code in PR #12015: URL: https://github.com/apache/apisix/pull/12015#discussion_r1980511205 ## apisix/core/config_etcd.lua: ## @@ -262,9 +262,15 @@ local function do_run_watch(premature) cancel_watch(http_cli) break end -if rev > watch_ctx.rev then -watch_ctx.rev = rev + 1 + +if rev < watch_ctx.rev then +log.error("received smaller revision, rev=", rev, ", watch_ctx.rev=", + watch_ctx.rev,". etcd may be restarted. resyncing") +produce_res(nil, "restarted") +cancel_watch(http_cli) +break end +watch_ctx.rev = rev + 1 Review Comment: what will happen when `rev == watch_ctx.rev` ? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] fix: resync etcd when a lower revision is found [apisix]
membphis commented on code in PR #12015: URL: https://github.com/apache/apisix/pull/12015#discussion_r1977276165 ## apisix/core/config_etcd.lua: ## @@ -262,9 +262,13 @@ local function do_run_watch(premature) cancel_watch(http_cli) break end -if rev > watch_ctx.rev then -watch_ctx.rev = rev + 1 +if rev < watch_ctx.rev then +log.warn("received smaller revision, rev=", rev, ", watch_ctx.rev=", watch_ctx.rev,". etcd may be restarted. resyncing") Review Comment: we should use a error log level -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[PR] fix: resync etcd when a lower revision is found [apisix]
Revolyssup opened a new pull request, #12015: URL: https://github.com/apache/apisix/pull/12015 ### Description Fixes # (issue) When using ingress controller in etcd mode, if the ingress restarts the revision in etcd will start over since its stateless. APISIX on receiving updates ignores the lower revision. This PR makes sure that a full resync is triggered when lower revision is found. ### Checklist - [ ] I have explained the need for this PR and the problem it solves - [ ] I have explained the changes or the new features added to this PR - [ ] I have added tests corresponding to this change - [ ] I have updated the documentation to reflect this change - [ ] I have verified that this change is backward compatible (If not, please discuss on the [APISIX mailing list](https://github.com/apache/apisix/tree/master#community) first) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org