mirror of https://github.com/apache/cassandra
r/m special case of local destination when writing with ConsistencyLevel.ZERO, since it causes blocking for commitlog. (MessagingService still optimizes out the network write/read.) Patch by Chris Goffinet; reviewed by jbellis for CASSANDRA-399
git-svn-id: https://svn.apache.org/repos/asf/incubator/cassandra/trunk@809216 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8c3693c6b0
commit
86abfe1027
|
|
@ -112,29 +112,16 @@ public class StorageProxy implements StorageProxyMBean
|
|||
long startTime = System.currentTimeMillis();
|
||||
try
|
||||
{
|
||||
// (This is the ZERO consistency level, so user doesn't care if we don't really have N destinations available.)
|
||||
Map<EndPoint, EndPoint> endpointMap = StorageService.instance().getNStorageEndPointMap(rm.key());
|
||||
// TODO: throw a thrift exception if we do not have N nodes
|
||||
Map<EndPoint, Message> messageMap = createWriteMessages(rm, endpointMap);
|
||||
for (Map.Entry<EndPoint, Message> entry : messageMap.entrySet())
|
||||
{
|
||||
Message message = entry.getValue();
|
||||
EndPoint endpoint = entry.getKey();
|
||||
// Check if local and not hinted
|
||||
byte[] hintedBytes = message.getHeader(RowMutation.HINT);
|
||||
if (endpoint.equals(StorageService.getLocalStorageEndPoint())
|
||||
&& !(hintedBytes!= null && hintedBytes.length>0))
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("locally writing writing key " + rm.key()
|
||||
+ " to " + endpoint);
|
||||
rm.apply();
|
||||
} else
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("insert writing key " + rm.key() + " to "
|
||||
+ message.getMessageId() + "@" + endpoint);
|
||||
MessagingService.getMessagingInstance().sendOneWay(message, endpoint);
|
||||
}
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("insert writing key " + rm.key() + " to " + message.getMessageId() + "@" + endpoint);
|
||||
MessagingService.getMessagingInstance().sendOneWay(message, endpoint);
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
|
|
|
|||
Loading…
Reference in New Issue