raj14243 commented on code in PR #1926:
URL: 
https://github.com/apache/cassandra-gocql-driver/pull/1926#discussion_r2717984231


##########
session.go:
##########
@@ -598,6 +606,23 @@ func (s *Session) KeyspaceMetadata(keyspace string) 
(*KeyspaceMetadata, error) {
        return s.schemaDescriber.getSchema(keyspace)
 }
 
+// GetAllKeyspacesMetadata returns metadata for all keyspaces in the cluster.
+// Uses cached metadata where available.
+func (s *Session) GetAllKeyspacesMetadata() ([]*KeyspaceMetadata, error) {
+       if s.Closed() {
+               return nil, ErrSessionClosed
+       }
+       return s.schemaDescriber.getSchemas()
+}
+

Review Comment:
   > so the comment Uses cached metadata where available is not entirely true.
   
   I will update it to "Uses cached metadata"
   
   > I think we should update cached metadata when GetAllKeyspacesMetadata() is 
called, as it will return outdated schema metadata to the token-aware policy 
itself.
   
   The current implementation intentionally reads only from the cache because 
schema updates are expected to be applied via 
[handleSchemaEvent](https://github.com/apache/cassandra-gocql-driver/blob/f1e31a58f7e0c25e58e2e2a0a0c6de358e643e8b/events.go#L135)
 . I noticed we currently refresh the cache only for the schemaChangeKeyspace 
event; I’ll change this so the cache is refreshed for all relevant schema 
events. That should keep the schema metadata up to date for token-aware 
routing. Let me know if I missed any cases.



-- 
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