use of com.ms.silverking.net.IPAndPort in project SilverKing by Morgan-Stanley.
the class ChecksumTreeDebug method main.
public static void main(String[] args) {
try {
if (args.length < 8) {
System.out.println("args: <gridConfig> <sourceIP> <namespace> <dhtConfigVersion> <ringName> <sourceRing> <targetRing> <ringRegion> [dataVersion]");
} else {
ChecksumTreeDebug ctd;
SKGridConfiguration gc;
IPAndPort sourceNode;
long namespace;
int dhtConfigVersion;
RingID ringID;
Pair<Long, Long> sourceRing;
Pair<Long, Long> targetRing;
ConvergencePoint sourceCP;
ConvergencePoint targetCP;
RingRegion ringRegion;
long dataVersion;
LWTPoolProvider.createDefaultWorkPools();
gc = SKGridConfiguration.parseFile(args[0]);
sourceNode = new IPAndPort(args[1], gc.getClientDHTConfiguration().getPort());
namespace = NamespaceUtil.nameToLong(args[2]);
dhtConfigVersion = Integer.parseInt(args[3]);
ringID = RingID.nameToRingID(args[4]);
sourceRing = getVersionPair(args[5]);
targetRing = getVersionPair(args[6]);
ringRegion = RingRegion.parseZKString(args[7]);
if (args.length >= 9) {
dataVersion = Long.parseLong(args[8]);
} else {
dataVersion = Long.MAX_VALUE;
}
sourceCP = new ConvergencePoint(dhtConfigVersion, new RingIDAndVersionPair(ringID, sourceRing), dataVersion);
targetCP = new ConvergencePoint(dhtConfigVersion, new RingIDAndVersionPair(ringID, targetRing), dataVersion);
ctd = new ChecksumTreeDebug();
ctd.debug(sourceNode, namespace, ringRegion, sourceCP, targetCP);
}
} catch (Exception e) {
e.printStackTrace();
}
}
use of com.ms.silverking.net.IPAndPort in project SilverKing by Morgan-Stanley.
the class DebugKey method searchForKey.
private void searchForKey(String key, DHTKey dhtKey, ResolvedReplicaMap map) throws ClientException {
PrimarySecondaryIPListPair psIPLists;
out.printf("%s\n", map.getRegion(dhtKey));
psIPLists = map.getReplicaListPair(dhtKey);
for (IPAndPort replica : psIPLists.getPrimaryOwners()) {
out.printf("P %s\t%s\n", replica, replicaContainsKey(replica, key));
}
for (IPAndPort replica : psIPLists.getSecondaryOwners()) {
out.printf("S %s\t%s\n", replica, replicaContainsKey(replica, key));
}
}
use of com.ms.silverking.net.IPAndPort in project SilverKing by Morgan-Stanley.
the class RingInfo method getAllocationMap.
private Map<IPAndPort, Long> getAllocationMap(ResolvedReplicaMap map) {
Map<IPAndPort, Long> am;
am = new HashMap<>();
for (RingEntry entry : map.getEntries()) {
for (IPAndPort replica : entry.getOwnersIPList(OwnerQueryMode.Primary)) {
Long curAllocation;
curAllocation = am.get(replica);
if (curAllocation == null) {
curAllocation = new Long(0);
}
curAllocation += entry.getRegion().getSize();
am.put(replica, curAllocation);
}
}
return am;
}
use of com.ms.silverking.net.IPAndPort in project SilverKing by Morgan-Stanley.
the class RingInfo method getRingInfo.
public void getRingInfo(Triple<String, Long, Long> ring) throws IOException, KeeperException, ClientException {
ResolvedReplicaMap rMap;
Map<IPAndPort, Long> aMap;
rMap = readReplicaMap(ring);
aMap = getAllocationMap(rMap);
for (Map.Entry<IPAndPort, Long> e : aMap.entrySet()) {
out.printf("%s\t%d\n", e.getKey(), e.getValue());
}
}
use of com.ms.silverking.net.IPAndPort in project SilverKing by Morgan-Stanley.
the class ConvergenceController2 method getAllNonLocalPrimary.
private Set<IPAndPort> getAllNonLocalPrimary(RingEntry entry) {
ImmutableSet.Builder<IPAndPort> pSetBuilder;
pSetBuilder = ImmutableSet.builder();
for (Node node : entry.getPrimaryOwnersList()) {
IPAndPort primary;
primary = new IPAndPort(node.getIDString(), DHTNode.getServerPort());
if (!primary.equals(mgBase._getIPAndPort())) {
pSetBuilder.add(primary);
}
}
return pSetBuilder.build();
}
Aggregations