Search in sources :

Example 1 with ResolvedReplicaMap

use of com.ms.silverking.cloud.toporing.ResolvedReplicaMap in project SilverKing by Morgan-Stanley.

the class ConvergenceControllerBase method getResolvedReplicaMap.

protected ResolvedReplicaMap getResolvedReplicaMap(DHTMetaUpdate metaUpdate, RingConfiguration ringConfig) {
    RingTree ringTreeMinusExclusions;
    ResolvedReplicaMap resolvedReplicaMapMinusExclusions;
    try {
        ringTreeMinusExclusions = RingTreeBuilder.removeExcludedNodes(metaUpdate.getRingTree(), exclusionSet);
    } catch (InvalidRingException ire) {
        throw new RuntimeException("Unexpected InvalidRingException", ire);
    }
    resolvedReplicaMapMinusExclusions = ringTreeMinusExclusions.getResolvedMap(ringConfig.getRingParentName(), null);
    return resolvedReplicaMapMinusExclusions;
}
Also used : InvalidRingException(com.ms.silverking.cloud.toporing.InvalidRingException) RingTree(com.ms.silverking.cloud.toporing.RingTree) ResolvedReplicaMap(com.ms.silverking.cloud.toporing.ResolvedReplicaMap)

Example 2 with ResolvedReplicaMap

use of com.ms.silverking.cloud.toporing.ResolvedReplicaMap in project SilverKing by Morgan-Stanley.

the class DebugKey method debugConvergence.

public void debugConvergence(String key, Triple<String, Long, Long> sourceRing, Triple<String, Long, Long> targetRing) throws IOException, KeeperException, ClientException {
    ResolvedReplicaMap sMap;
    ResolvedReplicaMap tMap;
    DHTKey dhtKey;
    dhtKey = keyCreator.createKey(key);
    out.printf("Key:    %s\n", key);
    out.printf("DHTKey: %s\n", KeyUtil.keyToString(dhtKey));
    out.printf("Coord:  %d\n", KeyUtil.keyToCoordinate(dhtKey));
    sMap = readReplicaMap(sourceRing);
    tMap = readReplicaMap(targetRing);
    out.printf("Source\n");
    displayKeyInMap(dhtKey, sMap);
    searchForKey(key, dhtKey, sMap);
    out.println();
    out.printf("Target\n");
    displayKeyInMap(dhtKey, tMap);
    searchForKey(key, dhtKey, tMap);
}
Also used : DHTKey(com.ms.silverking.cloud.dht.common.DHTKey) ResolvedReplicaMap(com.ms.silverking.cloud.toporing.ResolvedReplicaMap)

Example 3 with ResolvedReplicaMap

use of com.ms.silverking.cloud.toporing.ResolvedReplicaMap in project SilverKing by Morgan-Stanley.

the class RingInfo method getRingInfo.

public void getRingInfo(Triple<String, Long, Long> ring) throws IOException, KeeperException, ClientException {
    ResolvedReplicaMap rMap;
    Map<IPAndPort, Long> aMap;
    rMap = readReplicaMap(ring);
    aMap = getAllocationMap(rMap);
    for (Map.Entry<IPAndPort, Long> e : aMap.entrySet()) {
        out.printf("%s\t%d\n", e.getKey(), e.getValue());
    }
}
Also used : IPAndPort(com.ms.silverking.net.IPAndPort) HashMap(java.util.HashMap) Map(java.util.Map) ResolvedReplicaMap(com.ms.silverking.cloud.toporing.ResolvedReplicaMap) ResolvedReplicaMap(com.ms.silverking.cloud.toporing.ResolvedReplicaMap)

Example 4 with ResolvedReplicaMap

use of com.ms.silverking.cloud.toporing.ResolvedReplicaMap in project SilverKing by Morgan-Stanley.

the class RingMapState2 method newExclusionSet.

