use of com.ms.silverking.cloud.dht.daemon.storage.convergence.ConvergencePoint 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.cloud.dht.daemon.storage.convergence.ConvergencePoint in project SilverKing by Morgan-Stanley.
the class DHTRingMaster method displayChecksumTree.
public void displayChecksumTree(MessageGroup message, MessageGroupConnection connection) {
ChecksumNode remoteTree;
ConvergencePoint cp;
cp = ProtoChecksumTreeMessageGroup.getConvergencePoint(message);
remoteTree = ProtoChecksumTreeMessageGroup.deserialize(message);
System.out.printf("incomingChecksumTree: %s\t%s\t%s\n", message.getUUID(), cp, connection);
System.out.println(remoteTree);
}
use of com.ms.silverking.cloud.dht.daemon.storage.convergence.ConvergencePoint in project SilverKing by Morgan-Stanley.
the class DHTRingMaster method syncData.
public void syncData(Quadruple<UUIDBase, Quadruple<String, Long, Long, Long>, Quadruple<String, Long, Long, Long>, SyncTargets> idAndRings) {
UUIDBase uuid;
Quadruple<String, Long, Long, Long> sourceRing;
Quadruple<String, Long, Long, Long> targetRing;
uuid = idAndRings.getV1();
sourceRing = idAndRings.getV2();
targetRing = idAndRings.getV3();
Log.warningAsyncf("DHTRingMaster.syncData %s %s %s", uuid, sourceRing.getV1(), targetRing.getV1());
convergenceLock.lock();
try {
if (/*!isValidTarget(targetRing)*/
false) {
// FUTURE think about checking validity
// FUTURE - could improve this sanity check to look at zk info
Log.warningAsyncf("Ignoring invalid sync %s %s", sourceRing, targetRing);
} else {
if (enableLogging) {
Log.warningAsync("New ring: ", targetRing);
}
try {
ConvergencePoint _sourceCP;
ConvergencePoint _targetCP;
// Check for old convergence
if (targetConvergenceController != null) {
if (enableLogging) {
Log.warningAsync("Can't sync due to ongoing convergence: ", targetRing);
return;
}
}
// Start new sync
_sourceCP = new ConvergencePoint(dhtConfig.getVersion(), RingIDAndVersionPair.fromRingNameAndVersionPair(sourceRing.getTripleAt1()), sourceRing.getV4());
_targetCP = new ConvergencePoint(dhtConfig.getVersion(), RingIDAndVersionPair.fromRingNameAndVersionPair(targetRing.getTripleAt1()), targetRing.getV4());
try {
targetConvergenceController = new CentralConvergenceController(uuid, dhtMetaReader, _sourceCP, _targetCP, readExclusions(targetRing), mgBase, syncUnchangedOwners, CentralConvergenceController.RequestedSyncMode.SyncOnly);
convergenceControllers.put(targetConvergenceController.getUUID(), targetConvergenceController);
} catch (IOException ioe) {
Log.logErrorWarning(ioe, "Unable to start sync");
return;
}
try {
convergenceLock.unlock();
try {
if (enableLogging) {
Log.warningAsync("Calling converge(): ", targetRing);
}
((CentralConvergenceController) targetConvergenceController).converge(idAndRings.getV4());
} finally {
convergenceLock.lock();
}
targetConvergenceController = null;
if (enableLogging) {
Log.warningAsync("Convergence complete: ", targetRing);
}
} catch (ConvergenceException ce) {
// Convergence failed
if (!ce.getAbandoned()) {
// Failed due to an exception
Log.logErrorWarning(ce, "Convergence failed due to exception");
} else {
// Failed due to a new target causing the old convergence to be abandoned
// In this case, the new convergence will take over the cur and target pointers
Log.warningAsync("Previous convergence abandoned");
}
}
} catch (KeeperException ke) {
// Retries are internal to DHTringCurTargetZK. If we got here, those
// retries failed.
// FUTURE - relay to alerting
Log.logErrorWarning(ke, "Unexpected exception during peerStateMet handling");
}
}
} finally {
convergenceLock.unlock();
}
}
use of com.ms.silverking.cloud.dht.daemon.storage.convergence.ConvergencePoint in project SilverKing by Morgan-Stanley.
the class StorageModule method incomingChecksumTree.
// used only for testing
/*
public void requestChecksumTree(long version) {
for (NamespaceStore nsStore : namespaces.values()) {
System.out.printf("requestChecksumTree: %x\n", nsStore.getNamespace());
nsStore.requestChecksumTree(version, OwnerQueryMode.Secondary);
}
}
*/
public void incomingChecksumTree(MessageGroup message, MessageGroupConnection connection) {
NamespaceStore nsStore;
ChecksumNode remoteTree;
ConvergencePoint cp;
nsStore = getNamespaceStore(message.getContext(), NSCreationMode.CreateIfAbsent);
cp = ProtoChecksumTreeMessageGroup.getConvergencePoint(message);
remoteTree = ProtoChecksumTreeMessageGroup.deserialize(message);
nsStore.incomingChecksumTree(message.getUUID(), remoteTree, cp, connection);
}
use of com.ms.silverking.cloud.dht.daemon.storage.convergence.ConvergencePoint in project SilverKing by Morgan-Stanley.
the class ChecksumTreeDebug method incomingChecksumTree.
private void incomingChecksumTree(MessageGroup message, MessageGroupConnection connection) {
ChecksumNode remoteTree;
ConvergencePoint cp;
cp = ProtoChecksumTreeMessageGroup.getConvergencePoint(message);
remoteTree = ProtoChecksumTreeMessageGroup.deserialize(message);
ars.incomingChecksumTree(cp, remoteTree, connection);
}
Aggregations