Search in sources :

Example 16 with IPAndPort

use of com.ms.silverking.net.IPAndPort in project SilverKing by Morgan-Stanley.

the class RecoverDataController method recoverRegion.

// ////////////////////////////////////////////////////////////////
private void recoverRegion(long ns, RingEntry targetEntry, Action nsSync, List<ReplicaSyncRequest> srList) throws ConvergenceException {
    Log.warningAsyncf("recoverRegion %x %s", ns, targetEntry);
    Log.warningAsyncf("%x target %s\n", ns, targetEntry.getRegion());
    for (IPAndPort newOwner : targetEntry.getOwnersIPList(OwnerQueryMode.Primary)) {
        Action prev;
        prev = nsSync;
        for (IPAndPort source : targetReplicas) {
            prev = syncReplica(ns, targetEntry.getRegion(), newOwner.port(dhtConfig.getPort()), source.port(dhtConfig.getPort()), prev, srList);
        }
    }
    Log.warningAsyncf("Done recoverRegion %x %s", ns, targetEntry);
}
Also used : IPAndPort(com.ms.silverking.net.IPAndPort)

Example 17 with IPAndPort

use of com.ms.silverking.net.IPAndPort in project SilverKing by Morgan-Stanley.

the class BaseStorageOperation method processInitialMessageGroupEntry.

@Override
public void processInitialMessageGroupEntry(MessageGroupKeyEntry _entry, List<IPAndPort> primaryReplicas, List<IPAndPort> secondaryReplicas, OpVirtualCommunicator<MessageGroupKeyEntry, PutResult> pvComm) {
    MessageGroupPutEntry entry;
    if (debug) {
        System.out.printf("processInitialMessageGroupEntry() %d\n", primaryReplicas.size());
    }
    entry = (MessageGroupPutEntry) _entry;
    if (forwardingMode.forwards()) {
        if (putOperationContainer.getSecondaryTargets() == null) {
            // Eagerly write to secondary replicas *only* if targets have
            // been defined. FUTURE - could change.
            secondaryReplicas = ImmutableList.of();
        }
        initializeEntryState(entry, primaryReplicas, secondaryReplicas);
        for (IPAndPort replica : primaryReplicas) {
            pvComm.forwardEntry(replica, entry);
        }
        if (putOperationContainer.getSecondaryTargets() != null) {
            for (IPAndPort replica : secondaryReplicas) {
                pvComm.forwardEntry(replica, entry);
            }
        }
    } else {
        pvComm.forwardEntry(putOperationContainer.localIPAndPort(), entry);
    }
}
Also used : IPAndPort(com.ms.silverking.net.IPAndPort) MessageGroupPutEntry(com.ms.silverking.cloud.dht.net.MessageGroupPutEntry)

Example 18 with IPAndPort

use of com.ms.silverking.net.IPAndPort in project SilverKing by Morgan-Stanley.

the class BaseRetrievalOperation method checkForInternalTimeouts.

public Set<IPAndPort> checkForInternalTimeouts(long curTimeMillis, RetrievalVirtualCommunicator rvComm) {
    Set<IPAndPort> timedOutReplicas;
    timedOutReplicas = new HashSet<>();
    if (getMinInternalTimeoutMillis() < curTimeMillis) {
        // while it's being created  FUTURE - make that impossible
        try {
            for (DHTKey key : opKeys()) {
                S entryState;
                entryState = getEntryState(key);
                if (entryState.hasTimedOut(curTimeMillis)) {
                    IPAndPort replica;
                    replica = entryState.currentReplica();
                    if (replica != null && !entryState.prevReplicaSameAsCurrent()) {
                        Log.warning("Non-fatal replica timedOut " + replica + " " + this);
                        timedOutReplicas.add(replica);
                    }
                    tryNextReplica(key, entryState, rvComm);
                }
            }
        } catch (ConcurrentModificationException cme) {
            // FUTURE - This may happen during object creation. Eliminate this possibility in the future.
            // For now, simply ignore. Next check should work.
            Log.warningAsync("Ignoring concurrent modification in BaseRetrievalOperation.checkForInternalTimeouts()");
        }
    }
    return timedOutReplicas;
}
Also used : IPAndPort(com.ms.silverking.net.IPAndPort) ConcurrentModificationException(java.util.ConcurrentModificationException) DHTKey(com.ms.silverking.cloud.dht.common.DHTKey)

Example 19 with IPAndPort

use of com.ms.silverking.net.IPAndPort in project SilverKing by Morgan-Stanley.

the class BaseRetrievalOperation method tryNextReplica.

protected void tryNextReplica(DHTKey key, S entryState, RetrievalVirtualCommunicator rvComm) {
    IPAndPort nextReplica;
    nextReplica = entryState.nextReplica();
    if (nextReplica != null) {
        if (debug) {
            System.out.printf("forward entry state %s %s\n", key, nextReplica);
        }
        rvComm.forwardEntry(nextReplica, key);
    }
}
Also used : IPAndPort(com.ms.silverking.net.IPAndPort)

Example 20 with IPAndPort

use of com.ms.silverking.net.IPAndPort in project SilverKing by Morgan-Stanley.

the class SingleWriterConsistentWrite method quorumTransition.

private void quorumTransition(DHTKey key, Collection<IPAndPort> replicas, TwoPhaseStorageState nextState, OpResult update, PutVirtualCommunicator pvComm) {
    if (debug) {
        System.out.printf("quorumTransition %s %s %s\n", KeyUtil.keyToString(key), nextState, update);
    }
    for (IPAndPort replica : replicas) {
        MessageGroupKeyOrdinalEntry entry;
        if (debug) {
            System.out.printf("quorumTransition replica %s %s\n", KeyUtil.keyToString(key), replica);
        }
        entry = new MessageGroupKeyOrdinalEntry(key, (byte) nextState.ordinal());
        // FUTURE - Consider faster implementation for local case. For now, we handle
        // local with remote.
        // if (pvComm.isLocalReplica(replica)) {
        // update(key, replica, (byte)nextState.ordinal(), update, pvComm);
        // } else {
        pvComm.forwardUpdateEntry(replica, entry);
    // }
    }
    if (debug) {
        System.out.printf("out quorumTransition %s %s %s\n", KeyUtil.keyToString(key), nextState, update);
    }
}
Also used : MessageGroupKeyOrdinalEntry(com.ms.silverking.cloud.dht.net.MessageGroupKeyOrdinalEntry) IPAndPort(com.ms.silverking.net.IPAndPort)

Aggregations

IPAndPort (com.ms.silverking.net.IPAndPort)71 ImmutableSet (com.google.common.collect.ImmutableSet)9 KeeperException (org.apache.zookeeper.KeeperException)7 DaemonState (com.ms.silverking.cloud.dht.daemon.DaemonState)5 ExclusionSet (com.ms.silverking.cloud.meta.ExclusionSet)5 Node (com.ms.silverking.cloud.topology.Node)5 Pair (com.ms.silverking.collection.Pair)5 RingRegion (com.ms.silverking.cloud.ring.RingRegion)4 IOException (java.io.IOException)4 DHTNode (com.ms.silverking.cloud.dht.daemon.DHTNode)3 NodeInfo (com.ms.silverking.cloud.dht.daemon.NodeInfo)3 ConvergencePoint (com.ms.silverking.cloud.dht.daemon.storage.convergence.ConvergencePoint)3 RingEntry (com.ms.silverking.cloud.toporing.RingEntry)3 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 HashSet (java.util.HashSet)3 List (java.util.List)3 Map (java.util.Map)3 Set (java.util.Set)3 ImmutableList (com.google.common.collect.ImmutableList)2