use of com.ms.silverking.net.IPAndPort in project SilverKing by Morgan-Stanley.
the class SystemNamespaceStore method getAllReplicasFreeSystemDiskBytesEstimate.
private byte[] getAllReplicasFreeSystemDiskBytesEstimate() {
List<Pair<IPAndPort, Long>> results;
Map<IPAndPort, NodeInfo> nodeInfo;
results = new ArrayList<>();
try {
nodeInfo = getAllNodeInfo();
for (IPAndPort node : ringMaster.getAllCurrentReplicaServers()) {
NodeInfo info;
info = nodeInfo.get(node);
if (info != null) {
long freeSystemBytesEstimate;
freeSystemBytesEstimate = (long) ((double) info.getFSFreeBytes() / ringMaster.getCurrentOwnedFraction(node, OwnerQueryMode.Primary));
results.add(new Pair<>(node, freeSystemBytesEstimate));
}
}
} catch (KeeperException ke) {
Log.logErrorWarning(ke);
}
return pairedResultsToBytes(results);
}
use of com.ms.silverking.net.IPAndPort in project SilverKing by Morgan-Stanley.
the class SystemNamespaceStore method getAllReplicasFreeDiskBytes.
private byte[] getAllReplicasFreeDiskBytes() {
List<Pair<IPAndPort, Long>> results;
Map<IPAndPort, NodeInfo> nodeInfo;
results = new ArrayList<>();
try {
nodeInfo = getAllNodeInfo();
for (IPAndPort node : ringMaster.getAllCurrentReplicaServers()) {
NodeInfo info;
info = nodeInfo.get(node);
if (info != null) {
results.add(new Pair<>(node, info.getFSFreeBytes()));
}
}
} catch (KeeperException ke) {
Log.logErrorWarning(ke);
}
return pairedResultsToBytes(results);
}
use of com.ms.silverking.net.IPAndPort in project SilverKing by Morgan-Stanley.
the class SKAdmin method _getActiveDaemons.
private Pair<Boolean, Set<IPAndPort>> _getActiveDaemons() {
try {
Set<IPAndPort> activeDaemons;
activeDaemons = suspectsZK.readActiveNodesFromZK();
for (IPAndPort daemon : activeDaemons) {
System.out.printf("%s\n", daemon.getIPAsString());
}
return new Pair<>(true, activeDaemons);
} catch (KeeperException ke) {
Log.logErrorWarning(ke);
return new Pair(false, ImmutableSet.of());
}
}
use of com.ms.silverking.net.IPAndPort in project SilverKing by Morgan-Stanley.
the class ComputeRingStats method generateLostServers.
private Set<IPAndPort> generateLostServers(int s) {
Set<IPAndPort> lostServers;
// Currently a simple algorithm appropriate only when s <<< |replicas|
lostServers = new HashSet<>();
while (lostServers.size() < s) {
int index;
IPAndPort replica;
index = ThreadLocalRandom.current().nextInt(replicas.size());
replica = replicas.get(index);
if (!lostServers.contains(replica)) {
lostServers.add(replica);
}
}
return lostServers;
}
use of com.ms.silverking.net.IPAndPort in project SilverKing by Morgan-Stanley.
the class ComputeRingStats method lostData.
public boolean lostData(Set<IPAndPort> lostServers) {
// out.println(lostServers);
for (Set<IPAndPort> replicaSet : this.sMap.getReplicaSets()) {
boolean lost;
lost = true;
// out.println(replicaSet);
for (IPAndPort replica : replicaSet) {
// out.println(replica);
if (!lostServers.contains(replica)) {
lost = false;
break;
}
}
if (lost) {
return true;
}
}
return false;
}
Aggregations