X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FShard.java;h=d476b332b30dd35a73e9fe648b718149653cd8fe;hp=e051953f9581bea48c197b7774118ae534c2969d;hb=a3459dc797e4e0722b945b80bc8ef3123762fc8d;hpb=bb248f15d352cdd69e53ff7756fcb2c62cdc3eac 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 e051953f95..d476b332b3 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 @@ -9,6 +9,7 @@ package org.opendaylight.controller.cluster.datastore; import static com.google.common.base.Preconditions.checkState; import static com.google.common.base.Verify.verify; +import static com.google.common.base.Verify.verifyNotNull; import static java.util.Objects.requireNonNull; import akka.actor.ActorRef; @@ -151,6 +152,9 @@ public class Shard extends RaftActor { private static final Collection SUPPORTED_ABIVERSIONS; + // Make sure to keep this in sync with the journal configuration in factory-akka.conf + public static final String NON_PERSISTENT_JOURNAL_ID = "akka.persistence.non-persistent.journal"; + static { final ABIVersion[] values = ABIVersion.values(); final ABIVersion[] real = Arrays.copyOfRange(values, 1, values.length - 1); @@ -253,7 +257,7 @@ public class Shard extends RaftActor { self(), getContext(), shardMBean, builder.getId().getShardName()); snapshotCohort = ShardSnapshotCohort.create(getContext(), builder.getId().getMemberName(), store, LOG, - this.name); + this.name, datastoreContext); messageRetrySupport = new ShardTransactionMessageRetrySupport(this); @@ -645,7 +649,7 @@ public class Shard extends RaftActor { } protected void onDatastoreContext(final DatastoreContext context) { - datastoreContext = context; + datastoreContext = verifyNotNull(context); setTransactionCommitTimeout(); @@ -1082,6 +1086,16 @@ public class Shard extends RaftActor { return this.name; } + @Override + public String journalPluginId() { + // This method may be invoked from super constructor (wonderful), hence we also need to handle the case of + // the field being uninitialized because our constructor is not finished. + if (datastoreContext != null && !datastoreContext.isPersistent()) { + return NON_PERSISTENT_JOURNAL_ID; + } + return super.journalPluginId(); + } + @VisibleForTesting ShardCommitCoordinator getCommitCoordinator() { return commitCoordinator;