Bianca Stanciu created CASSANALYTICS-183:
--------------------------------------------

             Summary: Mixed-case keyspace restore fails with "Keyspace does not 
exist" when quoteIdentifiers is set
                 Key: CASSANALYTICS-183
                 URL: https://issues.apache.org/jira/browse/CASSANALYTICS-183
             Project: Apache Cassandra Analytics
          Issue Type: Improvement
          Components: Writer
            Reporter: Bianca Stanciu
            Assignee: Bianca Stanciu


  +_*Problem*_+

  When a Cassandra keyspace or table is created with CQL double-quotes {*}(e.g. 
CREATE KEYSPACE "MyKeyspace"){*}, the name is case-sensitive and stored as-is 
internally. The QualifiedTableName class holds the raw name without quote 
context. All Sidecar REST API calls in *CloudStorageDataTransferApiImpl* and
  *CoordinatedCloudStorageDataTransferApi* were passing the unquoted name 
(MyKeyspace) in the HTTP request payload.

  On the Sidecar side, that raw name is passed to the DataStax driver's 
{*}Metadata.getKeyspace(){*}, which case-folds it to {_}*mykeyspace*{_}, a name 
that does not exist in the cluster. The restore job then fails with:

  *▎ Keyspace does not exist: MyKeyspace*

  +_*Root Cause*_+

  *CloudStorageDataTransferApiImpl* (and its coordinated variant) called 
*qualifiedTableName.keyspace() / qualifiedTableName.table()* directly when 
building API requests. These return the raw stored name with no CQL quoting 
applied, regardless of whether quoteIdentifiers was set by the caller.

  +_*Solution*_+

  Added *maybeQuotedKeyspace()* and *maybeQuotedTable()* convenience methods to 
{*}QualifiedTableName{*}. These wrap the existing *maybeQuote()* helper and 
return the name surrounded by CQL double-quotes when 
{_}*quoteIdentifiers=true*{_}, or the plain name otherwise.

  All restore job API call sites in *CloudStorageDataTransferApiImpl* and 
*CoordinatedCloudStorageDataTransferApi* will be updated to use these methods:
  - createRestoreJob
  - restoreJobSummary
  - updateRestoreJob
  - abortRestoreJob
  - CreateRestoreJobSliceRequest (both direct and coordinated)
  - RestoreJobProgressRequestParams

 

  *Dependencies*

   This change ensures the correct quoted name is sent in the request; 
CASSSIDECAR-475 ensures Sidecar resolves it correctly on lookup.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to