Search in sources :

Example 6 with IPAndPort

use of com.ms.silverking.net.IPAndPort in project SilverKing by Morgan-Stanley.

the class ChecksumTreeDebug method main.

public static void main(String[] args) {
    try {
        if (args.length < 8) {
            System.out.println("args: <gridConfig> <sourceIP> <namespace> <dhtConfigVersion> <ringName> <sourceRing> <targetRing> <ringRegion> [dataVersion]");
        } else {
            ChecksumTreeDebug ctd;
            SKGridConfiguration gc;
            IPAndPort sourceNode;
            long namespace;
            int dhtConfigVersion;
            RingID ringID;
            Pair<Long, Long> sourceRing;
            Pair<Long, Long> targetRing;
            ConvergencePoint sourceCP;
            ConvergencePoint targetCP;
            RingRegion ringRegion;
            long dataVersion;
            LWTPoolProvider.createDefaultWorkPools();
            gc = SKGridConfiguration.parseFile(args[0]);
            sourceNode = new IPAndPort(args[1], gc.getClientDHTConfiguration().getPort());
            namespace = NamespaceUtil.nameToLong(args[2]);
            dhtConfigVersion = Integer.parseInt(args[3]);
            ringID = RingID.nameToRingID(args[4]);
            sourceRing = getVersionPair(args[5]);
            targetRing = getVersionPair(args[6]);
            ringRegion = RingRegion.parseZKString(args[7]);
            if (args.length >= 9) {
                dataVersion = Long.parseLong(args[8]);
            } else {
                dataVersion = Long.MAX_VALUE;
            }
            sourceCP = new ConvergencePoint(dhtConfigVersion, new RingIDAndVersionPair(ringID, sourceRing), dataVersion);
            targetCP = new ConvergencePoint(dhtConfigVersion, new RingIDAndVersionPair(ringID, targetRing), dataVersion);
            ctd = new ChecksumTreeDebug();
            ctd.debug(sourceNode, namespace, ringRegion, sourceCP, targetCP);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : IPAndPort(com.ms.silverking.net.IPAndPort) RingID(com.ms.silverking.cloud.dht.daemon.storage.convergence.RingID) RingRegion(com.ms.silverking.cloud.ring.RingRegion) ConvergencePoint(com.ms.silverking.cloud.dht.daemon.storage.convergence.ConvergencePoint) SKGridConfiguration(com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration) RingIDAndVersionPair(com.ms.silverking.cloud.dht.daemon.storage.convergence.RingIDAndVersionPair) ConvergencePoint(com.ms.silverking.cloud.dht.daemon.storage.convergence.ConvergencePoint) IOException(java.io.IOException)

Example 7 with IPAndPort

use of com.ms.silverking.net.IPAndPort in project SilverKing by Morgan-Stanley.

the class DebugKey method searchForKey.

private void searchForKey(String key, DHTKey dhtKey, ResolvedReplicaMap map) throws ClientException {
    PrimarySecondaryIPListPair psIPLists;
    out.printf("%s\n", map.getRegion(dhtKey));
    psIPLists = map.getReplicaListPair(dhtKey);
    for (IPAndPort replica : psIPLists.getPrimaryOwners()) {
        out.printf("P %s\t%s\n", replica, replicaContainsKey(replica, key));
    }
    for (IPAndPort replica : psIPLists.getSecondaryOwners()) {
        out.printf("S %s\t%s\n", replica, replicaContainsKey(replica, key));
    }
}
Also used : IPAndPort(com.ms.silverking.net.IPAndPort) PrimarySecondaryIPListPair(com.ms.silverking.cloud.toporing.PrimarySecondaryIPListPair)

Example 8 with IPAndPort

use of com.ms.silverking.net.IPAndPort in project SilverKing by Morgan-Stanley.

the class RingInfo method getAllocationMap.

private Map<IPAndPort, Long> getAllocationMap(ResolvedReplicaMap map) {
    Map<IPAndPort, Long> am;
    am = new HashMap<>();
    for (RingEntry entry : map.getEntries()) {
        for (IPAndPort replica : entry.getOwnersIPList(OwnerQueryMode.Primary)) {
            Long curAllocation;
            curAllocation = am.get(replica);
            if (curAllocation == null) {
                curAllocation = new Long(0);
            }
            curAllocation += entry.getRegion().getSize();
            am.put(replica, curAllocation);
        }
    }
    return am;
}
Also used : IPAndPort(com.ms.silverking.net.IPAndPort) RingEntry(com.ms.silverking.cloud.toporing.RingEntry)

Example 9 with IPAndPort

use of com.ms.silverking.net.IPAndPort 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 10 with IPAndPort

use of com.ms.silverking.net.IPAndPort in project SilverKing by Morgan-Stanley.

the class ConvergenceController2 method getAllNonLocalPrimary.

private Set<IPAndPort> getAllNonLocalPrimary(RingEntry entry) {
    ImmutableSet.Builder<IPAndPort> pSetBuilder;
    pSetBuilder = ImmutableSet.builder();
    for (Node node : entry.getPrimaryOwnersList()) {
        IPAndPort primary;
        primary = new IPAndPort(node.getIDString(), DHTNode.getServerPort());
        if (!primary.equals(mgBase._getIPAndPort())) {
            pSetBuilder.add(primary);
        }
    }
    return pSetBuilder.build();
}
Also used : IPAndPort(com.ms.silverking.net.IPAndPort) ImmutableSet(com.google.common.collect.ImmutableSet) DHTNode(com.ms.silverking.cloud.dht.daemon.DHTNode) Node(com.ms.silverking.cloud.topology.Node)

Aggregations

IPAndPort (com.ms.silverking.net.IPAndPort)71 ImmutableSet (com.google.common.collect.ImmutableSet)9 KeeperException (org.apache.zookeeper.KeeperException)7 DaemonState (com.ms.silverking.cloud.dht.daemon.DaemonState)5 ExclusionSet (com.ms.silverking.cloud.meta.ExclusionSet)5 Node (com.ms.silverking.cloud.topology.Node)5 Pair (com.ms.silverking.collection.Pair)5 RingRegion (com.ms.silverking.cloud.ring.RingRegion)4 IOException (java.io.IOException)4 DHTNode (com.ms.silverking.cloud.dht.daemon.DHTNode)3 NodeInfo (com.ms.silverking.cloud.dht.daemon.NodeInfo)3 ConvergencePoint (com.ms.silverking.cloud.dht.daemon.storage.convergence.ConvergencePoint)3 RingEntry (com.ms.silverking.cloud.toporing.RingEntry)3 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 HashSet (java.util.HashSet)3 List (java.util.List)3 Map (java.util.Map)3 Set (java.util.Set)3 ImmutableList (com.google.common.collect.ImmutableList)2