skoppu22 commented on code in PR #365:
URL: https://github.com/apache/cassandra-sidecar/pull/365#discussion_r3429964906


##########
server/src/main/java/org/apache/cassandra/sidecar/coordination/CassandraClientTokenRingProvider.java:
##########
@@ -83,7 +83,7 @@ public Map<Integer, Set<TokenRange>> localTokenRanges(String 
keyspace, boolean f
     {
         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)

Review 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
   
   



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to