From db869bc77451dfd5e6afec604251c9bef8779c00 Mon Sep 17 00:00:00 2001 From: Denis Ranger Date: Thu, 11 Aug 2016 19:28:43 -0400 Subject: [PATCH] Make stress use client mode to avoid checking commit log size on startup Patch by Denis Ranger; Reviewed by Paulo Motta for CASSANDRA-12478 --- CHANGES.txt | 1 + .../src/org/apache/cassandra/stress/StressProfile.java | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index d38bf3e152..827a208609 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 3.0.10 + * Make stress use client mode to avoid checking commit log size on startup (CASSANDRA-12478) * Fix exceptions with new vnode allocation (CASSANDRA-12715) * Unify drain and shutdown processes (CASSANDRA-12509) * Fix NPE in ComponentOfSlice.isEQ() (CASSANDRA-12706) diff --git a/tools/stress/src/org/apache/cassandra/stress/StressProfile.java b/tools/stress/src/org/apache/cassandra/stress/StressProfile.java index 5243d96661..c19e0cdede 100644 --- a/tools/stress/src/org/apache/cassandra/stress/StressProfile.java +++ b/tools/stress/src/org/apache/cassandra/stress/StressProfile.java @@ -35,8 +35,10 @@ import com.google.common.util.concurrent.Uninterruptibles; import com.datastax.driver.core.*; import com.datastax.driver.core.exceptions.AlreadyExistsException; import org.apache.cassandra.config.CFMetaData; +import org.apache.cassandra.config.Config; import org.apache.cassandra.cql3.QueryProcessor; import org.apache.cassandra.cql3.statements.CreateKeyspaceStatement; +import org.apache.cassandra.cql3.statements.CreateTableStatement; import org.apache.cassandra.exceptions.RequestValidationException; import org.apache.cassandra.exceptions.SyntaxException; import org.apache.cassandra.stress.generate.*; @@ -89,6 +91,10 @@ public class StressProfile implements Serializable private void init(StressYaml yaml) throws RequestValidationException { + // Use client mode. Otherwise, users with no read permission on /var/lib/commitlog won't be able to + // use cassandra-stress... + Config.setClientMode(true); + keyspaceName = yaml.keyspace; keyspaceCql = yaml.keyspace_definition; tableName = yaml.table; @@ -129,7 +135,7 @@ public class StressProfile implements Serializable { try { - String name = CFMetaData.compile(tableCql, keyspaceName).cfName; + String name = ((CreateTableStatement.RawStatement) QueryProcessor.parseStatement(tableCql)).columnFamily(); assert name.equalsIgnoreCase(tableName) : "Name in table_definition doesn't match table property: '" + name + "' != '" + tableName + "'"; } catch (RuntimeException e)