Comments (3)
Also wanted to note that if i add run the commands from top of that example:
SELECT 15
ZADD zset 1 a
ZADD zset 2 b
ZADD zset 3 c
I can run the script 3 times without error, the 4th time when zset is empty the error occurs
from predis.
One more note to add, If you switch the client profile from dev to 2.0 in the example, the error is also 'DISCARD without MULTI'. I have a feeling the fix for the bug above will also fix this one, but basically the error that should have been output is 'The current profile does not support WATCH and UNWATCH commands'
from predis.
Thanks for the detailed report, this is a nasty bug introduced with commit cdfd0b9 while I was trying to fix other weird issues with Predis\MultiExecContext in a couple of corner cases (it slipped through simply because this particular case doesn't seem to be covered by the test suite).
A quick explanation of the cause: DISCARD is automatically used by Predis in order to reset a transaction if client-side errors occur during a MULTI/EXEC, but this is wrong if the exception occur before MULTI when using check-and-set operations since DISCARD will not work and the server will return a DISCARD without MULTI error. Also, Predis tries to avoid sending MULTI if there are no pending commands (empty transaction), but when using check-and-set we still need to reset pending WATCH__ed keys, but again it was using __DISCARD to do that.
I implemented a fix (see commit 85c1a7a) that uses UNWATCH instead of DISCARD for the two cases mentioned above. For empty transactions it is probably better to just fire an EXEC, this will reduce useless complexity. This is a clear evidence of the fact that Predis\MultiExecContext definitely needs some heavy refactoring before releasing Predis 0.7.0 as stable.
Thanks again for the bug report!
from predis.
Related Issues (20)
- RESP3: Protocol parser: RESP3 parser entity: Map type parser
- RESP3: Protocol parser: RESP3 parser entity: Set type parser
- RESP3: Protocol parser: RESP3 parser entity: Attribute type parser
- RESP3: Protocol parser: RESP3 parser entity: Push type parser
- RESP3: Protocol parser: RESP3 parser entity: Hello type parser
- RESP3: Protocol parser: RESP3 parser entity: Big number type parser
- Prefix is not used on the key with GeoSearch
- Add support for JSON.MSET
- Add support for JSON.MERGE
- Improve Relay integration HOT 8
- RESP3: Protocol parser: RESP2 and RESP3 reader integration tests
- RESP3: Commands integration tests
- RESP3: Setup clients to handle RESP3 responses
- Cannot use 'DEL' with redis-cluster. HOT 1
- RESP3: Sharded PubSub
- Key prefix is not used for GETDEL command
- RESP3: Push notifications
- count(): Argument #1 ($value) must be of type Countable|array, int given in HGETALL HOT 9
- Question
- Subscribe to a publoop with relay crashes HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from predis.