// FUTURE - deprecate this
public void newExclusionSet(ExclusionSet exclusionSet, ReplicaPrioritizer replicaPrioritizer) throws InvalidRingException {
    RingTree newRingTree;
    ResolvedReplicaMap newResolvedReplicaMap;
    newRingTree = RingTreeBuilder.removeExcludedNodes(rawRingTree, exclusionSet);
    newResolvedReplicaMap = newRingTree.getResolvedMap(ringConfig.getRingParentName(), replicaPrioritizer);
    ringTreeMinusExclusions = newRingTree;
    resolvedReplicaMapMinusExclusions = newResolvedReplicaMap;
/*
        System.out.println("\tResolved Map");
        resolvedReplicaMapMinusExclusions.display();
        System.out.println("\tEnd Resolved Map");
        */
}
Also used : RingTree(com.ms.silverking.cloud.toporing.RingTree) InstantiatedRingTree(com.ms.silverking.cloud.toporing.InstantiatedRingTree) ResolvedReplicaMap(com.ms.silverking.cloud.toporing.ResolvedReplicaMap)

Example 5 with ResolvedReplicaMap

use of com.ms.silverking.cloud.toporing.ResolvedReplicaMap in project SilverKing by Morgan-Stanley.

the class HealthMonitor method dhtMetaUpdate.

@Override
public void dhtMetaUpdate(DHTMetaUpdate dhtMetaUpdate) {
    Log.warning(String.format("Received dhtMetaUpdate %s", dhtMetaUpdate));
    try {
        InstantiatedRingTree rawRingTree;
        ResolvedReplicaMap replicaMap;
        instanceExclusionZK = new InstanceExclusionZK(dhtMetaUpdate.getMetaClient());
        dhtRingCurTargetZK = new DHTRingCurTargetZK(dhtMetaUpdate.getMetaClient(), dhtMetaUpdate.getDHTConfig());
        rawRingTree = dhtMetaUpdate.getRingTree();
        replicaMap = rawRingTree.getResolvedMap(dhtMetaUpdate.getNamedRingConfiguration().getRingConfiguration().getRingParentName(), null);
        activeNodesInMap = replicaMap.allReplicas();
        synchronized (this) {
            this.notifyAll();
        }
    } catch (Exception e) {
        Log.logErrorWarning(e, "Exception in HealthMonitor.dhtMetaUpdate()");
    }
}
Also used : InstantiatedRingTree(com.ms.silverking.cloud.toporing.InstantiatedRingTree) ResolvedReplicaMap(com.ms.silverking.cloud.toporing.ResolvedReplicaMap) KeeperException(org.apache.zookeeper.KeeperException) IOException(java.io.IOException) CmdLineException(org.kohsuke.args4j.CmdLineException)

Aggregations

ResolvedReplicaMap (com.ms.silverking.cloud.toporing.ResolvedReplicaMap)9 InstantiatedRingTree (com.ms.silverking.cloud.toporing.InstantiatedRingTree)6 RingTree (com.ms.silverking.cloud.toporing.RingTree)5 ExclusionSet (com.ms.silverking.cloud.meta.ExclusionSet)3 InvalidRingException (com.ms.silverking.cloud.toporing.InvalidRingException)3 IOException (java.io.IOException)3 KeeperException (org.apache.zookeeper.KeeperException)3 InvalidTransitionException (com.ms.silverking.cloud.dht.daemon.storage.convergence.InvalidTransitionException)2 ExclusionZK (com.ms.silverking.cloud.meta.ExclusionZK)2 ServerSetExtensionZK (com.ms.silverking.cloud.meta.ServerSetExtensionZK)2 IPAndPort (com.ms.silverking.net.IPAndPort)2 ImmutableSet (com.google.common.collect.ImmutableSet)1 DHTKey (com.ms.silverking.cloud.dht.common.DHTKey)1 ReplicaNaiveIPPrioritizer (com.ms.silverking.cloud.dht.daemon.ReplicaNaiveIPPrioritizer)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 Set (java.util.Set)1 CmdLineException (org.kohsuke.args4j.CmdLineException)1