use of com.ms.silverking.cloud.toporing.RingTree in project SilverKing by Morgan-Stanley.
the class ConvergenceControllerBase method getResolvedReplicaMap.
protected ResolvedReplicaMap getResolvedReplicaMap(DHTMetaUpdate metaUpdate, RingConfiguration ringConfig) {
RingTree ringTreeMinusExclusions;
ResolvedReplicaMap resolvedReplicaMapMinusExclusions;
try {
ringTreeMinusExclusions = RingTreeBuilder.removeExcludedNodes(metaUpdate.getRingTree(), exclusionSet);
} catch (InvalidRingException ire) {
throw new RuntimeException("Unexpected InvalidRingException", ire);
}
resolvedReplicaMapMinusExclusions = ringTreeMinusExclusions.getResolvedMap(ringConfig.getRingParentName(), null);
return resolvedReplicaMapMinusExclusions;
}
use of com.ms.silverking.cloud.toporing.RingTree in project SilverKing by Morgan-Stanley.
the class RingMapState2 method newExclusionSet.
// FUTURE - deprecate this
public void newExclusionSet(ExclusionSet exclusionSet, ReplicaPrioritizer replicaPrioritizer) throws InvalidRingException {
RingTree newRingTree;
ResolvedReplicaMap newResolvedReplicaMap;
newRingTree = RingTreeBuilder.removeExcludedNodes(rawRingTree, exclusionSet);
newResolvedReplicaMap = newRingTree.getResolvedMap(ringConfig.getRingParentName(), replicaPrioritizer);
ringTreeMinusExclusions = newRingTree;
resolvedReplicaMapMinusExclusions = newResolvedReplicaMap;
/*
System.out.println("\tResolved Map");
resolvedReplicaMapMinusExclusions.display();
System.out.println("\tEnd Resolved Map");
*/
}
use of com.ms.silverking.cloud.toporing.RingTree in project SilverKing by Morgan-Stanley.
the class RingMapState method newExclusionSet.
// FUTURE - deprecate this
public void newExclusionSet(ExclusionSet exclusionSet, ReplicaPrioritizer replicaPrioritizer) throws InvalidRingException {
RingTree newRingTree;
ResolvedReplicaMap newResolvedReplicaMap;
newRingTree = RingTreeBuilder.removeExcludedNodes(rawRingTree, exclusionSet);
newResolvedReplicaMap = newRingTree.getResolvedMap(ringConfig.getRingParentName(), replicaPrioritizer);
ringTreeMinusExclusions = newRingTree;
resolvedReplicaMapMinusExclusions = newResolvedReplicaMap;
/*
System.out.println("\tResolved Map");
resolvedReplicaMapMinusExclusions.display();
System.out.println("\tEnd Resolved Map");
*/
}
use of com.ms.silverking.cloud.toporing.RingTree in project SilverKing by Morgan-Stanley.
the class RingMapState method readInitialExclusions.
/*
private void waitForExclusionSet() {
Log.warningf("waitForExclusionSet: %s", ringIDAndVersionPair);
exclusionSetLock.lock();
try {
while (!exclusionSetInitialized) {
try {
exclusionSetCV.await();
} catch (InterruptedException e) {
}
}
} finally {
exclusionSetLock.unlock();
}
Log.warningf("out waitForExclusionSet: %s", ringIDAndVersionPair);
}
*/
private void readInitialExclusions(MetaClient mc) throws KeeperException {
ExclusionZK exclusionZK;
ExclusionSet instanceExclusionSet;
ExclusionSet exclusionSet;
RingTree newRingTree;
ResolvedReplicaMap newResolvedReplicaMap;
Log.warning("RingMapState reading initial exclusions");
exclusionZK = new ExclusionZK(mc);
try {
exclusionSet = exclusionZK.readLatestFromZK();
} catch (Exception e) {
Log.logErrorWarning(e);
Log.warning("No ExclusionSet found. Using empty set.");
exclusionSet = ExclusionSet.emptyExclusionSet(0);
}
curExclusionSet = exclusionSet;
Log.warning("curExclusionSet initialized:\n", curExclusionSet);
try {
instanceExclusionSet = new ExclusionSet(new ServerSetExtensionZK(dhtMC, dhtMC.getMetaPaths().getInstanceExclusionsPath()).readLatestFromZK());
} catch (Exception e) {
Log.logErrorWarning(e);
Log.warning("No instance ExclusionSet found. Using empty set.");
instanceExclusionSet = ExclusionSet.emptyExclusionSet(0);
}
curInstanceExclusionSet = instanceExclusionSet;
Log.warning("curInstanceExclusionSet initialized:\n", curInstanceExclusionSet);
try {
newRingTree = RingTreeBuilder.removeExcludedNodes(rawRingTree, ExclusionSet.union(curExclusionSet, curInstanceExclusionSet));
} catch (Exception e) {
Log.logErrorWarning(e);
throw new RuntimeException(e);
}
newResolvedReplicaMap = newRingTree.getResolvedMap(ringConfig.getRingParentName(), new ReplicaNaiveIPPrioritizer());
ringTreeMinusExclusions = newRingTree;
resolvedReplicaMapMinusExclusions = newResolvedReplicaMap;
System.out.println("\tResolved Map");
resolvedReplicaMapMinusExclusions.display();
Log.warning("RingMapState done reading initial exclusions");
}
use of com.ms.silverking.cloud.toporing.RingTree in project SilverKing by Morgan-Stanley.
the class RingMapState2 method readInitialExclusions.
private void readInitialExclusions(MetaClient mc) throws KeeperException {
ExclusionZK exclusionZK;
ExclusionSet instanceExclusionSet;
ExclusionSet exclusionSet;
RingTree newRingTree;
ResolvedReplicaMap newResolvedReplicaMap;
Log.warning("RingMapState reading initial exclusions");
exclusionZK = new ExclusionZK(mc);
try {
exclusionSet = exclusionZK.readLatestFromZK();
} catch (Exception e) {
Log.logErrorWarning(e);
Log.warning("No ExclusionSet found. Using empty set.");
exclusionSet = ExclusionSet.emptyExclusionSet(0);
}
curExclusionSet = exclusionSet;
Log.warning("curExclusionSet initialized:\n", curExclusionSet);
try {
instanceExclusionSet = new ExclusionSet(new ServerSetExtensionZK(dhtMC, dhtMC.getMetaPaths().getInstanceExclusionsPath()).readLatestFromZK());
} catch (Exception e) {
Log.logErrorWarning(e);
Log.warning("No instance ExclusionSet found. Using empty set.");
instanceExclusionSet = ExclusionSet.emptyExclusionSet(0);
}
curInstanceExclusionSet = instanceExclusionSet;
Log.warning("curInstanceExclusionSet initialized:\n", curInstanceExclusionSet);
curUnionExclusionSet = ExclusionSet.union(curExclusionSet, curInstanceExclusionSet);
Log.warningf("curUnionExclusionSet initialized: %s", curUnionExclusionSet);
try {
newRingTree = RingTreeBuilder.removeExcludedNodes(rawRingTree, curUnionExclusionSet);
} catch (Exception e) {
Log.logErrorWarning(e);
throw new RuntimeException(e);
}
newResolvedReplicaMap = newRingTree.getResolvedMap(ringConfig.getRingParentName(), new SimpleIPDistancePrioritizer(nodeID, defaultIPDistanceMask));
ringTreeMinusExclusions = newRingTree;
resolvedReplicaMapMinusExclusions = newResolvedReplicaMap;
if (Log.levelMet(Level.INFO)) {
System.out.println("\tResolved Map");
resolvedReplicaMapMinusExclusions.display();
}
Log.warning("RingMapState done reading initial exclusions");
}
Aggregations