-
Notifications
You must be signed in to change notification settings - Fork 145
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
Adding support for RedisCluster (phpredis extension) #191
base: master
Are you sure you want to change the base?
Adding support for RedisCluster (phpredis extension) #191
Conversation
Thanks for the PR! I think this should probably just replace |
@JacobBrownAustin thank you for this! Magento has been missing support for redis 6 for 4 years. |
Those all sound great. I'll update this soon. |
@colinmollenhour , the Credis_Sentinel also uses Credis_Cluster. What should be done about that? https://github.com/colinmollenhour/credis/blob/master/Sentinel.php#L312 |
@colinmollenhour , because the new class is basically just an adapter to the php redis extension, there's not much logic to test in the class itself as a unit test, so I'll add a Redis cluster to the docker compose to test it more of an integration test. |
Both of those methods are marked as deprecated so they can be removed. The new version will get a major version bump already. |
Sounds good, thanks! |
@JacobBrownAustin any movement on this? |
@infowolfe |
* Credis_Cluster class now replaced with new class that uses RedisCluster. * Updated tests * Lots of tests skipped because of broken/missing features or incompatible behaviour because of Redis clusters or RedisCluster * Adding PHP 8.3 test container to run the phpunit tests
@colinmollenhour @infowolfe It now replaces the previously @deprecated Credis_Cluster class. I'm running the same tests as CredisTest, but I've had to skip 25 of them due to incompatibilities, known issues, and some bugs I've found with RedisCluster. A lot of them are due to the fact that some of the methods require an additional parameter to specify which node in the cluster to run on like flushDb and save. We could write adapters for this methods to get the most recent cluster information and then run the same command on all nodes of the cluster, like flushDb for example; but this is beyond the scope of my project as I'm not currently needing any of these methods. I've updated the documentation for this new class. And yeah, I added an Exception thrown in the constructor if the RedisCluster class from the 'redis' extension is missing. |
We can drop PHP 5.4, I think 7.4 should be the lowest to support. I'll try to take a closer look soon. @infowolfe if you have a chance to do some code review and test that would help a lot as well! |
@colinmollenhour What's the status on accepting this pull request? |
I fixed merge conflicts and merged the latest to fix code style checks. However, there are a lot of broken tests. If you can get them working we should be good to go. |
Hi @colinmollenhour , I need your opinion on something. What do you think? |
Also, I've been working on the tests so that the class now spawns the servers and assembles the cluster by itself without needing Docker Compose. (I didn't realize that your tests in Git Hub CI weren't using the same docker compose for running tests locally.) In addition, I found some behaviour which was wrong some I'm making some corrections in a few places. |
@JacobBrownAustin Your proposal sounds like great solution! |
… cluster itself some other small fixes too
Okay. I'll make those changes soon. Also, there's a few tests that I skipped which I saw recently that can be modified for cluster to run. (Some of the queries being tested can run if forced onto the same cluster.) |
FYI, I believe the tests should pass now in GitHub, but I don't know how to trigger it and I'm guessing I just don't have access to trigger it. |
I changed the settings, so you should be able to run the workflow now without approval. |
flushDb, flushAll, & ping get called on all masters now in Credis_Cluster
Wahoo, finally got them all the pass, and not just 5/6ths. |
Killing it! Thanks for your work on this. Will wait for final review until you report you are done. |
and also switched away from append-only mode for the database
3ac5657
to
700027a
Compare
* | ||
* @deprecated | ||
* Note: RedisCluster currently has limitations like not supporting pipeline or multi. | ||
* Note: Many methods require an additional parameter to specify which node to run on, and only run on that node, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to update the comments here after the changes that I've made in last couple of days.
echo $cluster->get('key').PHP_EOL; | ||
``` | ||
* RedisCluster currently has limitations like not supporting pipeline or multi. This may be added in the future. See [here](https://github.com/phpredis/phpredis/blob/develop/cluster.md) for details. | ||
* Many methods require an additional parameter to specify which node to run on, and only run on that node, such as save(), flushDB(), ping(), and scan(). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to update this after changes from last couple of days.
related pull request:
colinmollenhour/php-redis-session-abstract#62