Move Tx ready call from ShardWriteTransaction to Shard 70/31170/2
authorTom Pantelis <tpanteli@brocade.com>
Thu, 10 Dec 2015 23:31:21 +0000 (18:31 -0500)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 15 Dec 2015 13:00:32 +0000 (13:00 +0000)
commit32681853a2d71d7a6bc891091e9820918b1541d2
treec370b22b583c051ed8c60d97656c1f5d777d00ee
parent248f46ddb283452df60d0e084d5a03af82ed5ef5
Move Tx ready call from ShardWriteTransaction to Shard

On ready, the ShardWriteTransaction actor calls ready on the
ReadWriteShardDataTreeTransaction to obtain the ShardDataTreeCohort
and passes it with the ForwardedReadyTransaction message sent to
the Shard. Internally the ReadWriteShardDataTreeTransaction accesses
its parent, which is either the ShardDataTree or a ShardDataTreeTransactionChain,
to obtain the ShardDataTreeCohort. The parent holds unsynchronized
internal Shard state and is potentially unsafe to indirectly leak to the
transaction actor. This isn't an issue with the ShardDataTree b/c
finishTransaction doesn't access internal state but
ShardDataTreeTransactionChain does.

To be safe, we need to move the ready call to the Shard. Therefore, the
ReadWriteShardDataTreeTransaction instance is now passed with the
ForwardedReadyTransaction and the ShardCommitCoordinator now calls
ready.

Change-Id: I59295936944326b68506380519f8ade3b11164d9
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ReadWriteShardDataTreeTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardCommitCoordinator.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardWriteTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ForwardedReadyTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/AbstractShardTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/compat/PreLithiumShardTest.java