Skip to content

Conversation

@k-rus
Copy link
Member

@k-rus k-rus commented Mar 7, 2025

What is the issue

Fixes https://github.com/riptano/cndb/issues/12683

Table names are used in file names. Since the table names were not validated on its length, creating or flushing a table with too long name fails on too long file name.
There are two cases with using table names in file names:

  • keyspace name . table name -controller-config.JSON
  • table name - 32 chars table id

The maximum allowed file name size is 255 chars. Thus,

  • keyspace and table name, which are together longer than 231 chars, will fail.
  • a table name, which is longer than 222 chars, will fail.

What does this PR fix and why was it fixed

This PR checks that creating new table name should not have too long table name.
New tables are identified through the query's client state, which should not be internal.
The limit is 222 chars for combined keyspace and table names. This is more restrictive than necessary, but is easier to explain in the documentation.

The change is tested in CNDB that creating new tables with long names are prevented, but existing tables still work.

@github-actions
Copy link

github-actions bot commented Mar 7, 2025

Checklist before you submit for review

  • Make sure there is a PR in the CNDB project updating the Converged Cassandra version
  • Use NoSpamLogger for log lines that may appear frequently in the logs
  • Verify test results on Butler
  • Test coverage for new/modified code is > 80%
  • Proper code formatting
  • Proper title for each commit staring with the project-issue number, like CNDB-1234
  • Each commit has a meaningful description
  • Each commit is not very long and contains related changes
  • Renames, moves and reformatting are in distinct commits

@k-rus k-rus force-pushed the rf-cndb-12683-validate-long-table-name branch from 405fd0f to 84118a9 Compare March 7, 2025 20:43
@k-rus k-rus force-pushed the rf-cndb-12683-validate-long-table-name branch from 320fa14 to d8b10aa Compare March 11, 2025 10:41
@k-rus k-rus changed the title [WIP] CNDB-12683 try to validate table name length for not-internal CNDB-12683 try to validate table name length for not-internal Mar 12, 2025
@k-rus k-rus self-assigned this Mar 12, 2025
@k-rus k-rus requested review from a team March 12, 2025 15:05
@k-rus k-rus changed the title CNDB-12683 try to validate table name length for not-internal CNDB-12683 validate table name length for not-internal Mar 12, 2025
Copy link

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@k-rus
Copy link
Member Author

k-rus commented Mar 12, 2025

I changed internal validation of keyspace name during table create.

The length of keyspace name is validated when created with CREATE KEYSPACE statement. A validation of kyespace name also exists in CREATE TABLE statement, but checking the length was missing. My understanding it's needed when keyspace is created internally without validation, which happens in CNDB and some tests in CC. Thus my fix should be safe.

@k-rus k-rus force-pushed the rf-cndb-12683-validate-long-table-name branch from 2db7861 to 0d71dde Compare March 12, 2025 17:08
@k-rus
Copy link
Member Author

k-rus commented Mar 12, 2025

@eolivelli I changed internal validation of keyspace name during table create.

The length of keyspace name is validated when created with CREATE KEYSPACE statement. A validation of kyespace name also exists in CREATE TABLE statement, but checking the length was missing. My understanding it's needed when keyspace is created internally without validation, which happens in CNDB and some tests in CC. Thus my fix should be safe.

I dropped this change from this PR and will do it after the release.

@sonarqubecloud
Copy link

@cassci-bot
Copy link

❌ Build ds-cassandra-pr-gate/PR-1623 rejected by Butler


1 new test failure(s) in 8 builds
See build details here


Found 1 new test failures

Test Explanation Branch history Upstream history
...testWithRangeTombstoneMarkersWithoutCompression regression 🔴🔵🔵🔵🔵🔴🔵 🔵🔵🔵🔵🔵🔵🔵

Found 217 known test failures

@k-rus k-rus merged commit e69c25f into main Mar 12, 2025
474 of 479 checks passed
@k-rus k-rus deleted the rf-cndb-12683-validate-long-table-name branch March 12, 2025 18:47
k-rus added a commit that referenced this pull request Mar 12, 2025
Fixes riptano/cndb#12683

Table names are used in file names. Since the table names were not
validated on its length, creating or flushing a table with too long name
fails on too long file name.
There are two cases with using table names in file names:
- keyspace_name .table_name-controller-config.JSON
- table_name-32chars_table_id 

The maximum allowed file name size is 255 chars. Thus, 
- keyspace and table names, which are together longer than 231 chars,
will fail.
- a table name, which is longer than 222 chars, will fail.

This PR checks that creating new table name should not have too long
table name.
New tables are identified through the query's client state, which should
not be internal.
The limit is 222 chars for combined keyspace and table names. This is
more restrictive than necessary, but is easier to explain in the
documentation.

The change is tested in CNDB that creating new tables with long names
are prevented, but existing tables still work.
k-rus added a commit that referenced this pull request Mar 13, 2025
Fixes riptano/cndb#12683

Table names are used in file names. Since the table names were not
validated on its length, creating or flushing a table with too long name
fails on too long file name.
There are two cases with using table names in file names:
- keyspace_name .table_name-controller-config.JSON
- table_name-32chars_table_id 

The maximum allowed file name size is 255 chars. Thus, 
- keyspace and table names, which are together longer than 231 chars,
will fail.
- a table name, which is longer than 222 chars, will fail.

This PR checks that creating new table name should not have too long
table name.
New tables are identified through the query's client state, which should
not be internal.
The limit is 222 chars for combined keyspace and table names. This is
more restrictive than necessary, but is easier to explain in the
documentation.

The change is tested in CNDB that creating new tables with long names
are prevented, but existing tables still work.
djatnieks pushed a commit that referenced this pull request Apr 14, 2025
Fixes riptano/cndb#12683

Table names are used in file names. Since the table names were not
validated on its length, creating or flushing a table with too long name
fails on too long file name.
There are two cases with using table names in file names:
- keyspace_name .table_name-controller-config.JSON
- table_name-32chars_table_id

The maximum allowed file name size is 255 chars. Thus,
- keyspace and table names, which are together longer than 231 chars,
will fail.
- a table name, which is longer than 222 chars, will fail.

This PR checks that creating new table name should not have too long
table name.
New tables are identified through the query's client state, which should
not be internal.
The limit is 222 chars for combined keyspace and table names. This is
more restrictive than necessary, but is easier to explain in the
documentation.

The change is tested in CNDB that creating new tables with long names
are prevented, but existing tables still work.
djatnieks pushed a commit that referenced this pull request May 18, 2025
Fixes riptano/cndb#12683

Table names are used in file names. Since the table names were not
validated on its length, creating or flushing a table with too long name
fails on too long file name.
There are two cases with using table names in file names:
- keyspace_name .table_name-controller-config.JSON
- table_name-32chars_table_id

The maximum allowed file name size is 255 chars. Thus,
- keyspace and table names, which are together longer than 231 chars,
will fail.
- a table name, which is longer than 222 chars, will fail.

This PR checks that creating new table name should not have too long
table name.
New tables are identified through the query's client state, which should
not be internal.
The limit is 222 chars for combined keyspace and table names. This is
more restrictive than necessary, but is easier to explain in the
documentation.

The change is tested in CNDB that creating new tables with long names
are prevented, but existing tables still work.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants