[CASSSIDECAR-475] - Restore job fails with "Keyspace does not exist" fo…#365
Open
bianca-stanciu29 wants to merge 3 commits into
Open
[CASSSIDECAR-475] - Restore job fails with "Keyspace does not exist" fo…#365bianca-stanciu29 wants to merge 3 commits into
bianca-stanciu29 wants to merge 3 commits into
Conversation
…r keyspaces created with quoted mixed-case names
skoppu22
reviewed
Jun 17, 2026
| } | ||
|
|
||
| if (metadata.getKeyspace(keyspace) == null) | ||
| if (metadata.getKeyspace(Metadata.quoteIfNecessary(keyspace)) == null) |
Contributor
There was a problem hiding this comment.
We need to check for keyspace == null before this, otherwise quoteIfNecessary may access null string
Contributor
There was a problem hiding this comment.
keyspace should not be null here ever
Author
There was a problem hiding this comment.
Fixed, moved to MetadataUtils.keyspace() which handles the null keyspace case internally before any lookup.
skoppu22
reviewed
Jun 17, 2026
| checkAndReloadReloadCaches(); | ||
| Metadata metadata = instancesMetadata.instances().get(0).delegate().metadata(); | ||
| if (keyspace == null || metadata.getKeyspace(keyspace) == null) | ||
| if (keyspace == null || metadata.getKeyspace(Metadata.quoteIfNecessary(keyspace)) == null) |
Contributor
There was a problem hiding this comment.
Using quoteIfNecessary may cause regression when a mixed letter keyspace name used without quotes, because quoteIfNecessary decides quotes only based on the chars existing in the keyspace string. Using MetadataUtils.keyspace would avoid this I believe.
| Keyspace created as | Cassandra internal name | Sidecar keyspace_name | Pre-PR getKeyspace | Post-PR getKeyspace(quoteIfNecessary) |
|---|---|---|---|---|
| "MyKeyspace" (quoted) | MyKeyspace | MyKeyspace | folds→mykeyspace → null (bug) | "MyKeyspace"→MyKeyspace → found (fixed) |
| MyKeyspace (unquoted) | mykeyspace | MyKeyspace | folds→mykeyspace → found | "MyKeyspace"→MyKeyspace → null (REGRESSION) |
| myks (lowercase) | myks | myks | found | found |
Contributor
There was a problem hiding this comment.
Same is applicable for other changes in this PR
…yspace helper and add tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cassandra CQL allows keyspace names to be defined as quoted identifiers, which
preserves their exact casing (e.g. CREATE KEYSPACE “MyKeyspace”).
The DataStax Java Driver (com.datastax.driver.core.Metadata) stores such keyspaces with their case-preserved name internally. When querying the Driver’s Metadata API, the argument must also be quoted for the Driver to perform a case-sensitive lookup. Without quoting, the Driver treats the argument as a case-insensitive identifier, normalizes it to
lowercase, and fails to find the keyspace.
A restore job targeting a keyspace created with a quoted mixed-case name (e.g.
“MyKeyspace”) fails with “Keyspace does not exist” during SSTable range validation,
even though the keyspace is present in the cluster.