fix(limit-count): upgrade redis-cluster lib so NOSCRIPT is not treated as node failure#13579
Conversation
…d as node failure The limit-count redis-cluster path runs evalsha with a NOSCRIPT fallback to eval (apache#13363). The bundled resty-redis-cluster 1.05 treats any error other than MOVED/ASK/CLUSTERDOWN, including NOSCRIPT, as a node failure and triggers a full cluster slot refresh. So every NOSCRIPT (fresh node, SCRIPT FLUSH, or failover to a replica missing the script) forces an unnecessary refresh_slots() before the eval fallback runs. lua-resty-redis-cluster 1.3.3 handles NOSCRIPT explicitly and returns the error without refreshing slots, matching the plugin's evalsha fallback. Add a cluster test that flushes the script cache and asserts the request still succeeds via the eval fallback.
There was a problem hiding this comment.
Pull request overview
This PR upgrades the Redis Cluster Lua client dependency used by APISIX so that NOSCRIPT errors from EVALSHA are no longer treated as node failures (avoiding unnecessary cluster slot refreshes), and adds a regression test to ensure the limit-count Redis Cluster path correctly falls back to EVAL after script cache flush.
Changes:
- Upgrade LuaRocks dependency from
resty-redis-clustertolua-resty-redis-cluster(v1.3.3-0) to avoid slot refresh onNOSCRIPT. - Add a Redis Cluster test that flushes scripts across the cluster and asserts the
EVALSHA→EVALfallback path succeeds.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
apisix-master-0.rockspec |
Updates the Redis Cluster client dependency to a version that handles NOSCRIPT without forcing a slot refresh. |
t/plugin/limit-count-redis-cluster.t |
Adds coverage for NOSCRIPT fallback behavior in Redis Cluster by flushing script caches and validating a successful request + expected log. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Blocking concern: this dependency upgrade appears to change Redis Cluster timeout/retry behavior implicitly, beyond the intended The
This can make Could we either preserve the previous APISIX behavior in the wrapper, for example by explicitly setting the old retry defaults and ensuring |
Description
The
limit-countredis-cluster path executes the rate-limit script viaevalshawith a fallback toevalwhen the server returnsNOSCRIPT(added in #13363).However, the bundled
resty-redis-cluster = 1.05-1treats any command error other thanMOVED/ASK/CLUSTERDOWN(includingNOSCRIPT) as a possible node failure and triggers a full cluster slot refresh:So in cluster mode every
NOSCRIPT(first call on a fresh node, afterSCRIPT FLUSH, or after failover to a replica that does not yet have the script cached) forces an unnecessaryrefresh_slots()over the whole cluster before theevalfallback runs. The request still succeeds, but each cache miss pays for a needless cluster-wide topology refresh.lua-resty-redis-cluster = 1.3.3-0handlesNOSCRIPTexplicitly and returns the error without refreshing slots, which matches the plugin'sevalshafallback:This PR upgrades the dependency accordingly and adds a cluster test that flushes the script cache and verifies the request still succeeds through the
evalfallback.Note: APISIX already depends on the API7-maintained
api7-lua-resty-redis-connector, so adopting the maintainedlua-resty-redis-clusterfork (published on luarocks.org) is consistent with existing dependencies.Checklist