dkropachev commented on code in PR #1794: URL: https://github.com/apache/cassandra-gocql-driver/pull/1794#discussion_r1712560334
########## metadata.go: ########## @@ -269,6 +307,23 @@ func (s *schemaDescriber) getSchema(keyspaceName string) (*KeyspaceMetadata, err return metadata, nil } +// returns the cached VirtualKeyspaceMetadata held by the describer for the named +// keyspace. +func (s *virtualSchemaDescriber) getSchema(keyspaceName string) (*VirtualKeyspaceMetadata, error) { + s.mu.Lock() + defer s.mu.Unlock() + metadata, found := s.cache[keyspaceName] Review Comment: Shouldn't you invalidate it at some point. Say you upgrade cluster from one version to another, driver will still keep old schema. Probably on `handleNodeUp` you could read `release_version` `select release_version from system.local where key = 'local'` and invalidate or update cache if it has changed. Another problem if your cluster half on new version half on another. Now you depends on where have your control connection landed, if it has landed on a node with new version, session will give you a new schema, while old nodes don't support it. Way to solve it is to run queries not on control connection, but rather on the node with oldest version available, if you were do so, you can't pick all the nodes from the cluster, you have to adhere to `HostSelectionPolicy`, say if it is `dcAwareRR` you will need to filter out all nodes from other datacenters. -- 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-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org