X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FShard.java;h=0b4abe98a10a9ecac5be58a036f0653bcece5e8c;hb=4379f102fa0c85abf58f60d81fec9c698582fb1a;hp=6da9fe947a0651e5d96981b87a274bde814f902a;hpb=103ceecd0195cca6c87fbd62a687d8addf128784;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java index 6da9fe947a..0b4abe98a1 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java @@ -278,9 +278,10 @@ public class Shard extends RaftActor { } @Override - protected LeaderStateChanged newLeaderStateChanged(String memberId, String leaderId) { + protected LeaderStateChanged newLeaderStateChanged(String memberId, String leaderId, short leaderPayloadVersion) { return new ShardLeaderStateChanged(memberId, leaderId, - isLeader() ? Optional.of(store.getDataTree()) : Optional.absent()); + isLeader() ? Optional.of(store.getDataTree()) : Optional.absent(), + leaderPayloadVersion); } private void onDatastoreContext(DatastoreContext context) { @@ -413,7 +414,7 @@ public class Shard extends RaftActor { } private void handleBatchedModifications(BatchedModifications batched) { - // This message is sent to prepare the modificationsa transaction directly on the Shard as an + // This message is sent to prepare the modifications transaction directly on the Shard as an // optimization to avoid the extra overhead of a separate ShardTransaction actor. On the last // BatchedModifications message, the caller sets the ready flag in the message indicating // modifications are complete. The reply contains the cohort actor path (this actor) for the caller @@ -452,14 +453,15 @@ public class Shard extends RaftActor { try { commitCoordinator.handleReadyLocalTransaction(message, getSender(), this); } catch (Exception e) { - LOG.error("{}: Error handling LocalModifications for Tx {}", persistenceId(), + LOG.error("{}: Error handling ReadyLocalTransaction for Tx {}", persistenceId(), message.getTransactionID(), e); getSender().tell(new akka.actor.Status.Failure(e), getSelf()); } } else { ActorSelection leader = getLeader(); if (leader != null) { - LOG.debug("{}: Forwarding LocalModifications to leader {}", persistenceId(), leader); + LOG.debug("{}: Forwarding ReadyLocalTransaction to leader {}", persistenceId(), leader); + message.setRemoteVersion(getCurrentBehavior().getLeaderPayloadVersion()); leader.forward(message, getContext()); } else { noLeaderError(message); @@ -588,7 +590,8 @@ public class Shard extends RaftActor { } @Override - protected RaftActorSnapshotCohort getRaftActorSnapshotCohort() { + @VisibleForTesting + public RaftActorSnapshotCohort getRaftActorSnapshotCohort() { return snapshotCohort; } @@ -600,6 +603,7 @@ public class Shard extends RaftActor { @Override protected void onRecoveryComplete() { + store.recoveryDone(); //notify shard manager getContext().parent().tell(new ActorInitialized(), getSelf());