Merge branch 'cassandra-2.0' into cassandra-2.1

Conflicts:
	CHANGES.txt
	src/java/org/apache/cassandra/service/DatacenterWriteResponseHandler.java
This commit is contained in:
Aleksey Yeschenko 2014-10-11 21:44:02 +03:00
commit 11e8dc1c1c
3 changed files with 12 additions and 9 deletions

View File

@ -70,6 +70,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)

View File

@ -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)

View File

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