shreemaan-abhishek opened a new pull request, #13579:
URL: https://github.com/apache/apisix/pull/13579
### Description
The `limit-count` redis-cluster path executes the rate-limit script via
`evalsha` with a fallback to `eval` when the server returns `NOSCRIPT` (added
in #13363).
However, the bundled `resty-redis-cluster = 1.05-1` treats **any** command
error other than `MOVED`/`ASK`/`CLUSTERDOWN` (including `NOSCRIPT`) as a
possible node failure and triggers a full cluster slot refresh:
```lua
elseif string.sub(err, 1, 11) == "CLUSTERDOWN" then
return nil, "Cannot executing command, cluster status is failed!"
else
--There might be node fail, we should also refresh slot cache
self:refresh_slots() -- NOSCRIPT lands here
return nil, err
end
```
So in cluster mode every `NOSCRIPT` (first call on a fresh node, after
`SCRIPT FLUSH`, or after failover to a replica that does not yet have the
script cached) forces an unnecessary `refresh_slots()` over the whole cluster
before the `eval` fallback runs. The request still succeeds, but each cache
miss pays for a needless cluster-wide topology refresh.
`lua-resty-redis-cluster = 1.3.3-0` handles `NOSCRIPT` explicitly and
returns the error without refreshing slots, which matches the plugin's
`evalsha` fallback:
```lua
elseif string.sub(err, 1, 8) == "NOSCRIPT" then
return nil, err
```
This PR upgrades the dependency accordingly and adds a cluster test that
flushes the script cache and verifies the request still succeeds through the
`eval` fallback.
Note: APISIX already depends on the API7-maintained
`api7-lua-resty-redis-connector`, so adopting the maintained
`lua-resty-redis-cluster` fork (published on luarocks.org) is consistent with
existing dependencies.
### 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
- [ ] I have updated the documentation to reflect this change
- [x] 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]