You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Dmitry Konstantinov (Jira)" <ji...@apache.org> on 2025/08/05 14:29:00 UTC

[jira] [Comment Edited] (CASSANDRA-20389) Create table fails on long table names

    [ https://issues.apache.org/jira/browse/CASSANDRA-20389?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18012142#comment-18012142 ] 

Dmitry Konstantinov edited comment on CASSANDRA-20389 at 8/5/25 2:28 PM:
-------------------------------------------------------------------------

Results of "pre-commit" profile for cass-20389-long-table-name branch:
 [^trunk_cass-20389-long-table-name_ci_summary.html] 
 [^trunk_cass-20389-long-table-name_results_details.tar.xz] 

all failures look like non-related to the changes


was (Author: dnk):
Results of "pre-commit" profile for cass-20389-long-table-name branch:
 [^trunk_cass-20389-long-table-name_ci_summary.html] 
 [^trunk_cass-20389-long-table-name_results_details.tar.xz] 

> Create table fails on long table names
> --------------------------------------
>
>                 Key: CASSANDRA-20389
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-20389
>             Project: Apache Cassandra
>          Issue Type: Bug
>          Components: CQL/Semantics
>            Reporter: Ruslan Fomkin
>            Assignee: Ruslan Fomkin
>            Priority: Normal
>             Fix For: 4.0.x, 4.1.x, 5.0.x, 5.x
>
>         Attachments: trunk_cass-20389-long-table-name_ci_summary.html, trunk_cass-20389-long-table-name_results_details.tar.xz
>
>          Time Spent: 11.5h
>  Remaining Estimate: 0h
>
> If CREATE TABLE is called with a long table name, the statement fails due to file name too long error.
> E.g, such test:
> {code:java}
> @Test
> public void testCreatingTableWithLongName() throws Throwable
> {
>     String keyspace = "\"38373639353166362d3566313\"";
>     String table = "test_create_k8yq1r75bpzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzaaaaaaaaaaaaaaaa";
>     execute(String.format("CREATE KEYSPACE %s with replication = " +
>                           "{ 'class' : 'SimpleStrategy', 'replication_factor' : 1 }",
>                           keyspace));
>     createTableMayThrow(String.format("CREATE TABLE %s.%s (" +
>                                        "key int PRIMARY KEY," +
>                                        "val int)", keyspace, table));
> }  {code}
> results in:
> {code:java}
> java.lang.RuntimeException: Failed to list files in build/test/cassandra/data/38373639353166362d3566313/test_create_k8yq1r75bpzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzaaaaaaaaaaaaaaaa-1b255f4def2540a60000000000000007
>     at org.apache.cassandra.db.lifecycle.LogAwareFileLister.list(LogAwareFileLister.java:77)
>     at org.apache.cassandra.db.lifecycle.LifecycleTransaction.getFiles(LifecycleTransaction.java:636)
>     at org.apache.cassandra.db.Directories$SSTableLister.filter(Directories.java:1139)
>     at org.apache.cassandra.db.Directories$SSTableLister.list(Directories.java:1086)
>     at org.apache.cassandra.db.Directories$SSTableLister.list(Directories.java:1072)
>     at org.apache.cassandra.db.Directories.lambda$getUIDGenerator$5(Directories.java:1297)
>     at java.base/java.util.stream.AbstractPipeline.sourceSpliterator(AbstractPipeline.java:405)
>     at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
>     at java.base/java.util.stream.IntPipeline.reduce(IntPipeline.java:496)
>     at java.base/java.util.stream.IntPipeline.max(IntPipeline.java:459)
>     at org.apache.cassandra.io.sstable.SequenceBasedSSTableId$Builder.generator(SequenceBasedSSTableId.java:102)
>     at org.apache.cassandra.db.Directories.getUIDGenerator(Directories.java:1302)
>     at org.apache.cassandra.db.ColumnFamilyStore.createColumnFamilyStore(ColumnFamilyStore.java:768)
>     at org.apache.cassandra.db.ColumnFamilyStore.createColumnFamilyStore(ColumnFamilyStore.java:756)
>     at org.apache.cassandra.db.ColumnFamilyStore.createColumnFamilyStore(ColumnFamilyStore.java:747)
>     at org.apache.cassandra.db.Keyspace.initCf(Keyspace.java:379)
>     at org.apache.cassandra.schema.DistributedSchema.createTable(DistributedSchema.java:341)
>     at org.apache.cassandra.schema.DistributedSchema.lambda$initializeKeyspaceInstances$6(DistributedSchema.java:213)
>     at java.base/java.lang.Iterable.forEach(Iterable.java:75)
>     at org.apache.cassandra.schema.DistributedSchema.lambda$initializeKeyspaceInstances$10(DistributedSchema.java:213)
>     at com.google.common.collect.ImmutableList.forEach(ImmutableList.java:422)
>     at org.apache.cassandra.schema.DistributedSchema.initializeKeyspaceInstances(DistributedSchema.java:199)
>     at org.apache.cassandra.tcm.listeners.SchemaListener.notifyInternal(SchemaListener.java:50)
>     at org.apache.cassandra.tcm.listeners.SchemaListener.notifyPreCommit(SchemaListener.java:43)
>     at org.apache.cassandra.tcm.log.LocalLog.notifyPreCommit(LocalLog.java:626)
>     at org.apache.cassandra.tcm.log.LocalLog.processPendingInternal(LocalLog.java:527)
>     at org.apache.cassandra.tcm.log.LocalLog$Async$AsyncRunnable.run(LocalLog.java:819)
>     at org.apache.cassandra.concurrent.InfiniteLoopExecutor.loop(InfiniteLoopExecutor.java:121)
>     at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
>     at java.base/java.lang.Thread.run(Thread.java:829)
> Caused by: java.nio.file.FileSystemException: build/test/cassandra/data/38373639353166362d3566313/test_create_k8yq1r75bpzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzaaaaaaaaaaaaaaaa-1b255f4def2540a60000000000000007: File name too long
>     at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:100)
>     at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
>     at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
>     at java.base/sun.nio.fs.UnixFileSystemProvider.newDirectoryStream(UnixFileSystemProvider.java:412)
>     at java.base/java.nio.file.Files.newDirectoryStream(Files.java:472)
>     at org.apache.cassandra.db.lifecycle.LogAwareFileLister.innerList(LogAwareFileLister.java:83)
>     at org.apache.cassandra.db.lifecycle.LogAwareFileLister.list(LogAwareFileLister.java:73)
>  {code}
> There is a bug in [TableMetadata|https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/schema/TableMetadata.java#L552] which calls a name validation function with expectation of checking the length. However, the correct function to use is  [isValidName|https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/schema/SchemaConstants.java#L83], which validates also length, instead of [isNameValid|https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/schema/TableMetadata.java#L552], which, I guess, shouldn't be present.
> Fixing this table name validation bug depends if the validation is called only for new tables, or also for existing tables, when the schema is shared with another node or replica.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org