Search in sources :

Example 1 with InstanceExclusionZK

use of com.ms.silverking.cloud.dht.meta.InstanceExclusionZK in project SilverKing by Morgan-Stanley.

the class SKAdmin method getInstanceExclusions.

private ExclusionSet getInstanceExclusions() throws KeeperException, IOException {
    InstanceExclusionZK instanceExclusionZK;
    ExclusionSet exclusions;
    instanceExclusionZK = new InstanceExclusionZK(dhtMC);
    exclusions = instanceExclusionZK.readFromZK(VersionedDefinition.NO_VERSION, null);
    return exclusions;
}
Also used : ExclusionSet(com.ms.silverking.cloud.meta.ExclusionSet) InstanceExclusionZK(com.ms.silverking.cloud.dht.meta.InstanceExclusionZK)

Example 2 with InstanceExclusionZK

use of com.ms.silverking.cloud.dht.meta.InstanceExclusionZK in project SilverKing by Morgan-Stanley.

the class SKAdmin method verifyServerEligibility.

private void verifyServerEligibility(Set<String> servers, SKAdminCommand[] commands) throws KeeperException {
    if (Arrays.contains(commands, SKAdminCommand.StartNodes)) {
        Set<String> candidateServers;
        Set<String> ineligibleServers;
        DHTRingCurTargetZK dhtRingCurTargetZK;
        InstanceExclusionZK instanceExclusionZK;
        dhtRingCurTargetZK = new DHTRingCurTargetZK(dhtMC, dhtMC.getDHTConfiguration());
        instanceExclusionZK = new InstanceExclusionZK(dhtMC);
        Log.warning("Verifying server eligibility for start");
        candidateServers = new HashSet<>(servers);
        ineligibleServers = HealthMonitor.removeIneligibleServers(candidateServers, dhtRingCurTargetZK, instanceExclusionZK);
        if (ineligibleServers.size() > 0) {
            for (String ineligibleServer : ineligibleServers) {
                Log.warning("Ineligible server: ", ineligibleServer);
            }
            if (!options.forceInclusionOfUnsafeExcludedServers) {
                throw new IneligibleServerException("Attempted to start ineligible servers: " + CollectionUtil.toString(ineligibleServers, ','));
            } else {
                Log.countdownWarning("*** Including unsafe excluded servers. This may result in data loss ***", unsafeWarningCountdown);
            }
        } else {
            Log.warning("Server eligibility verified");
        }
    }
}
Also used : DHTRingCurTargetZK(com.ms.silverking.cloud.dht.meta.DHTRingCurTargetZK) IneligibleServerException(com.ms.silverking.cloud.dht.meta.IneligibleServerException) InstanceExclusionZK(com.ms.silverking.cloud.dht.meta.InstanceExclusionZK)

Example 3 with InstanceExclusionZK

use of com.ms.silverking.cloud.dht.meta.InstanceExclusionZK in project SilverKing by Morgan-Stanley.

the class SKAdmin method setInstanceExclusions.

private boolean setInstanceExclusions(ExclusionSet exclusionSet) throws KeeperException, IOException {
    InstanceExclusionZK instanceExclusionZK;
    instanceExclusionZK = new InstanceExclusionZK(dhtMC);
    instanceExclusionZK.writeToZK(exclusionSet);
    return true;
}
Also used : InstanceExclusionZK(com.ms.silverking.cloud.dht.meta.InstanceExclusionZK)

Example 4 with InstanceExclusionZK

use of com.ms.silverking.cloud.dht.meta.InstanceExclusionZK in project SilverKing by Morgan-Stanley.

the class SKAdmin method clearInstanceExclusions.

private boolean clearInstanceExclusions() throws KeeperException, IOException {
    InstanceExclusionZK instanceExclusionZK;
    instanceExclusionZK = new InstanceExclusionZK(dhtMC);
    instanceExclusionZK.writeToZK(ExclusionSet.emptyExclusionSet(0));
    return true;
}
Also used : InstanceExclusionZK(com.ms.silverking.cloud.dht.meta.InstanceExclusionZK)

Example 5 with InstanceExclusionZK

use of com.ms.silverking.cloud.dht.meta.InstanceExclusionZK in project SilverKing by Morgan-Stanley.

the class StartOfCurrentExclusionTest method main.

/**
 * @param args
 */
public static void main(String[] args) {
    try {
        if (args.length < 2) {
            System.out.println("<gcName> <server>");
        } else {
            InstanceExclusionZK ieZK;
            MetaClient mc;
            String gcName;
            String server;
            Map<String, Long> exclusionSetStartMap;
            long v;
            gcName = args[0];
            server = args[1];
            mc = new MetaClient(SKGridConfiguration.parseFile(gcName));
            ieZK = new InstanceExclusionZK(mc);
            exclusionSetStartMap = ieZK.getStartOfCurrentExclusion(ImmutableSet.of(server));
            v = exclusionSetStartMap.get(server);
            System.out.printf("StartOfCurrentExclusionTest: %s\n", v);
            System.out.printf("mzxid: %d\n", ieZK.getVersionMzxid(v));
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : MetaClient(com.ms.silverking.cloud.dht.meta.MetaClient) InstanceExclusionZK(com.ms.silverking.cloud.dht.meta.InstanceExclusionZK)

Aggregations

InstanceExclusionZK (com.ms.silverking.cloud.dht.meta.InstanceExclusionZK)5 DHTRingCurTargetZK (com.ms.silverking.cloud.dht.meta.DHTRingCurTargetZK)1 IneligibleServerException (com.ms.silverking.cloud.dht.meta.IneligibleServerException)1 MetaClient (com.ms.silverking.cloud.dht.meta.MetaClient)1 ExclusionSet (com.ms.silverking.cloud.meta.ExclusionSet)1