mirror of
https://github.com/predis/predis.git
synced 2026-11-23 12:02:26 +00:00
8e34223fb9
* Do not follow -ASK on the first command of a cluster transaction A cluster transaction is held on the node the slots map associates with its slot, but its first command went through the cluster like any other one. While a slot was being migrated, an -ASK reply to WATCH (or to the first command in CAS mode) was followed to the node importing the slot, and only then was the connection pinned from the slots map, which -ASK does not update. WATCH was left on the importing node while MULTI, the queued commands and EXEC ran on the source node with nothing watched, so the transaction committed even though the watched key had changed. When the transaction failed after that WATCH, the cleanup was sent to the source node and the WATCH on the importing node was never released, so its dirty flag aborted a later, unrelated transaction sent over the pooled connection. The first command is now sent through RedisCluster::executeCommandOnSlotOwner(), which retries and follows -MOVED and -READONLY like executeCommand() but returns -ASK replies. The transaction then fails with a ServerException carrying the -ASK reply, as later CAS commands already did, without touching the importing node. Retrying once the migration has finished reaches the new owner. An -ASK reply to a queued command still aborts the transaction, as before. The README no longer claims that the first command is redirected like any other command, and describes how an -ASK reply fails a transaction. * Add the cluster ASK fix to the changelog