mirror of https://github.com/apache/cassandra
Allow extra schema definitions in cassandra-stress yaml
Patch by tjake; reviewed by benedict for CASSANDRA-9850
This commit is contained in:
parent
6249a3b1e6
commit
5e89136d10
|
|
@ -1,4 +1,5 @@
|
|||
3.0
|
||||
* Allow extra schema definitions in cassandra-stress yaml (CASSANDRA-9850)
|
||||
* Metrics should use up to date nomenclature (CASSANDRA-9448)
|
||||
* Change CREATE/ALTER TABLE syntax for compression (CASSANDRA-8384)
|
||||
* Cleanup crc and adler code for java 8 (CASSANDRA-9650)
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ public class StressProfile implements Serializable
|
|||
{
|
||||
private String keyspaceCql;
|
||||
private String tableCql;
|
||||
private List<String> extraSchemaDefinitions;
|
||||
private String seedStr;
|
||||
|
||||
public String keyspaceName;
|
||||
|
|
@ -93,6 +94,8 @@ public class StressProfile implements Serializable
|
|||
queries = yaml.queries;
|
||||
insert = yaml.insert;
|
||||
|
||||
extraSchemaDefinitions = yaml.extra_definitions;
|
||||
|
||||
assert keyspaceName != null : "keyspace name is required in yaml file";
|
||||
assert tableName != null : "table name is required in yaml file";
|
||||
assert queries != null : "queries map is required in yaml file";
|
||||
|
|
@ -185,6 +188,24 @@ public class StressProfile implements Serializable
|
|||
Uninterruptibles.sleepUninterruptibly(settings.node.nodes.size(), TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
if (extraSchemaDefinitions != null)
|
||||
{
|
||||
for (String extraCql : extraSchemaDefinitions)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
client.execute(extraCql, org.apache.cassandra.db.ConsistencyLevel.ONE);
|
||||
}
|
||||
catch (AlreadyExistsException e)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println(String.format("Created extra schema. Sleeping %ss for propagation.", settings.node.nodes.size()));
|
||||
Uninterruptibles.sleepUninterruptibly(settings.node.nodes.size(), TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
maybeLoadSchemaInfo(settings);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ public class StressYaml
|
|||
public String table;
|
||||
public String table_definition;
|
||||
|
||||
public List<String> extra_definitions;
|
||||
|
||||
public List<Map<String, Object>> columnspec;
|
||||
public Map<String, QueryDef> queries;
|
||||
public Map<String, String> insert;
|
||||
|
|
|
|||
Loading…
Reference in New Issue