You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "maximkosov (via GitHub)" <gi...@apache.org> on 2026/02/05 09:02:37 UTC

Re: [I] Table system.schema_keyspaces renamed to system_schema.keyspaces in cassandra versions >= 4 [cassandra-gocql-driver]

maximkosov commented on issue #1918:
URL: https://github.com/apache/cassandra-gocql-driver/issues/1918#issuecomment-3852066797

   Hello, we are noticing the same issue when connecting to 3+ clusters. I ran analysis with the help of AI and I think it correctly identified the root cause. I double checked the source code and I think that investigation was correct.
   
   Root Cause
   
     The initialization order in session.init() is incorrect. In session.go:
   
     1. Lines ~318-335: Hosts are added to the policy via s.policy.AddHost() or AddHosts()
     2. Lines ~353-362: s.useSystemSchema is set based on cluster version
   
     When tokenAwareHostPolicy.AddHost() is called, it triggers:
     - AddHost() → updateReplicas() → getKeyspaceMetadata()
   
     At this point, session.useSystemSchema is still false (the default value), so getKeyspaceMetadata() in metadata.go takes the legacy code path and queries system.schema_keyspaces instead of
     system_schema.keyspaces.
   
     Call Chain
   
     session.init()
       └─ s.policy.AddHost(host)                    // line ~320
            └─ tokenAwareHostPolicy.AddHost()       // policies.go:504
                 └─ t.updateReplicas()              // policies.go:509
                      └─ t.getKeyspaceMetadata()    // policies.go:471
                           └─ checks session.useSystemSchema (still false!)
                                └─ queries system.schema_keyspaces (wrong table)
   
       └─ s.useSystemSchema = version.AtLeast(3,0,0)  // line ~360 (too late!)


-- 
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: commits-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org