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);
}
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);
}
}
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;
}
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);
}
}
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);
}
}
Aggregations