-
Notifications
You must be signed in to change notification settings - Fork 325
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
Create cluster connection correctly for one host #416
Conversation
Seems simple enough, since I don't have clusters to test on hoping we can get confirmation of the fix from people that experienced issues here! |
@linasm83 do you understand the issues reported at #402 (comment)? |
@curry684 I think it should only work with Looking at predis client class it looks it only supports cluster or replication, but not both at the same time. So not sure there's proper solution on that case, maybe only some additional config validation not allow to pass only one dsn if |
Makes sense that you cannot use both at the same time, would cause awful race conditions I suppose. In that case yes we should fail early during compilation. @ebarault what's your take on this? |
The purpose of backend-side-managed clustering is to get rid of any extra configuration at client side. This config should fail with an error early and with the appropriate error message. |
Hi, I have tested this modification on my local machine and on AWS but I'm getting the next error : [Symfony\Component\Debug\Exception\ContextErrorException] Exception trace: My configuration : snc_redis: session: |
this is with predis version 1.1.1 (latest released) |
@ignaciorivmen try to remove
maybe we should really ignore |
bingo: we tried without the replication param and now the app compiles the app seems to behave normally, but we get these errors in symfony logs:
in other words, the storage of sessions in redis seems to fail EDIT: after checking in the redis cluster: the key Is is possible that this error is in fact just a warning before the client redirects to the right endpoint? |
EDIT: Might be unexpected behavior of connection wrapper class in such case. |
Meh the wrappers are causing a lot of issues considering they were written ages before PHP started supporting type safety in function arguments. |
I'm not sure which additional test could be ran to bring more food for thoughts. |
Sounds like a good idea if that causes the fix to be universally applicable, could you add that? |
@curry684 Added. |
Thanks! |
* Create cluster connection correctly * Unset replication option if cluster option is defined for predis client (cherry picked from commit 5d8169e)
@curry684 : hi, could you tag a new release and propagate this fix to composer ? |
Yes, been running 2.1.x for a few days myself now in current project and it seems all stable. |
thanks 👍 |
Fixes #402, #267 (might also fix some other clustering issues when only one dsn is defined)
If only one dsn is defined when cluster option is passed connection instance class is incorrect (should be Predis\Connection\Aggregate\RedisCluster.
The problem is that we're passing Predis\Connection\ParametersInterface as first argument to client, but we should pass array instead cause only then Predis\Client::createConnection method will create correct connection class.