Skip to content

fix: resync etcd when a lower revision is found#12015

Merged
guoqqqi merged 6 commits into
apache:masterfrom
Revolyssup:revolyssup/resync-etcd
Mar 5, 2025
Merged

fix: resync etcd when a lower revision is found#12015
guoqqqi merged 6 commits into
apache:masterfrom
Revolyssup:revolyssup/resync-etcd

Conversation

@Revolyssup

@Revolyssup Revolyssup commented Mar 3, 2025

Copy link
Copy Markdown
Contributor

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 first)

@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. bug Something isn't working labels Mar 3, 2025
Comment thread apisix/core/config_etcd.lua Outdated
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Mar 3, 2025
Comment thread apisix/core/config_etcd.lua Outdated
cancel_watch(http_cli)
break
end
watch_ctx.rev = rev + 1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what will happen when rev == watch_ctx.rev ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated the code.

  1. Smaller revision -> Cause resync
  2. Equal revision -> Do nothing like previous
  3. Bigger revision -> Increment watch_ctx.rev

@guoqqqi
guoqqqi requested a review from membphis March 5, 2025 05:44
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Mar 5, 2025
@guoqqqi
guoqqqi merged commit 47008af into apache:master Mar 5, 2025
laz-xyr pushed a commit to laz-xyr/apisix that referenced this pull request Jun 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants