Handle leader change on ForwardedReadyTransaction in Shard 71/31171/3
authorTom Pantelis <tpanteli@brocade.com>
Fri, 11 Dec 2015 00:41:00 +0000 (19:41 -0500)
committerTony Tkacik <ttkacik@cisco.com>
Tue, 15 Dec 2015 13:01:19 +0000 (13:01 +0000)
commit08528168cbcf67ce2b0a897e5ac22888b1da53dd
tree3439b099248f194e4f7438cd6f091289e97568e4
parent32681853a2d71d7a6bc891091e9820918b1541d2
Handle leader change on ForwardedReadyTransaction in Shard

When the ShardWriteTransaction actor sends the ForwardedReadyTransaction
to the Shard, if the local shard is no longer the leader it still tries
to commit the transaction. Replication fails and it ends up timing out
but a side effect is that it persista a new log entry which isn't good.

Therefore I added logic similar as was done with ReadyLocalTransaction
to forward to the leader. For ReadyLocalTransaction, a special
serializer was added to marshal it over the wire as a BatchedModifications
message. Rather then creating another serializer, I converted the
ForwardedReadyTransaction instance to a ReadyLocalTransaction instance.

Change-Id: Ia44e86606846f2af9599ad222b7dcae1bd0cf804
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.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/DistributedDataStoreRemotingIntegrationTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTestKit.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionFailureTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionTest.java