Skip to content

Commit cdf394b

Browse files
authored
CNDB-12683 handle too long controller config file names (#1565) (#1572)
Handle FSError thrown when the controller config file name is too long. Otherwise, the exception causes failures to create CFS instance.
1 parent 1fa0514 commit cdf394b

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

src/java/org/apache/cassandra/db/compaction/unified/StaticController.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.apache.cassandra.exceptions.ConfigurationException;
2828
import org.apache.cassandra.io.util.File;
2929
import org.apache.cassandra.io.util.FileReader;
30+
import org.apache.cassandra.utils.JVMStabilityInspector;
3031
import org.apache.cassandra.utils.MonotonicClock;
3132
import org.apache.cassandra.utils.Overlaps;
3233
import org.json.simple.JSONObject;
@@ -142,6 +143,11 @@ static Controller fromOptions(Environment env,
142143
{
143144
logger.warn("Unable to parse saved flush size. Using starting value instead:", e);
144145
}
146+
catch (Throwable e)
147+
{
148+
logger.warn("Unable to read controller config file. Using starting value instead:", e);
149+
JVMStabilityInspector.inspectThrowable(e);
150+
}
145151
return new StaticController(env,
146152
scalingParameters,
147153
survivalFactors,

test/unit/org/apache/cassandra/schema/CreateTableValidationTest.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@
1919
package org.apache.cassandra.schema;
2020

2121
import org.apache.cassandra.cql3.CQLTester;
22+
import org.apache.cassandra.cql3.UntypedResultSet;
2223
import org.apache.cassandra.exceptions.ConfigurationException;
2324
import org.apache.cassandra.exceptions.InvalidRequestException;
2425

2526
import org.junit.Test;
2627

28+
import static org.assertj.core.api.Assertions.assertThat;
2729
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
2830
import static org.junit.Assert.fail;
2931

@@ -100,6 +102,25 @@ public void testCreateTableWithMissingClusteringColumn()
100102
"Missing CLUSTERING ORDER for column ck1");
101103
}
102104

105+
@Test
106+
public void testCreatingTableWithLongName() throws Throwable
107+
{
108+
String keyspace = "g38373639353166362d356631322d343864652d393063362d653862616534343165333764_tpch";
109+
String table = "test_create_k8yq1r75bpzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz";
110+
111+
execute(String.format("CREATE KEYSPACE %s with replication = " +
112+
"{ 'class' : 'SimpleStrategy', 'replication_factor' : 1 }",
113+
keyspace));
114+
createTableMayThrow(String.format("CREATE TABLE %s.%s (" +
115+
"key int PRIMARY KEY," +
116+
"val int)", keyspace, table));
117+
118+
execute(String.format("INSERT INTO %s.%s (key,val) VALUES (1,1)", keyspace, table));
119+
flush(keyspace, table);
120+
UntypedResultSet result = execute(String.format("SELECT * from %s.%s", keyspace, table));
121+
assertThat(result.size()).isEqualTo(1);
122+
}
123+
103124
private void expectedFailure(String statement, String errorMsg)
104125
{
105126

0 commit comments

Comments
 (0)