smiklosovic commented on code in PR #4038:
URL: https://github.com/apache/cassandra/pull/4038#discussion_r2061260259


##########
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)

Review Comment:
   this is a little bit off, I would expect that if isValidTableName is false, 
then I will not be forced to have yet another check where I check if 
name.length() > TABLE_NAME_LENGTH. That might be part of that already no?
   
   What might happen is that a dev calls "isValidTableName(name)" and if it 
returns true, why would they check if lenght is smaller than TABLE_NAME_LENGTH. 
They just forget to do this. Because they just got "true" from 
"isValidTableName" 



-- 
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: pr-unsubscr...@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org
For additional commands, e-mail: pr-h...@cassandra.apache.org

Reply via email to