You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Ruslan Fomkin (Jira)" <ji...@apache.org> on 2025/04/04 09:51:00 UTC

[jira] [Commented] (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=17940924#comment-17940924 ] 

Ruslan Fomkin commented on CASSANDRA-20389:
-------------------------------------------

My PR to trunk is ready for review: [https://github.com/apache/cassandra/pull/4038]

A CircleCI build is running for it: [http://app.circleci.com/pipelines/github/k-rus/cassandra?branch=cass-20389-long-table-name]

I am not sure how I should share the CircleCI build and if I need to do some manual steps. If there are particular instructions for it, let me know, since I don't see anything specific in the contribution page.

I would like to get feedback on my PR to trunk first, before I create patches for 4.x and 5.x branches. I expect that patches for 5.x branches will be as it is, while patches for 4.x branches will require additional changes.

I guess it make sense to start working on updating documentation when patches for all branches are ready as they can be difference in the table name length requirements.

I assume that the commits will be squashed, thus the commit message is the PR description. Since there will be reviewer's comments to address I haven't squashed commits for now. Also I hope it's easier to review the PR description than commit messages.

Let me know what I am missing and provide guidance or links to guidance in addition to the contibution page.

> 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
>
>          Time Spent: 10m
>  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