use of com.ms.silverking.cloud.dht.meta.IneligibleServerException 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.IneligibleServerException in project SilverKing by Morgan-Stanley.
the class SKAdmin method main.
// /////////////////////////////////////////
public static void main(String[] args) {
boolean success;
success = false;
try {
SKAdmin skAdmin;
SKAdminOptions options;
CmdLineParser parser;
SKGridConfiguration gc;
SKAdminCommand[] commands;
LWTPoolProvider.createDefaultWorkPools();
LWTThreadUtil.setLWTThread();
options = new SKAdminOptions();
parser = new CmdLineParser(options);
try {
parser.parseArgument(args);
} catch (CmdLineException cle) {
System.err.println(cle.getMessage());
parser.printUsage(System.err);
System.exit(-1);
}
fillDefaultOptions(options);
sanityCheckOptions(options);
if (options.gridConfigBase != null) {
gc = SKGridConfiguration.parseFile(new File(options.gridConfigBase), options.gridConfig);
} else {
gc = SKGridConfiguration.parseFile(options.gridConfig);
}
if (options.forceInclusionOfUnsafeExcludedServers) {
Log.countdownWarning("Options requesting unsafe excluded servers. This may result in data loss", unsafeWarningCountdown);
}
skAdmin = new SKAdmin(gc, options);
commands = SKAdminCommand.parseCommands(options.commands);
success = skAdmin.execCommand(commands);
} catch (IneligibleServerException ise) {
throw ise;
} catch (Exception e) {
e.printStackTrace();
System.exit(-1);
}
Log.warning("SKAdmin exiting success=" + success);
if (exitOnCompletion) {
System.exit(success ? 0 : -1);
}
}
Aggregations