Search in sources :

Example 6 with InstantiatedRingTree

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

the class SKAdmin method replicaSetExcludedByExclusions.

private boolean replicaSetExcludedByExclusions(ExclusionSet es) throws KeeperException, IOException {
    InstantiatedRingTree curTree;
    ResolvedReplicaMap replicaMap;
    List<Set<IPAndPort>> excludedReplicaSets;
    curTree = readCurrentTree();
    replicaMap = curTree.getResolvedMap(ringConfig.getRingParentName(), new ReplicaNaiveIPPrioritizer());
    excludedReplicaSets = replicaMap.getExcludedReplicaSets(es.asIPAndPortSet(0));
    if (excludedReplicaSets.size() != 0) {
        Log.warning("Exclusion set excludes at least one replica set:");
        for (Set<IPAndPort> s : excludedReplicaSets) {
            Log.warningf("%s", s);
        }
        return true;
    }
    return false;
}
Also used : IPAndPort(com.ms.silverking.net.IPAndPort) ImmutableSet(com.google.common.collect.ImmutableSet) Set(java.util.Set) HashSet(java.util.HashSet) ExclusionSet(com.ms.silverking.cloud.meta.ExclusionSet) ReplicaNaiveIPPrioritizer(com.ms.silverking.cloud.dht.daemon.ReplicaNaiveIPPrioritizer) InstantiatedRingTree(com.ms.silverking.cloud.toporing.InstantiatedRingTree) ResolvedReplicaMap(com.ms.silverking.cloud.toporing.ResolvedReplicaMap)

Example 7 with InstantiatedRingTree

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

the class DebugKey method readTree.

private InstantiatedRingTree readTree(Triple<String, Long, Long> ring) throws IOException, KeeperException {
    MetaClient ringMC;
    long ringConfigVersion;
    long configInstanceVersion;
    InstantiatedRingTree ringTree;
    ringConfigVersion = ring.getTail().getV1();
    configInstanceVersion = ring.getTail().getV2();
    ringMC = metaUtil.getRingMC();
    ringTree = SingleRingZK.readTree(ringMC, ringConfigVersion, configInstanceVersion);
    return ringTree;
}
Also used : MetaClient(com.ms.silverking.cloud.toporing.meta.MetaClient) InstantiatedRingTree(com.ms.silverking.cloud.toporing.InstantiatedRingTree)

Example 8 with InstantiatedRingTree

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

the class ComputeRingStats method readTree.

private InstantiatedRingTree readTree(Triple<String, Long, Long> ring) throws IOException, KeeperException {
    MetaClient ringMC;
    long ringConfigVersion;
    long configInstanceVersion;
    InstantiatedRingTree ringTree;
    ringConfigVersion = ring.getTail().getV1();
    configInstanceVersion = ring.getTail().getV2();
    ringMC = metaUtil.getRingMC();
    ringTree = SingleRingZK.readTree(ringMC, ringConfigVersion, configInstanceVersion);
    return ringTree;
}
Also used : MetaClient(com.ms.silverking.cloud.toporing.meta.MetaClient) InstantiatedRingTree(com.ms.silverking.cloud.toporing.InstantiatedRingTree)

Example 9 with InstantiatedRingTree

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

the class SKAdmin method execCreateSKFSns.

