joao-r-reis commented on code in PR #1929:
URL: 
https://github.com/apache/cassandra-gocql-driver/pull/1929#discussion_r2874042378


##########
metadata.go:
##########
@@ -2049,3 +2079,224 @@ func isIdentifierChar(c byte) bool {
                c == '_' ||
                c == '&'
 }
+
+// Handles the full schema changes including table, user type, function, 
aggregate.
+func handleFullSchemaChanges(session *Session, oldKeyspaces, newKeyspaces 
map[string]*KeyspaceMetadata) {
+       session.logger.Debug("Processing full schema change",
+               NewLogFieldInt("old_keyspaces_count", len(oldKeyspaces)),
+               NewLogFieldInt("new_keyspaces_count", len(newKeyspaces)),
+       )
+
+       for _, oldKsMeta := range oldKeyspaces {
+               newKsMeta, ok := newKeyspaces[oldKsMeta.Name]
+               if !ok {
+                       // Skip, KeyspaceChangeListener is already notified in 
refreshSchemas()
+                       continue
+               }
+
+               if session.tableChangeListener != nil {
+                       handleSchemaTableChanges(session, oldKsMeta, newKsMeta)
+               }
+               if session.userTypeChangeListener != nil {
+                       handleSchemaUserTypeChanges(session, oldKsMeta, 
newKsMeta)
+               }
+               if session.functionChangeListener != nil {
+                       handleSchemaFunctionChanges(session, oldKsMeta, 
newKsMeta)
+               }
+               if session.aggregateChangeListener != nil {
+                       handleSchemaAggregateChanges(session, oldKsMeta, 
newKsMeta)
+               }
+       }

Review Comment:
   Move the `Processing full schema change` log message here to the end instead 
and add a duration field similar to what the `refreshSchemas` function does. 
   
   ```
   elapsed := time.Since(start)
   session.logger.Debug("Finished calling schema change listeners..",
                NewLogFieldInt("old_keyspaces_count", len(oldKeyspaces)),
                NewLogFieldInt("new_keyspaces_count", len(newKeyspaces))
           NewLogFieldString("duration", elapsed.String()),
        )
   ```



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