-
Notifications
You must be signed in to change notification settings - Fork 139
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
Fixes for scan/sscan/zscan/hscan & transaction/multi handling #181
Conversation
…to match phpredis mode when the iterator is passed in as 0 instead of null
@Xon Thanks for the PR. I'm not sure about it though since it would break code that uses chaining, or is it just never practical to use these methods with chaining? |
Using this particular methods in chaining mode is fairly difficult as you need to returned iterator token for the next call, but you could batch them with other methods I guess. I was planning on adding a PR after this to patch these methods so pipeline mode could push an early result into the command array so the methods are never sent to redis. This would fix the compatibility issues with pipelining |
ced0b48
to
5adc19e
Compare
…ings to match php-cs-fixer
…rnal state to become out of sync
…ansaction/pipeline mode, harden transaction tracking handling
So it looks like phpredis just doesn't allow scan in pipeline/multi mode, and a I'll add some test to catch these |
After a bit more testing, using the scan-related commands never worked in pipeline/multi mode with standalone credis mode. The iterator was never updated as expected |
… if they are called in multi/pipeline modes
…echnically returns false, but it is a no-op)
Forcing the connection closed and resetting pipelining/transaction state ended up being required to actually debug why unrelated tests where failing. redis/credis getting out of sync on the protocol level is yuck :( This ended up being a lot more involve but fixes #182 so the same behavior is observed between phpredis and standalone mode when in transaction/pipeline mode. In previous cases calling these functions in standalone mode would either error or be unusable. I've updated the PR with a description of the various bugs fixed. Most of them are actually relatively obscure that wouldn't be hit in normal usage. Basically |
Nice work @Xon! |
scan
/sscan
/zscan
/hscan
scan
/sscan
/zscan
/hscan
with phpredis of how an empty/falsy iterator is handled.exec()
could cause the redis connection and credis internal state to become out of syncscan
/sscan
/zscan
/hscan
from being used inpipeline
/multi
mode, as phpredis would cause trigger a fatal php error instead of throwing an exception in this casemget([])
in standalone mode didn't match phpredis modemulti
mode failing when commands where issued betweenmulti()
andpipeline()
. Recommended usage is howeverpipeline()-> multi()->...->exec()
This breaks pipeline mode for these functions as they return early, but mget was already doing this. Documented in #182