scylladb / cassandra-stress

Apache License 2.0
4 stars 7 forks source link

Make schema creation safer #10

Open fruch opened 2 months ago

fruch commented 2 months ago

currently this how c-s is creating the schema

//Keyspace
client.execute(createKeyspaceStatementCQL3(), org.apache.cassandra.db.ConsistencyLevel.LOCAL_ONE);

client.execute("USE \""+keyspace+"\"", org.apache.cassandra.db.ConsistencyLevel.LOCAL_ONE);

//Add standard1
client.execute(createStandard1StatementCQL3(settings), org.apache.cassandra.db.ConsistencyLevel.LOCAL_ONE);

System.out.println(String.format("Created keyspaces. Sleeping %ss for propagation.", settings.node.nodes.size()));
Thread.sleep(settings.node.nodes.size() * 1000L); // seconds

it had an assumption all of the nodes are up and running, when this code is running, node taking down during this phase, might fail this phase, and not retires for it.

also we are running it from multiple command at the same time, and the schema creation and the USE statement might going to other node that might not yet got the schema update, and would fail.

### Tasks
- [ ] we should try using  `ConsistencyLevel.LOCAL_QUORM` in those
- [ ] try removing the USE statement (it's tricky since all of the code later assume this keyspace is used)
- [ ] add option to retry this (same the main load are retries by default x10)
fruch commented 2 months ago

@CodeLieutenant try to estimate this work (or every step of it)