Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Cassandra 2.1 boot camp, Overview
1. CASSANDRA SUMMIT SF 2014
CONTRIBUTOR BOOT
CAMP
Aaron Morton
@aaronmorton
Co-Founder & Principal Consultant
Licensed under a Creative Commons Attribution-NonCommercial 3.0 New Zealand License
20. o.a.c.service.ReadCallback.get()
!
//Wait for blockfor & data
condition.await(timeout,
TimeUnit.MILLISECONDS)
!
// if condition not set
throw ReadTimeoutException()
!
resolver.resolve()
23. AbstractReadExecutor.getReadExecutor()
!
// no retry or blocking for all replicas
return new NeverSpeculatingReadExecutor()
!
// always retry or targeting all replicas
return new AlwaysSpeculatingReadExecutor()
!
// otherwise
return new SpeculatingReadExecutor()
28. StorageProxy.syncWriteBatchedMutations()
!
// write to natural and pending endpoints
sendToHintedEndpoints()
!
---------------------------------------
!
AbstractWriteResponseHandler.get()
29. StorageProxy.sendToHintedEndpoints()
// loop all targets
MessagingService.sendRR() // for local
!
// group messages for remote DC’s
dcGroups.get(dc).add(destination)
!
// write hints for down nodes
submitHint()
---------------------------------------
!
sendMessagesToNonlocalDC()
35. o.a.c.net.MessageIn<T>
public class MessageIn<T>
{
public final InetAddress from;
public final T payload;
public final Map<String, byte[]> parameters;
public final MessagingService.Verb verb;
public final int version;
…
}
36. o.a.c.net.MessageOut<T>
public class MessageOut<T>
{
public final InetAddress
public final MessagingService.Verb verb;
public final T payload;
public final IVersionedSerializer<T>
serializer;
public final Map<String, byte[]> parameters;
…
}
44. o.a.c.gms.VersionGenerator
{
private static final AtomicInteger version = new
AtomicInteger(0);
!
public static int getNextVersion()
{
return version.incrementAndGet();
}
}
45. o.a.c.gms.EndpointState
{
private volatile HeartBeatState hbState;
final Map<ApplicationState, VersionedValue> applicationState = new
NonBlockingHashMap<ApplicationState, VersionedValue>();
!
}
52. o.a.c.gms.Gossiper.examineGossiper()
// If empty SYN send all my info (shadow gossip)
!
if (remoteGeneration == localGeneration && maxRemoteVersion
== maxLocalVersion)
// do nothing
!
else if (remoteGeneration > localGeneration)
// we request everything from the gossiper
!
else if (remoteGeneration < localGeneration)
// send all data with generation = localgeneration and version >
53. o.a.c.gms.Gossiper.examineGossiper()
else if (remoteGeneration == localGeneration)
!
/*
If the max remote version is greater then we request the remote
endpoint send us all the data for this endpoint with version greater
than the max version number we have locally for this endpoint.
!
If the max remote version is lesser, then we send all the data we
have locally for this endpoint with version greater than the max
remote version.
*/