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;
}
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");
}
}
}
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;
}
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;
}
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();
}
}
Aggregations