k-rus opened a new pull request, #4325: URL: https://github.com/apache/cassandra/pull/4325
The length of table names was not controlled. This is likely due to confusion between validation functions with similar names. As result creating a table with too long name led to the too long file name exception during the table creation. This commit adds a validation of table name lengths to avoid the too long file name errors. The validation length is based on how the table name is used to create file/directory name and needs to be exact to prevent the too long file name exception, but allow all other table names, which doesn't lead to the too long file name exception. Since this limit is different from the existing name length limit of 48 characters, the validation of lengths is separated from the common validation function, which checks for empty name and valid characters. This separation allows to be specific with errors in number of cases. Note that there will be more PRs with more cases for different name length: - In 4.x table names participate in file names together with keyspace names, thus, the lengths will vary depending on keyspaces - Index names participate in file names together with index meta information such as index type, version and includes optional parameters, thus the length will vary on exact index created. New constants are added for the table name length limit and for the file name length limit. Two similar validation functions are replaced with one to avoid confusion. Name related constants are stored in the same utility class. Table name related code are moved into methods in `TableMetadata` class, so their semantics are more clear and to allow reuse, e.g., in asserting the table name length constant. Tests are added for the long table names and non-alphanumeric names. Keyspace name validation function is shared between two classes and a unit test of it is added. Other changes in this commit: - Fix few minor suggestions for code improvements in affected files - Add git-ignoring VS code generated files patch by Ruslan Fomkin; reviewed by Piotr Kołaczkowski, Dmitry Konstantinov for CASSANDRA-20389 -- 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