private boolean execCreateSKFSns() throws IOException, ClientException, KeeperException {
    SKFSNamespaceCreator nsCreator;
    String preferredServer;
    Pair<RingConfiguration, InstantiatedRingTree> ringConfigAndTree;
    HostGroupTable hostGroupTable;
    String hostGroupTableName;
    ringConfigAndTree = getRing(dhtConfig, dhtMC);
    Log.warning("ringConfig: ", ringConfigAndTree.getV1());
    hostGroupTableName = ringConfigAndTree.getV1().getCloudConfiguration().getHostGroupTableName();
    Log.warning("hostGroupTableName: ", hostGroupTableName);
    hostGroupTable = getHostGroupTable(hostGroupTableName, dhtMC.getZooKeeper().getZKConfig());
    if (options.preferredServer == null) {
        preferredServer = findArbitraryActiveServer(dhtConfig.getHostGroups(), hostGroupTable);
    } else {
        preferredServer = options.preferredServer;
    }
    Log.warning("Using preferredServer ", preferredServer);
    nsCreator = new SKFSNamespaceCreator(gc.getClientDHTConfiguration(), preferredServer);
    nsCreator.createNamespaces(skfsNamespaces, skfsNSOptions);
    nsCreator.createNamespaces(skfsMutableNamespaces, skfsMutableNSOptions);
    nsCreator.createNamespaces(skfsFileBlockNamespaces, skfsFileBlockNSOptions);
    nsCreator.createNamespaces(skfsDirNamespaces, skfsDirNSOptions);
    return true;
}
Also used : SKFSNamespaceCreator(com.ms.silverking.cloud.skfs.management.SKFSNamespaceCreator) RingConfiguration(com.ms.silverking.cloud.toporing.meta.RingConfiguration) NamedRingConfiguration(com.ms.silverking.cloud.toporing.meta.NamedRingConfiguration) HostGroupTable(com.ms.silverking.cloud.config.HostGroupTable) InstantiatedRingTree(com.ms.silverking.cloud.toporing.InstantiatedRingTree)

Example 10 with InstantiatedRingTree

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

the class SKAdmin method readCurrentTree.

public InstantiatedRingTree readCurrentTree() throws KeeperException, IOException {
    DHTRingCurTargetZK curTargetZK;
    Triple<String, Long, Long> curRingAndVersionPair;
    InstantiatedRingTree ringTree;
    curTargetZK = new DHTRingCurTargetZK(dhtMC, dhtConfig);
    curRingAndVersionPair = curTargetZK.getCurRingAndVersionPair();
    ringTree = SingleRingZK.readTree(new com.ms.silverking.cloud.toporing.meta.MetaClient(new NamedRingConfiguration(dhtConfig.getRingName(), ringConfig), dhtMC.getZooKeeper().getZKConfig()), curRingAndVersionPair.getTail());
    return ringTree;
}
Also used : DHTRingCurTargetZK(com.ms.silverking.cloud.dht.meta.DHTRingCurTargetZK) NamedRingConfiguration(com.ms.silverking.cloud.toporing.meta.NamedRingConfiguration) InstantiatedRingTree(com.ms.silverking.cloud.toporing.InstantiatedRingTree)

Aggregations

InstantiatedRingTree (com.ms.silverking.cloud.toporing.InstantiatedRingTree)10 NamedRingConfiguration (com.ms.silverking.cloud.toporing.meta.NamedRingConfiguration)5 RingConfiguration (com.ms.silverking.cloud.toporing.meta.RingConfiguration)4 MetaClient (com.ms.silverking.cloud.toporing.meta.MetaClient)3 RingConfigurationZK (com.ms.silverking.cloud.toporing.meta.RingConfigurationZK)3 IOException (java.io.IOException)3 KeeperException (org.apache.zookeeper.KeeperException)3 DHTRingCurTargetZK (com.ms.silverking.cloud.dht.meta.DHTRingCurTargetZK)2 ResolvedReplicaMap (com.ms.silverking.cloud.toporing.ResolvedReplicaMap)2 ZooKeeperExtended (com.ms.silverking.cloud.zookeeper.ZooKeeperExtended)2 ImmutableSet (com.google.common.collect.ImmutableSet)1 HostGroupTable (com.ms.silverking.cloud.config.HostGroupTable)1 ReplicaNaiveIPPrioritizer (com.ms.silverking.cloud.dht.daemon.ReplicaNaiveIPPrioritizer)1 CloudConfiguration (com.ms.silverking.cloud.meta.CloudConfiguration)1 ExclusionSet (com.ms.silverking.cloud.meta.ExclusionSet)1 SKFSNamespaceCreator (com.ms.silverking.cloud.skfs.management.SKFSNamespaceCreator)1 Pair (com.ms.silverking.collection.Pair)1 IPAndPort (com.ms.silverking.net.IPAndPort)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1