mirror of https://github.com/apache/cassandra
check for enough endpoints before starting a quorum wait.
patch by jbellis; reviewed by Jun Rao and Sandeep Tata for CASSANDRA-180 git-svn-id: https://svn.apache.org/repos/asf/incubator/cassandra/trunk@775361 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
784d968db9
commit
d52a110974
|
|
@ -149,12 +149,15 @@ public class StorageProxy implements StorageProxyMBean
|
|||
}
|
||||
try
|
||||
{
|
||||
EndPoint[] endpoints = StorageService.instance().getNStorageEndPoint(rm.key());
|
||||
if (endpoints.length < (DatabaseDescriptor.getReplicationFactor() / 2) + 1)
|
||||
{
|
||||
throw new UnavailableException();
|
||||
}
|
||||
QuorumResponseHandler<Boolean> quorumResponseHandler = new QuorumResponseHandler<Boolean>(
|
||||
DatabaseDescriptor.getReplicationFactor(),
|
||||
new WriteResponseResolver());
|
||||
EndPoint[] endpoints = StorageService.instance().getNStorageEndPoint(rm.key());
|
||||
logger.debug("insertBlocking writing key " + rm.key() + " to " + message.getMessageId() + "@[" + StringUtils.join(endpoints, ", ") + "]");
|
||||
// TODO: throw a thrift exception if we do not have N nodes
|
||||
|
||||
MessagingService.getMessagingInstance().sendRR(message, endpoints, quorumResponseHandler);
|
||||
if (!quorumResponseHandler.get())
|
||||
|
|
|
|||
Loading…
Reference in New Issue