infinispan/infinispan — pull request #1585 by anistor (2013-01-18 10:02:41+00:00)
Title: ISPN-2405 Pessimistic transactions can leak locks when cluster topology ...

...changes

* Methods TxDistributionInterceptor.visitPreparecommand, TxDistributionIntereceptor.getCommitNodes and AbstractEnlistmentAdapter.removeTransactionInfoRemotely need to compute the set of affected nodes taking TX.getLockedKeys() into consideration (not just TX.getAffectedKeys()). This ensures that a key that was locked but not modified will not be ignored and left locked when TX ends.

* BaseRpcInterceptor.shouldInvokeRemoteTxCommand() will return true if the TX was started in an older topology than current, regardless if modifications or remote locks are present. This ensures the TX command reaches all affected (or locked) key owners not just the ones registered in TX.getRemoteLocksAcquired() (even if this is not the optimal set of nodes).

* Add unit test for the pessimistic locking case.

* Minor cleanup in the existing UT for optimistic locking.

JIRA: https://issues.jboss.org/browse/ISPN-2405