k-rus commented on code in PR #4038:
URL: https://github.com/apache/cassandra/pull/4038#discussion_r2083107024
##########
src/java/org/apache/cassandra/schema/TableMetadata.java:
##########
@@ -602,11 +606,16 @@ public boolean dependsOn(Function function)
public void validate()
{
- if (!isNameValid(keyspace))
- except("Keyspace name must not be empty, more than %s characters
long, or contain non-alphanumeric-underscore characters (got \"%s\")",
SchemaConstants.NAME_LENGTH, keyspace);
+ if (!isValidKeyspaceName(keyspace))
+ except("Keyspace name must not be empty, more than %s characters
long, or contain non-alphanumeric-underscore characters (got \"%s\")",
NAME_LENGTH, keyspace);
- if (!isNameValid(name))
- except("Table name must not be empty, more than %s characters
long, or contain non-alphanumeric-underscore characters (got \"%s\")",
SchemaConstants.NAME_LENGTH, name);
+ if (!isValidName(name))
+ except("Table name must not be empty or not contain
non-alphanumeric-underscore characters (got \"%s\")", name);
+
+ if (name.length() > TABLE_NAME_LENGTH)
+ except("Table name must not be more than %d characters long (got
%d characters for \"%s\")", TABLE_NAME_LENGTH, name.length(), name);
+
+ assert getTableDirectoryName().length() <= FILENAME_LENGTH :
String.format("Generated directory name for a table of %d characters doesn't
fit the max filename legnth of %s. This unexpectedly wasn't prevented by check
of the table name length, %d, to fit %d characters (got table name \"%s\" and
generated directory name \"%s\"", getTableDirectoryName().length(),
FILENAME_LENGTH, name.length(), TABLE_NAME_LENGTH, name,
getTableDirectoryName());
Review Comment:
I disagree with the suggestion of moving `getTableDirectoryName` into the
utility class. As it operate on a table name and used with `TableMetadata`
instance.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]