mirror of https://github.com/apache/cassandra
Merge branch 'cassandra-2.1' into trunk
This commit is contained in:
commit
e473769fbf
|
|
@ -105,6 +105,7 @@
|
|||
* Fix snapshot repair error on indexed tables (CASSANDRA-8020)
|
||||
* Do not exit nodetool repair when receiving JMX NOTIF_LOST (CASSANDRA-7909)
|
||||
Merged from 2.0:
|
||||
* Reduce totalBlockFor() for LOCAL_* consistency levels (CASSANDRA-8058)
|
||||
* Fix merging schemas with re-dropped keyspaces (CASSANDRA-7256)
|
||||
* Fix counters in supercolumns during live upgrades from 1.2 (CASSANDRA-7188)
|
||||
* Notify DT subscribers when a column family is truncated (CASSANDRA-8088)
|
||||
|
|
|
|||
|
|
@ -146,12 +146,12 @@ public enum ConsistencyLevel
|
|||
return isDCLocal;
|
||||
}
|
||||
|
||||
private boolean isLocal(InetAddress endpoint)
|
||||
public boolean isLocal(InetAddress endpoint)
|
||||
{
|
||||
return DatabaseDescriptor.getLocalDataCenter().equals(DatabaseDescriptor.getEndpointSnitch().getDatacenter(endpoint));
|
||||
}
|
||||
|
||||
private int countLocalEndpoints(Iterable<InetAddress> liveEndpoints)
|
||||
public int countLocalEndpoints(Iterable<InetAddress> liveEndpoints)
|
||||
{
|
||||
int count = 0;
|
||||
for (InetAddress endpoint : liveEndpoints)
|
||||
|
|
|
|||
|
|
@ -20,9 +20,7 @@ package org.apache.cassandra.service;
|
|||
import java.net.InetAddress;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.apache.cassandra.config.DatabaseDescriptor;
|
||||
import org.apache.cassandra.db.Keyspace;
|
||||
import org.apache.cassandra.locator.IEndpointSnitch;
|
||||
import org.apache.cassandra.net.MessageIn;
|
||||
import org.apache.cassandra.db.ConsistencyLevel;
|
||||
import org.apache.cassandra.db.WriteType;
|
||||
|
|
@ -32,8 +30,6 @@ import org.apache.cassandra.db.WriteType;
|
|||
*/
|
||||
public class DatacenterWriteResponseHandler extends WriteResponseHandler
|
||||
{
|
||||
private static final IEndpointSnitch snitch = DatabaseDescriptor.getEndpointSnitch();
|
||||
|
||||
public DatacenterWriteResponseHandler(Collection<InetAddress> naturalEndpoints,
|
||||
Collection<InetAddress> pendingEndpoints,
|
||||
ConsistencyLevel consistencyLevel,
|
||||
|
|
@ -48,9 +44,15 @@ public class DatacenterWriteResponseHandler extends WriteResponseHandler
|
|||
@Override
|
||||
public void response(MessageIn message)
|
||||
{
|
||||
if (message == null || DatabaseDescriptor.getLocalDataCenter().equals(snitch.getDatacenter(message.from)))
|
||||
{
|
||||
if (message == null || consistencyLevel.isLocal(message.from))
|
||||
super.response(message);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int totalBlockFor()
|
||||
{
|
||||
// during bootstrap, include pending endpoints (only local here) in the count
|
||||
// or we may fail the consistency level guarantees (see #833, #8058)
|
||||
return consistencyLevel.blockFor(keyspace) + consistencyLevel.countLocalEndpoints(pendingEndpoints);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue