-
Notifications
You must be signed in to change notification settings - Fork 11.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PhpRedisConnector sends incorrect parameters to RedisCluster scan #53826
Comments
I've been able to confirm that adding the missing parameter works by running the following snippet locally and then on Vapor via tinkerwell:
Obviously it's not ideal to iterator over the |
@bentleyo Wouldn't it be possible to solve this by overriding |
@crynobone nice find! I wasn't aware of that class! Yep, it looks like that's the place it should be overridden. However, I'm not sure how you would approach scanning when there's multiple masters (as there would be multiple cursors etc.). I think the solution is to only support one. Perhaps we could add a parameter for specifying the node and if it's note set default to using the first master. I have a few different ideas about how it could be solved. I can look at putting in a PR for this. |
I not 100% familiar with Redis Cluster so PR are appreciated. We can get Vapor team to review it if needed. |
Thank you for reporting this issue! As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub. If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team. Thank you! |
…first master node (laravel#53826)
* Specify node when sending scan to RedisCluster. Default to using the first master node (#53826) * Update src/Illuminate/Redis/Connections/PhpRedisClusterConnection.php Co-authored-by: Mior Muhammad Zaki <[email protected]> * formatting --------- Co-authored-by: Taylor Otwell <[email protected]> Co-authored-by: Mior Muhammad Zaki <[email protected]>
Laravel Version
11.31.0
PHP Version
8.3.2
Database Driver & Version
Redis 7.1 (AWS OSS Redis Cache), phpredis 7.4
Description
When using redis clusters the
PhpRedisConnection
class fails to send the requiredkey_or_address
(node) parameter to thescan
method ofRedisCluster
. See: https://phpredis.github.io/phpredis/RedisCluster.html#method_scanThe code in
PhpRedisConnection
looks like this currently:This seems to result in the
scan
method endlessly scanning over the redis database with the default count of 10 and the wrong value for match.For large databases this is a very impractical count and causes performance issues.
I originally noticed this problem after seeing the
cache:prune-stale-tags
command consistently timeout with our production application.This is happening as that command calls
\Illuminate\Cache\RedisStore@currentTags
which internally finds tags by callingscan
.When using cache with Vapor it puts redis into cluster mode, so this has been causing some headaches for us.
This might be the cause of these issues:
Steps To Reproduce
You will see that scan returns at most 10 keys, even if there are more.
The text was updated successfully, but these errors were encountered: