mirror of https://github.com/apache/cassandra
Add CL.SERIAL CL.LOCAL_SERIAL for cassandra-stress
patch by Jay Zhuang; reviewed by marcuse for CASSANDRA-13925
This commit is contained in:
parent
48562536f1
commit
d97d95ff13
|
|
@ -1,4 +1,5 @@
|
|||
4.0
|
||||
* Add SERIAL and LOCAL_SERIAL support for cassandra-stress (CASSANDRA-13925)
|
||||
* LCS needlessly checks for L0 STCS candidates multiple times (CASSANDRA-12961)
|
||||
* Correctly close netty channels when a stream session ends (CASSANDRA-13905)
|
||||
* Update lz4 to 1.4.0 (CASSANDRA-13741)
|
||||
|
|
|
|||
|
|
@ -97,7 +97,10 @@ public class SchemaInsert extends SchemaStatement
|
|||
else
|
||||
{
|
||||
BatchStatement batch = new BatchStatement(batchType);
|
||||
batch.setConsistencyLevel(JavaDriverClient.from(cl));
|
||||
if (cl.isSerialConsistency())
|
||||
batch.setSerialConsistencyLevel(JavaDriverClient.from(cl));
|
||||
else
|
||||
batch.setConsistencyLevel(JavaDriverClient.from(cl));
|
||||
batch.addAll(substmts);
|
||||
stmt = batch;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,12 @@ public abstract class SchemaStatement extends PartitionOperation
|
|||
argumentIndex[i++] = spec.partitionGenerator.indexOf(name);
|
||||
|
||||
if (statement != null)
|
||||
statement.setConsistencyLevel(JavaDriverClient.from(cl));
|
||||
{
|
||||
if (cl.isSerialConsistency())
|
||||
statement.setSerialConsistencyLevel(JavaDriverClient.from(cl));
|
||||
else
|
||||
statement.setConsistencyLevel(JavaDriverClient.from(cl));
|
||||
}
|
||||
}
|
||||
|
||||
BoundStatement bindRow(Row row)
|
||||
|
|
|
|||
|
|
@ -60,7 +60,12 @@ public class ValidatingSchemaQuery extends PartitionOperation
|
|||
argumentIndex[i++] = spec.partitionGenerator.indexOf(definition.getName());
|
||||
|
||||
for (ValidatingStatement statement : statements)
|
||||
statement.statement.setConsistencyLevel(JavaDriverClient.from(cl));
|
||||
{
|
||||
if (cl.isSerialConsistency())
|
||||
statement.statement.setSerialConsistencyLevel(JavaDriverClient.from(cl));
|
||||
else
|
||||
statement.statement.setConsistencyLevel(JavaDriverClient.from(cl));
|
||||
}
|
||||
this.clusteringComponents = clusteringComponents;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ public abstract class SettingsCommand implements Serializable
|
|||
{
|
||||
final OptionSimple noWarmup = new OptionSimple("no-warmup", "", null, "Do not warmup the process", false);
|
||||
final OptionSimple truncate = new OptionSimple("truncate=", "never|once|always", "never", "Truncate the table: never, before performing any work, or before each iteration", false);
|
||||
final OptionSimple consistencyLevel = new OptionSimple("cl=", "ONE|QUORUM|LOCAL_QUORUM|EACH_QUORUM|ALL|ANY|TWO|THREE|LOCAL_ONE", "LOCAL_ONE", "Consistency level to use", false);
|
||||
final OptionSimple consistencyLevel = new OptionSimple("cl=", "ONE|QUORUM|LOCAL_QUORUM|EACH_QUORUM|ALL|ANY|TWO|THREE|LOCAL_ONE|SERIAL|LOCAL_SERIAL", "LOCAL_ONE", "Consistency level to use", false);
|
||||
}
|
||||
|
||||
static class Count extends Options
|
||||
|
|
|
|||
|
|
@ -185,13 +185,24 @@ public class JavaDriverClient
|
|||
public ResultSet execute(String query, org.apache.cassandra.db.ConsistencyLevel consistency)
|
||||
{
|
||||
SimpleStatement stmt = new SimpleStatement(query);
|
||||
stmt.setConsistencyLevel(from(consistency));
|
||||
|
||||
if (consistency.isSerialConsistency())
|
||||
stmt.setSerialConsistencyLevel(from(consistency));
|
||||
else
|
||||
stmt.setConsistencyLevel(from(consistency));
|
||||
return getSession().execute(stmt);
|
||||
}
|
||||
|
||||
public ResultSet executePrepared(PreparedStatement stmt, List<Object> queryParams, org.apache.cassandra.db.ConsistencyLevel consistency)
|
||||
{
|
||||
stmt.setConsistencyLevel(from(consistency));
|
||||
if (consistency.isSerialConsistency())
|
||||
{
|
||||
stmt.setSerialConsistencyLevel(from(consistency));
|
||||
}
|
||||
else
|
||||
{
|
||||
stmt.setConsistencyLevel(from(consistency));
|
||||
}
|
||||
BoundStatement bstmt = stmt.bind((Object[]) queryParams.toArray(new Object[queryParams.size()]));
|
||||
return getSession().execute(bstmt);
|
||||
}
|
||||
|
|
@ -225,6 +236,10 @@ public class JavaDriverClient
|
|||
return com.datastax.driver.core.ConsistencyLevel.EACH_QUORUM;
|
||||
case LOCAL_ONE:
|
||||
return com.datastax.driver.core.ConsistencyLevel.LOCAL_ONE;
|
||||
case SERIAL:
|
||||
return com.datastax.driver.core.ConsistencyLevel.SERIAL;
|
||||
case LOCAL_SERIAL:
|
||||
return com.datastax.driver.core.ConsistencyLevel.LOCAL_SERIAL;
|
||||
}
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue