fixes for verifying destinationavailability under hinted conditions

patch by Narendra Sharma and jbellis for CASSANDRA-2514

git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-0.7@1095473 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jonathan Ellis 2011-04-20 18:14:54 +00:00
parent 23706164f6
commit 15a0f2b207
4 changed files with 11 additions and 6 deletions

View File

@ -34,6 +34,8 @@
* fix backslash substitutions in CLI (CASSANDRA-2492)
* count a row deletion as one operation towards memtable threshold
(CASSANDRA-2519)
* fixes for verifying destination availability under hinted conditions
so UE can be thrown intead of timing out (CASSANDRA-2514)
0.7.4

View File

@ -102,10 +102,12 @@ public class DatacenterSyncWriteResponseHandler extends AbstractWriteResponseHan
dcEndpoints.put(dc, new AtomicInteger());
for (InetAddress destination : hintedEndpoints.keySet())
{
assert writeEndpoints.contains(destination);
// figure out the destination dc
String destinationDC = snitch.getDatacenter(destination);
dcEndpoints.get(destinationDC).incrementAndGet();
if (writeEndpoints.contains(destination))
{
// figure out the destination dc
String destinationDC = snitch.getDatacenter(destination);
dcEndpoints.get(destinationDC).incrementAndGet();
}
}
// Throw exception if any of the DC doesn't have livenodes to accept write.

View File

@ -84,9 +84,9 @@ public class DatacenterWriteResponseHandler extends WriteResponseHandler
public void assureSufficientLiveNodes() throws UnavailableException
{
int liveNodes = 0;
for (InetAddress destination : writeEndpoints)
for (InetAddress destination : hintedEndpoints.keySet())
{
if (localdc.equals(snitch.getDatacenter(destination)))
if (localdc.equals(snitch.getDatacenter(destination)) && writeEndpoints.contains(destination))
liveNodes++;
}

View File

@ -100,6 +100,7 @@ public class WriteResponseHandler extends AbstractWriteResponseHandler
// ensure there are blockFor distinct living nodes (hints are ok).
if (hintedEndpoints.keySet().size() < responses.get())
throw new UnavailableException();
return;
}
// count destinations that are part of the desired target set