fix(etcd): upgrade revision when watch request timeout#12514
Merged
Conversation
Signed-off-by: Nic <[email protected]>
nic-6443
force-pushed
the
nic/etcd-compact-err
branch
from
August 12, 2025 12:29
9804ffe to
0e78c8c
Compare
Signed-off-by: Nic <[email protected]>
Signed-off-by: Nic <[email protected]>
Signed-off-by: Nic <[email protected]>
nic-6443
commented
Aug 14, 2025
| --- log_level: debug | ||
| --- no_error_log | ||
| stream lua tcp socket set keepalive | ||
| stream lua tcp socket keepalive create connection pool for key "127.0.0.1:1995" |
Member
Author
There was a problem hiding this comment.
Because the current PR send a readdir request before the watch request, it causes the etcd client to trigger keepalive logs, making the old assertion fail.
Therefore, this assertion is modified to explicitly target keepalive log of xrpc upstream to avoid matching etcd client's keepalive logs.
nic-6443
commented
Aug 14, 2025
| goto watch_event | ||
| end | ||
|
|
||
| --[[ |
Member
Author
There was a problem hiding this comment.
found this bug by https://github.com/apache/apisix/blob/master/t/cli/test_etcd_sync_event_handle.sh, and need this fix to pass the CI of current PR.
nic-chen
previously approved these changes
Aug 14, 2025
membphis
previously approved these changes
Aug 18, 2025
Co-authored-by: YuanSheng Wang <[email protected]>
nic-chen
previously approved these changes
Aug 18, 2025
membphis
previously approved these changes
Aug 18, 2025
Signed-off-by: Nic <[email protected]>
membphis
approved these changes
Aug 18, 2025
nic-chen
approved these changes
Aug 18, 2025
Revolyssup
approved these changes
Aug 18, 2025
jizhuozhi
pushed a commit
to jizhuozhi/apisix
that referenced
this pull request
Oct 18, 2025
Signed-off-by: Nic <[email protected]> Co-authored-by: YuanSheng Wang <[email protected]>
shreemaan-abhishek
pushed a commit
to shreemaan-abhishek/apisix
that referenced
this pull request
Jan 2, 2026
…apache#1010) Signed-off-by: Nic <[email protected]> Co-authored-by: YuanSheng Wang <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When multiple APISIX clusters connect to the same etcd cluster, each APISIX cluster uses a different
etcd.prefixto distinguish configurations.In this case, it is possible that the configuration of Cluster A changes frequently while the configuration of Cluster B remains unchanged. Since etcd revision is globally shared, this will cause the etcd client of Cluster B to always use an old revision when requesting the
/watchAPI.When revisions continue updating for a certain period and trigger etcd's compact mechanism, it will result in a watch API error:
compact error, which in turn causes APISIX in Cluster B to need to resynchronize data fully. This operation consumes a lot of computational resources from both the gateway and etcd.In this PR, after a timeout occurs while watch request, we initiate the watch request again with the latest revision to avoid the above issue.
Which issue(s) this PR fixes:
Fixes #
Checklist
Fixes #12167