Search in sources :

Example 1 with ConvergencePoint

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();
    }
}
Also used : IPAndPort(com.ms.silverking.net.IPAndPort) RingID(com.ms.silverking.cloud.dht.daemon.storage.convergence.RingID) RingRegion(com.ms.silverking.cloud.ring.RingRegion) ConvergencePoint(com.ms.silverking.cloud.dht.daemon.storage.convergence.ConvergencePoint) SKGridConfiguration(com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration) RingIDAndVersionPair(com.ms.silverking.cloud.dht.daemon.storage.convergence.RingIDAndVersionPair) ConvergencePoint(com.ms.silverking.cloud.dht.daemon.storage.convergence.ConvergencePoint) IOException(java.io.IOException)

Example 2 with ConvergencePoint

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);
}
Also used : ConvergencePoint(com.ms.silverking.cloud.dht.daemon.storage.convergence.ConvergencePoint) ChecksumNode(com.ms.silverking.cloud.dht.daemon.storage.convergence.ChecksumNode)

Example 3 with ConvergencePoint

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();
    }
}
Also used : ConvergencePoint(com.ms.silverking.cloud.dht.daemon.storage.convergence.ConvergencePoint) UUIDBase(com.ms.silverking.id.UUIDBase) IOException(java.io.IOException) KeeperException(org.apache.zookeeper.KeeperException)

Example 4 with ConvergencePoint

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);
}
Also used : ConvergencePoint(com.ms.silverking.cloud.dht.daemon.storage.convergence.ConvergencePoint) ChecksumNode(com.ms.silverking.cloud.dht.daemon.storage.convergence.ChecksumNode)

Example 5 with ConvergencePoint

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);
}
Also used : ConvergencePoint(com.ms.silverking.cloud.dht.daemon.storage.convergence.ConvergencePoint) ChecksumNode(com.ms.silverking.cloud.dht.daemon.storage.convergence.ChecksumNode)

Aggregations

ConvergencePoint (com.ms.silverking.cloud.dht.daemon.storage.convergence.ConvergencePoint)9 IOException (java.io.IOException)4 KeeperException (org.apache.zookeeper.KeeperException)4 ChecksumNode (com.ms.silverking.cloud.dht.daemon.storage.convergence.ChecksumNode)3 RingRegion (com.ms.silverking.cloud.ring.RingRegion)2 UUIDBase (com.ms.silverking.id.UUIDBase)2 IPAndPort (com.ms.silverking.net.IPAndPort)2 OpResult (com.ms.silverking.cloud.dht.common.OpResult)1 RingID (com.ms.silverking.cloud.dht.daemon.storage.convergence.RingID)1 RingIDAndVersionPair (com.ms.silverking.cloud.dht.daemon.storage.convergence.RingIDAndVersionPair)1 RingState (com.ms.silverking.cloud.dht.daemon.storage.convergence.RingState)1 SKGridConfiguration (com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration)1 DHTRingCurTargetZK (com.ms.silverking.cloud.dht.meta.DHTRingCurTargetZK)1 ProtoOpResponseMessageGroup (com.ms.silverking.cloud.dht.net.ProtoOpResponseMessageGroup)1