membphis opened a new pull request, #14244: URL: https://github.com/apache/apisix/pull/14244
### Description Updating a rate limiter currently changes its configuration hash and can reset active counters even when only the threshold or rejection response changed. This makes raising or lowering a limit discard existing usage. Prepare a runtime `bucket_id` after successful schema validation for directly configured `limit-count`, `limit-conn`, and `limit-req`. Each plugin declares a short JSONPath whitelist of fields that define its counting scope. A shared helper includes the active storage destination, canonicalizes seed-node order, and hashes stable JSON. The ID lives in the metatable of `conf._meta` and is never persisted. Request keys use `parent.resource_key:bucket_id:resolved_key`. Thresholds, response settings, Redis credentials, and connection tuning preserve consumption. Key/window/filter changes or a different storage destination select another counter. Delayed fixed-window quotas retain their source limit so new thresholds can be applied to cached snapshots; sliding windows refresh their previous-window contribution. Redis concurrency leases and request-rate debt retain sufficient expiry when configuration changes. The stream `limit-conn` entry point follows the same preparation. Workflow actions, AI/GraphQL callers, and existing `group` consistency requirements retain their current behavior. ### Compatibility This intentionally changes counter behavior across configuration updates. Upgrading also changes directly configured plugins' counter keys once: existing counters are not migrated, and mixed-version nodes can use separate counters during a rolling upgrade. The English and Chinese plugin documentation describe these limits. No public configuration fields or dependencies are added. ### Validation - Passed 47 relevant Test::Nginx files, including both new suites (64 assertions), local/Redis/Redis Cluster/Sentinel policies, delayed synchronization, sliding windows, consumer isolation, stream, and Workflow/AI/GraphQL compatibility. - Passed `luacheck -q apisix t/lib`, Lua style checks on all changed source files, test indexing, `git diff --check`, and documentation lint with the repository's pinned `[email protected]`. - Full `make lint` is blocked by pre-existing Unicode separator comments in unchanged Consul/Kubernetes/Nacos discovery files. ### Checklist - [x] I have explained the need for this PR and the problem it solves - [x] I have explained the changes or the new features added to this PR - [x] I have added tests corresponding to this change - [x] I have updated the documentation to reflect this change - [ ] I have verified that this change is backward compatible (counter-update and upgrade behavior changes are documented above) -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
