Search in sources :

Example 1 with MemberName

use of org.opendaylight.controller.cluster.access.concepts.MemberName in project controller by opendaylight.

the class ShardManager method memberExited.

private void memberExited(final ClusterEvent.MemberExited message) {
    MemberName memberName = memberToName(message.member());
    LOG.info("{}: Received MemberExited: memberName: {}, address: {}", persistenceId(), memberName, message.member().address());
    peerAddressResolver.removePeerAddress(memberName);
    for (ShardInformation info : localShards.values()) {
        info.peerDown(memberName, getShardIdentifier(memberName, info.getShardName()).toString(), getSelf());
    }
}
Also used : MemberName(org.opendaylight.controller.cluster.access.concepts.MemberName)

Example 2 with MemberName

use of org.opendaylight.controller.cluster.access.concepts.MemberName in project controller by opendaylight.

the class ShardManager method memberWeaklyUp.

private void memberWeaklyUp(final MemberWeaklyUp message) {
    MemberName memberName = memberToName(message.member());
    LOG.info("{}: Received MemberWeaklyUp: memberName: {}, address: {}", persistenceId(), memberName, message.member().address());
    memberUp(memberName, message.member().address());
}
Also used : MemberName(org.opendaylight.controller.cluster.access.concepts.MemberName)

Example 3 with MemberName

use of org.opendaylight.controller.cluster.access.concepts.MemberName in project controller by opendaylight.

the class ShardedDataTreeActor method memberUp.

private void memberUp(final MemberUp message) {
    final MemberName memberName = memberToName(message.member());
    LOG.info("{}: Received MemberUp: memberName: {}, address: {}", persistenceId(), memberName, message.member().address());
    resolver.addPeerAddress(memberName, message.member().address());
}
Also used : MemberName(org.opendaylight.controller.cluster.access.concepts.MemberName)

Example 4 with MemberName

use of org.opendaylight.controller.cluster.access.concepts.MemberName in project controller by opendaylight.

the class EntityOwnershipShard method onPeerDown.

private void onPeerDown(final PeerDown peerDown) {
    LOG.info("{}: onPeerDown: {}", persistenceId(), peerDown);
    MemberName downMemberName = peerDown.getMemberName();
    if (downPeerMemberNames.add(downMemberName) && isLeader()) {
        // Select new owners for entities owned by the down peer and which have other candidates. For an entity for
        // which the down peer is the only candidate, we leave it as the owner and don't clear it. This is done to
        // handle the case where the peer member process is actually still running but the node is partitioned.
        // When the partition is healed, the peer just remains as the owner. If the peer process actually restarted,
        // it will first remove all its candidates on startup. If another candidate is registered during the time
        // the peer is down, the new candidate will be selected as the new owner.
        selectNewOwnerForEntitiesOwnedBy(ImmutableSet.of(downMemberName.getName()));
    }
}
Also used : MemberName(org.opendaylight.controller.cluster.access.concepts.MemberName)

Example 5 with MemberName

use of org.opendaylight.controller.cluster.access.concepts.MemberName in project controller by opendaylight.

the class FileModuleShardConfigProvider method readModuleShardsConfig.

private static Map<String, ModuleConfig.Builder> readModuleShardsConfig(final Config moduleShardsConfig) {
    final List<? extends ConfigObject> moduleShardsConfigObjectList = moduleShardsConfig.getObjectList("module-shards");
    final Map<String, ModuleConfig.Builder> moduleConfigMap = new HashMap<>();
    for (final ConfigObject moduleShardConfigObject : moduleShardsConfigObjectList) {
        final String moduleName = moduleShardConfigObject.get("name").unwrapped().toString();
        final ModuleConfig.Builder builder = ModuleConfig.builder(moduleName);
        final List<? extends ConfigObject> shardsConfigObjectList = moduleShardConfigObject.toConfig().getObjectList("shards");
        for (final ConfigObject shard : shardsConfigObjectList) {
            final String shardName = shard.get("name").unwrapped().toString();
            final List<MemberName> replicas = shard.toConfig().getStringList("replicas").stream().map(MemberName::forName).collect(Collectors.toList());
            builder.shardConfig(shardName, replicas);
        }
        moduleConfigMap.put(moduleName, builder);
    }
    return moduleConfigMap;
}
Also used : HashMap(java.util.HashMap) MemberName(org.opendaylight.controller.cluster.access.concepts.MemberName) ConfigObject(com.typesafe.config.ConfigObject)

Aggregations

MemberName (org.opendaylight.controller.cluster.access.concepts.MemberName)32 Test (org.junit.Test)6 HashMap (java.util.HashMap)5 ActorRef (akka.actor.ActorRef)4 Configuration (org.opendaylight.controller.cluster.datastore.config.Configuration)3 AddressFromURIString (akka.actor.AddressFromURIString)2 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 Entry (java.util.Map.Entry)2 Before (org.junit.Before)2 AbstractShardManagerTest (org.opendaylight.controller.cluster.datastore.AbstractShardManagerTest)2 DatastoreContext (org.opendaylight.controller.cluster.datastore.DatastoreContext)2 DatastoreContextFactory (org.opendaylight.controller.cluster.datastore.DatastoreContextFactory)2 ModuleShardConfiguration (org.opendaylight.controller.cluster.datastore.config.ModuleShardConfiguration)2 ShardIdentifier (org.opendaylight.controller.cluster.datastore.identifiers.ShardIdentifier)2 CreateShard (org.opendaylight.controller.cluster.datastore.messages.CreateShard)2 ModuleShardStrategy (org.opendaylight.controller.cluster.datastore.shardstrategy.ModuleShardStrategy)2 ShardStrategy (org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategy)2 MockConfiguration (org.opendaylight.controller.cluster.datastore.utils.MockConfiguration)2 Address (akka.actor.Address)1