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%2FTransactionProxy.java;h=ffb1ab7c55064ecf7683e1857800b256c9c82a1d;hb=f5a373c5378af41f62a2c36ced4046fbdb77e00b;hp=239207a60ab58cbbbefc03ee150b9cc250230d86;hpb=c7636ed2c99ab891dbecb719db53c1a4ce1b54b8;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionProxy.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionProxy.java index 239207a60a..ffb1ab7c55 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionProxy.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionProxy.java @@ -49,6 +49,8 @@ import org.slf4j.LoggerFactory; import scala.concurrent.Future; import scala.concurrent.Promise; import scala.concurrent.duration.FiniteDuration; + +import javax.annotation.concurrent.GuardedBy; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -56,7 +58,6 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; -import javax.annotation.concurrent.GuardedBy; /** * TransactionProxy acts as a proxy for one or more transactions that were created on a remote shard @@ -668,8 +669,8 @@ public class TransactionProxy implements DOMStoreReadWriteTransaction { // Check if TxActor is created in the same node boolean isTxActorLocal = actorContext.isLocalPath(transactionPath); - transactionContext = new TransactionContextImpl(transactionActor, identifier, - actorContext, schemaContext, isTxActorLocal); + transactionContext = new TransactionContextImpl(transactionPath, transactionActor, identifier, + actorContext, schemaContext, isTxActorLocal, reply.getVersion()); } } @@ -712,17 +713,21 @@ public class TransactionProxy implements DOMStoreReadWriteTransaction { private final ActorContext actorContext; private final SchemaContext schemaContext; + private final String transactionPath; private final ActorSelection actor; private final boolean isTxActorLocal; + private final int remoteTransactionVersion; - private TransactionContextImpl(ActorSelection actor, TransactionIdentifier identifier, + private TransactionContextImpl(String transactionPath, ActorSelection actor, TransactionIdentifier identifier, ActorContext actorContext, SchemaContext schemaContext, - boolean isTxActorLocal) { + boolean isTxActorLocal, int remoteTransactionVersion) { super(identifier); + this.transactionPath = transactionPath; this.actor = actor; this.actorContext = actorContext; this.schemaContext = schemaContext; this.isTxActorLocal = isTxActorLocal; + this.remoteTransactionVersion = remoteTransactionVersion; } private ActorSelection getActor() { @@ -783,7 +788,20 @@ public class TransactionProxy implements DOMStoreReadWriteTransaction { } else if(serializedReadyReply.getClass().equals(ReadyTransactionReply.SERIALIZABLE_CLASS)) { ReadyTransactionReply reply = ReadyTransactionReply.fromSerializable(serializedReadyReply); - return actorContext.actorSelection(reply.getCohortPath()); + String cohortPath = reply.getCohortPath(); + + // In Helium we used to return the local path of the actor which represented + // a remote ThreePhaseCommitCohort. The local path would then be converted to + // a remote path using this resolvePath method. To maintain compatibility with + // a Helium node we need to continue to do this conversion. + // At some point in the future when upgrades from Helium are not supported + // we could remove this code to resolvePath and just use the cohortPath as the + // resolved cohortPath + if(TransactionContextImpl.this.remoteTransactionVersion < CreateTransaction.HELIUM_1_VERSION) { + cohortPath = actorContext.resolvePath(transactionPath, cohortPath); + } + + return actorContext.actorSelection(cohortPath); } else { // Throwing an exception here will fail the Future.