worryg0d commented on code in PR #1929:
URL:
https://github.com/apache/cassandra-gocql-driver/pull/1929#discussion_r2852952655
##########
metadata.go:
##########
@@ -475,14 +489,32 @@ func refreshSchemas(session *Session) error {
} else {
for _, createdKeyspace := range newKeyspaces {
session.policy.KeyspaceChanged(KeyspaceUpdateEvent{Keyspace: createdKeyspace,
Change: SchemaChangeTypeCreated})
+ if session.keyspaceChangeListener != nil {
+
session.keyspaceChangeListener.OnKeyspaceCreated(KeyspaceCreatedEvent{Keyspace:
keyspaceMeta[createdKeyspace]})
+ }
}
for _, droppedKeyspace := range droppedKeyspaces {
session.policy.KeyspaceChanged(KeyspaceUpdateEvent{Keyspace: droppedKeyspace,
Change: SchemaChangeTypeDropped})
+ if session.keyspaceChangeListener != nil {
+
session.keyspaceChangeListener.OnKeyspaceDropped(KeyspaceDroppedEvent{Keyspace:
oldKeyspaceMeta[droppedKeyspace]})
+ }
}
for _, updatedKeyspace := range updatedKeyspaces {
session.policy.KeyspaceChanged(KeyspaceUpdateEvent{Keyspace: updatedKeyspace,
Change: SchemaChangeTypeUpdated})
+ if session.keyspaceChangeListener != nil {
+
session.keyspaceChangeListener.OnKeyspaceUpdated(KeyspaceUpdatedEvent{
+ Old: oldKeyspaceMeta[updatedKeyspace],
+ New: keyspaceMeta[updatedKeyspace],
+ })
+ }
}
}
+
+ // If we have full metadata cache mode, we need to notify the event
listener about the full schema changes
+ if session.cfg.MetadataCacheMode == Full {
Review Comment:
Thinking about this, we have `Disabled` cache mode, which disables caching
of the metadata. So, if it is disabled, we can't actually determine changes as
the old state of metadata is not presented in the cache. I think return an
error if any of the schema change listeners are present, and the metadata cache
is disabled.
--
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]