+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.cluster.datastore;
-
-import java.io.Serializable;
-import java.util.Set;
-
-/**
- * Manages shards.
- *
- * @deprecated This is a deprecated placeholder to keep its inner class present. It serves no other purpose.
- */
-@Deprecated
-public final class ShardManager {
- /**
- * We no longer persist SchemaContextModules but keep this class around for now for backwards
- * compatibility so we don't get de-serialization failures on upgrade from Helium.
- */
- @Deprecated
- public static class SchemaContextModules implements Serializable {
- private static final long serialVersionUID = -8884620101025936590L;
-
- private final Set<String> modules;
-
- public SchemaContextModules(Set<String> modules) {
- this.modules = modules;
- }
-
- public Set<String> getModules() {
- return modules;
- }
- }
-
- private ShardManager() {
- throw new UnsupportedOperationException("deprecated outer class");
- }
-}
import akka.dispatch.OnComplete;
import akka.japi.Function;
import akka.pattern.Patterns;
+import akka.persistence.DeleteSnapshotsFailure;
+import akka.persistence.DeleteSnapshotsSuccess;
import akka.persistence.RecoveryCompleted;
import akka.persistence.SaveSnapshotFailure;
import akka.persistence.SaveSnapshotSuccess;
import org.opendaylight.controller.cluster.datastore.utils.Dispatchers;
import org.opendaylight.controller.cluster.datastore.utils.PrimaryShardInfoFutureCache;
import org.opendaylight.controller.cluster.notifications.RegisterRoleChangeListener;
+import org.opendaylight.controller.cluster.notifications.RegisterRoleChangeListenerReply;
import org.opendaylight.controller.cluster.notifications.RoleChangeNotification;
import org.opendaylight.controller.cluster.raft.base.messages.FollowerInitialSyncUpStatus;
import org.opendaylight.controller.cluster.raft.base.messages.SwitchBehavior;
onGetLocalShardIds();
} else if (message instanceof RunnableMessage) {
((RunnableMessage)message).run();
+ } else if (message instanceof DeleteSnapshotsFailure) {
+ LOG.warn("{}: Failed to delete prior snapshots", persistenceId(),
+ ((DeleteSnapshotsFailure) message).cause());
+ } else if (message instanceof DeleteSnapshotsSuccess) {
+ LOG.debug("{}: Successfully deleted prior snapshots", persistenceId(), message);
+ } else if (message instanceof RegisterRoleChangeListenerReply) {
+ LOG.trace("{}: Received RegisterRoleChangeListenerReply", persistenceId());
+ } else if (message instanceof ClusterEvent.MemberEvent) {
+ LOG.trace("{}: Received other ClusterEvent.MemberEvent: {}", persistenceId(), message);
} else {
unknownMessage(message);
}
private void onRecoveryCompleted() {
LOG.info("Recovery complete : {}", persistenceId());
- // We no longer persist SchemaContext modules so delete all the prior messages from the akka
- // journal on upgrade from Helium.
- deleteMessages(lastSequenceNr());
-
if (currentSnapshot == null && restoreFromSnapshot != null
&& restoreFromSnapshot.getShardManagerSnapshot() != null) {
ShardManagerSnapshot snapshot = restoreFromSnapshot.getShardManagerSnapshot();
import com.google.common.base.Function;
import com.google.common.base.Stopwatch;
import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.google.common.util.concurrent.Uninterruptibles;
import org.opendaylight.controller.cluster.datastore.DatastoreContextFactory;
import org.opendaylight.controller.cluster.datastore.DistributedDataStore;
import org.opendaylight.controller.cluster.datastore.Shard;
-import org.opendaylight.controller.cluster.datastore.ShardManager.SchemaContextModules;
import org.opendaylight.controller.cluster.datastore.config.ConfigurationImpl;
import org.opendaylight.controller.cluster.datastore.config.EmptyModuleShardConfigProvider;
import org.opendaylight.controller.cluster.datastore.config.ModuleShardConfiguration;
import org.opendaylight.controller.cluster.raft.messages.ServerChangeStatus;
import org.opendaylight.controller.cluster.raft.messages.ServerRemoved;
import org.opendaylight.controller.cluster.raft.policy.DisableElectionsRaftPolicy;
-import org.opendaylight.controller.cluster.raft.utils.InMemoryJournal;
import org.opendaylight.controller.cluster.raft.utils.InMemorySnapshotStore;
import org.opendaylight.controller.cluster.raft.utils.MessageCollectorActor;
import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
LOG.info("testOnReceiveFindLocalShardWaitForShardInitialized starting");
}
- @Test
- public void testOnRecoveryJournalIsCleaned() {
- String persistenceID = "shard-manager-" + shardMrgIDSuffix;
- InMemoryJournal.addEntry(persistenceID, 1L, new SchemaContextModules(ImmutableSet.of("foo")));
- InMemoryJournal.addEntry(persistenceID, 2L, new SchemaContextModules(ImmutableSet.of("bar")));
- InMemoryJournal.addDeleteMessagesCompleteLatch(persistenceID);
-
- newTestShardManager();
-
- InMemoryJournal.waitForDeleteMessagesComplete(persistenceID);
-
- // Journal entries up to the last one should've been deleted
- Map<Long, Object> journal = InMemoryJournal.get(persistenceID);
- synchronized (journal) {
- assertEquals("Journal size", 0, journal.size());
- }
- }
-
@Test
public void testRoleChangeNotificationAndShardLeaderStateChangedReleaseReady() throws Exception {
TestShardManager shardManager = newTestShardManager();