mirror of https://github.com/apache/cassandra
Fix for stress.java using wrong key names and not detecting empty keys.
Patch by Pavel Yaskevich, reviewed by brandonwilliams for CASSANDRA-1915 git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-0.7@1053715 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
df9e121fd9
commit
1d8ba59c9b
|
|
@ -164,7 +164,7 @@ public class Session
|
|||
columnFamilyType = ColumnFamilyType.valueOf(cmd.getOptionValue("y"));
|
||||
|
||||
if (cmd.hasOption("k"))
|
||||
ignoreErrors = Boolean.parseBoolean(cmd.getOptionValue("k"));
|
||||
ignoreErrors = true;
|
||||
|
||||
if (cmd.hasOption("i"))
|
||||
progressInterval = Integer.parseInt(cmd.getOptionValue("i"));
|
||||
|
|
|
|||
|
|
@ -75,9 +75,12 @@ public class Reader extends OperationThread
|
|||
List<ColumnOrSuperColumn> columns;
|
||||
columns = client.get_slice(key, parent, predicate, session.getConsistencyLevel());
|
||||
|
||||
if (columns == null)
|
||||
if (columns.size() == 0)
|
||||
{
|
||||
throw new RuntimeException(String.format("Key %s not found.", superColumn));
|
||||
System.err.println(String.format("Key %s not found.", superColumn));
|
||||
|
||||
if (!session.ignoreErrors())
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
@ -111,9 +114,12 @@ public class Reader extends OperationThread
|
|||
List<ColumnOrSuperColumn> columns;
|
||||
columns = client.get_slice(keyBuffer, parent, predicate, session.getConsistencyLevel());
|
||||
|
||||
if (columns == null)
|
||||
if (columns.size() == 0)
|
||||
{
|
||||
throw new RuntimeException(String.format("Key %s not found.", key.toString()));
|
||||
System.err.println(String.format("Key %s not found.", new String(key)));
|
||||
|
||||
if (!session.ignoreErrors())
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ public abstract class OperationThread extends Thread
|
|||
*/
|
||||
private byte[] generateGaussKey()
|
||||
{
|
||||
String format = "%0" + session.getTotalKeysLength() + "f";
|
||||
String format = "%0" + session.getTotalKeysLength() + "d";
|
||||
|
||||
for (;;)
|
||||
{
|
||||
|
|
@ -109,7 +109,7 @@ public abstract class OperationThread extends Thread
|
|||
|
||||
if (0 <= token && token < session.getNumKeys())
|
||||
{
|
||||
return String.format(format, token).getBytes();
|
||||
return String.format(format, (int) token).getBytes();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue