Skip to content

Instantly share code, notes, and snippets.

@undeadcat
Created October 15, 2015 09:48
Show Gist options
  • Save undeadcat/39e92e08bbb12dab3e00 to your computer and use it in GitHub Desktop.
Save undeadcat/39e92e08bbb12dab3e00 to your computer and use it in GitHub Desktop.
Cassandra code. Mutate all the things!
public List<InetAddress> filterForQuery(Keyspace keyspace, List<InetAddress> liveEndpoints, ReadRepairDecision readRepair)
{
/*
* Endpoints are expected to be restricted to live replicas, sorted by snitch preference.
* For LOCAL_QUORUM, move local-DC replicas in front first as we need them there whether
* we do read repair (since the first replica gets the data read) or not (since we'll take
* the blockFor first ones).
*/
if (isDCLocal)
Collections.sort(liveEndpoints, DatabaseDescriptor.getLocalComparator());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment