We dont need to have large segments for operational shards.
Add in multi journal configuration that gets used when shard has
persistence turned off.
JIRA: CONTROLLER-1938
Change-Id: I39349503079ef03177c8b9b52909078c5f35d6ba
Signed-off-by: Tomas Cere <tomas.cere@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
journal {
# The following activates the default segmented file journal. Each persistent actor
# is stored in a separate directory, with multiple segment files. Segments are removed
- # when they are not longer required.
+ # when they are no longer required.
#
plugin = akka.persistence.journal.segmented-file
}
}
+ # Journal configuration for shards that have persistence turned off. They still need to have a journal plugin
+ # configured, since they still need to store things in the journal occasionally, but having larger segment sizes
+ # would be wastefull.
+ non-persistent {
+ journal {
+ class = "org.opendaylight.controller.akka.segjournal.SegmentedFileJournal"
+ # Root directory for segmented journal storage
+ root-directory = "segmented-journal"
+ # Maximum size of a single entry in the segmented journal
+ max-entry-size = 512K
+ # Maximum size of a segment
+ max-segment-size = 1M
+ # Map each segment into memory. Note that while this can improve performance,
+ # it will also place additional burden on system resources.
+ memory-mapped = false
+ }
+ }
+
snapshot-store.local.class = "org.opendaylight.controller.cluster.persistence.LocalSnapshotStore"
snapshot-store.plugin = akka.persistence.snapshot-store.local
}
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;
private static final Collection<ABIVersion> 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);
}
protected void onDatastoreContext(final DatastoreContext context) {
- datastoreContext = context;
+ datastoreContext = verifyNotNull(context);
setTransactionCommitTimeout();
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;
akka {
persistence.snapshot-store.plugin = "in-memory-snapshot-store"
persistence.journal.plugin = "in-memory-journal"
+ persistence.non-persistent.journal {
+ class = "org.opendaylight.controller.cluster.raft.utils.InMemoryJournal"
+ }
loggers = ["akka.testkit.TestEventListener", "akka.event.slf4j.Slf4jLogger"]
persistence.snapshot-store.plugin = "in-memory-snapshot-store"
persistence.journal.plugin = "in-memory-journal"
+ persistence.non-persistent.journal {
+ class = "org.opendaylight.controller.cluster.raft.utils.InMemoryJournal"
+ }
loglevel = "INFO"
actor {
persistence.snapshot-store.plugin = "in-memory-snapshot-store"
persistence.journal.plugin = "in-memory-journal"
+ persistence.non-persistent.journal {
+ class = "org.opendaylight.controller.cluster.raft.utils.InMemoryJournal"
+ }
+
loglevel = "INFO"
actor {
persistence.snapshot-store.plugin = "in-memory-snapshot-store"
persistence.journal.plugin = "in-memory-journal"
+ persistence.non-persistent.journal {
+ class = "org.opendaylight.controller.cluster.raft.utils.InMemoryJournal"
+ }
+
actor {
provider = "akka.cluster.ClusterActorRefProvider"
persistence.snapshot-store.plugin = "in-memory-snapshot-store"
persistence.journal.plugin = "in-memory-journal"
+ persistence.non-persistent.journal {
+ class = "org.opendaylight.controller.cluster.raft.utils.InMemoryJournal"
+ }
+
loglevel = "INFO"
actor {
persistence.snapshot-store.plugin = "in-memory-snapshot-store"
persistence.journal.plugin = "in-memory-journal"
+ persistence.non-persistent.journal {
+ class = "org.opendaylight.controller.cluster.raft.utils.InMemoryJournal"
+ }
+
loglevel = "INFO"
actor {
persistence.snapshot-store.plugin = "in-memory-snapshot-store"
persistence.journal.plugin = "in-memory-journal"
+ persistence.non-persistent.journal {
+ class = "org.opendaylight.controller.cluster.raft.utils.InMemoryJournal"
+ }
+
loglevel = "INFO"
actor {
persistence.snapshot-store.plugin = "in-memory-snapshot-store"
persistence.journal.plugin = "in-memory-journal"
+ persistence.non-persistent.journal {
+ class = "org.opendaylight.controller.cluster.raft.utils.InMemoryJournal"
+ }
+
loglevel = "INFO"
actor {
}
}
}
+ persistence.non-persistent.journal {
+ class = "org.opendaylight.controller.cluster.raft.utils.InMemoryJournal"
+ }
loglevel = "INFO"