When Redis rejected a command while queueing it (OOM, READONLY, NOPERM, MISCONF, wrong arity), MultiExec threw AbortedMultiExecException without sending DISCARD.
A transaction block discards on the way out, the fluent interface didn't, so the connection stayed in MULTI and every later command on the client returned QUEUED without running.
The fluent interface now discards the transaction, or closes the connection if DISCARD fails too.
Until discard() is called, the aborted MultiExec refuses new commands and execute(), so a caller that catches the exception can't commit only the commands queued after the failed one.
Cluster connections skip the abort path: their errors before execute()
come from the client and nothing is queued on a node yet. watch() refuses
to run on an aborted transaction and unwatch() sends nothing, so only
discard() makes it usable again. Every discard on the way out closes the
connection when DISCARD fails.
- Make use of more typehints for function parameters
- Make use of typehints for function return values
- Use @var where needed to give proper hints to IDEs and avoid warnings
- Replace MockObject::setMethods() with addMethods() and onlyMethods()
- Rewording of some phpdocs
We now have a base test case class for Predis (namely PredisTestCase)
grouping various commonly used utility methods shared by all of the
tests in the suite, greatly improving reusability.
The Predis\Transaction\MultiExecState class is actually quite dummy as
it does not work as a finite-state machine, but is used to track state
using flags. It basically replicates the same behaviour of when it was
part of the Predis\Transaction\MultiExec code and it will do for now.