You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2011/11/17 19:54:52 UTC
svn commit: r1203327 -
/cassandra/trunk/test/unit/org/apache/cassandra/service/ConsistencyLevelTest.java
Author: jbellis
Date: Thu Nov 17 18:54:52 2011
New Revision: 1203327
URL: http://svn.apache.org/viewvc?rev=1203327&view=rev
Log:
fix ConsistencyLevelTest
Modified:
cassandra/trunk/test/unit/org/apache/cassandra/service/ConsistencyLevelTest.java
Modified: cassandra/trunk/test/unit/org/apache/cassandra/service/ConsistencyLevelTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/service/ConsistencyLevelTest.java?rev=1203327&r1=1203326&r2=1203327&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/service/ConsistencyLevelTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/service/ConsistencyLevelTest.java Thu Nov 17 18:54:52 2011
@@ -79,8 +79,7 @@ public class ConsistencyLevelTest extend
for (ConsistencyLevel c : ConsistencyLevel.values())
{
-
- if (c == ConsistencyLevel.EACH_QUORUM || c == ConsistencyLevel.LOCAL_QUORUM)
+ if (c == ConsistencyLevel.EACH_QUORUM || c == ConsistencyLevel.LOCAL_QUORUM) // not supported by simplestrategy
continue;
for (int i = 0; i < replicationFactor; i++)
@@ -107,10 +106,10 @@ public class ConsistencyLevelTest extend
}
};
RowRepairResolver resolver = new RowRepairResolver(table, ByteBufferUtil.bytes("foo"));
- ReadCallback<Row> readHandler = StorageProxy.getReadCallback(resolver, command, c, hostsInUse);
+ ReadCallback<Row> readHandler;
boolean isWriteUnavailable = false;
- boolean isReadUnavailable = false;
+ boolean isReadUnavailable = c == ConsistencyLevel.ANY;
try
{
writeHandler.assureSufficientLiveNodes();
@@ -120,13 +119,17 @@ public class ConsistencyLevelTest extend
isWriteUnavailable = true;
}
- try
- {
- readHandler.assureSufficientLiveNodes();
- }
- catch (UnavailableException e)
+ if (!isReadUnavailable)
{
- isReadUnavailable = true;
+ readHandler = StorageProxy.getReadCallback(resolver, command, c, hostsInUse);
+ try
+ {
+ readHandler.assureSufficientLiveNodes();
+ }
+ catch (UnavailableException e)
+ {
+ isReadUnavailable = true;
+ }
}
//these should always match (in this kind of test)
@@ -189,5 +192,4 @@ public class ConsistencyLevelTest extend
new SimpleSnitch(),
ksmd.strategyOptions);
}
-
}