moonming opened a new pull request, #14226: URL: https://github.com/apache/apisix/pull/14226
### Description `limit-conn` currently includes a hash of the entire plugin configuration in its counter key. Runtime metadata mutations can split a shared PluginConfig's quota across workers, and changing a rejection response, threshold or Redis timeout starts a new counter while earlier requests are still in flight. This change separates counter identity from configuration versions. The key hashes only the subsystem, owning resource, workflow action, subject definition/value and duplicate-rule occurrence. It preserves resource/action isolation and keeps different rule expressions independent even when their values coincide. Reordering distinct expressions retains their counters; repeated expressions and workflow actions retain their documented occurrence/position boundaries. Sharing counters across updates also requires preserving older Redis leases. The admission script now only extends the whole key's expiry, so a shorter `key_ttl` cannot delete requests admitted with a longer lease. Both Redis schemas require a positive TTL. Requests continue releasing the key and backend captured at admission. #### Which issue(s) this PR fixes: Fixes #14207 ### Compatibility and migration **This changes the counter key format.** Old and new versions do not share counters. Upgrades and rollbacks must stop new admissions and drain the affected quota domain across all sharing nodes before switching versions and resuming traffic. This PR does not implement automatic mixed-version counter migration. Threshold updates preserve existing occupancy and do not terminate in-flight requests. Redis backend changes do not migrate reservations, and captured backend credentials must remain usable until old requests finish. TTLs do not renew automatically. The English and Chinese documentation describe these boundaries. The PR remains a draft for review of this compatibility change; the backward-compatibility checklist is intentionally unchecked. ### Validation Tested complete source based on official `master` at `9b4e4ca24993b70fa8541066e7e21ad6d2bfde1d`, with APISIX Runtime 1.4.2 and the rockspec's dependencies. Installed product files, runtime and dependency files were verified against the source/build manifests. - **Passed:** 48 assertions in the new identity regressions and Redis schema tests, using the real limiter and shared dictionary. - **Passed:** six real HTTP/etcd/Redis scenarios with two workers: opposite first-access order, hot updates, mixed TTLs, subject-definition changes, Redis database changes, and partial admission/release across duplicate rules. Assertions check actual upstream requests, Redis members, worker PIDs and response bodies. No mocked gateway, Redis or HTTP responses. - **Regression evidence:** the same CLI tests fail four target scenarios on unmodified master. Reverting only the TTL fix makes only the mixed-TTL scenario fail with an older lease being deleted early. - **Passed:** changed Lua files' luacheck and lj-releng, plus test numbering and forbidden-directive checks. - **Not fully green:** the extended 12-file HTTP/Stream/workflow/Redis Cluster suite had 5 failed error-log assertions out of 468 assertions. All five were `resty.events` HUP communication-closed errors, also reproduced with the unmodified master. The official CI setup lowers this particular dependency log from ERROR to WARN; this local run kept the runtime unchanged and did not relax assertions. Full-repository lint also reports 31 pre-existing findings in untouched discovery modules, confirmed against the baseline. The new CLI test is picked up by the existing `t/cli/test_*.sh` runner. With the normal test services running: ```sh FLUSH_ETCD=1 prove -Itest-nginx/lib -I./ t/plugin/limit-conn-identity.t t/utils/redis-schema.t bash t/cli/test_limit_conn_identity.sh ``` ### 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 (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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
