You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "MahsaSeifikar (via GitHub)" <gi...@apache.org> on 2024/10/28 15:22:01 UTC

[PR] MINOR: Add logging to deleteTopic and deleteTopics functions [kafka]

MahsaSeifikar opened a new pull request, #17617:
URL: https://github.com/apache/kafka/pull/17617

   MINOR: Add logging to deleteTopic and deleteTopics functions.
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


-- 
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: jira-unsubscribe@kafka.apache.org

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


Re: [PR] MINOR: Add logging to deleteTopic and deleteTopics functions [kafka]

Posted by "cmccabe (via GitHub)" <gi...@apache.org>.
cmccabe commented on code in PR #17617:
URL: https://github.com/apache/kafka/pull/17617#discussion_r1819375268


##########
metadata/src/main/java/org/apache/kafka/controller/ReplicationControlManager.java:
##########
@@ -966,6 +971,7 @@ void deleteTopic(ControllerRequestContext context, Uuid id, List<ApiMessageAndVe
         }
         records.add(new ApiMessageAndVersion(new RemoveTopicRecord().
             setTopicId(id), (short) 0));
+        log.info("Successfully added RemoveTopicRecord for topic {} with ID {}", topic.name, id);

Review Comment:
   I think what would be useful is logging the full result set. Like, each topic and the results of the deletion (success, or whatever error message we got.) If we make this a single log message at INFO it will be much more efficient.



-- 
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: jira-unsubscribe@kafka.apache.org

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


Re: [PR] MINOR: Add logging to deleteTopic and deleteTopics functions [kafka]

Posted by "cmccabe (via GitHub)" <gi...@apache.org>.
cmccabe commented on code in PR #17617:
URL: https://github.com/apache/kafka/pull/17617#discussion_r1819373443


##########
metadata/src/main/java/org/apache/kafka/controller/ReplicationControlManager.java:
##########
@@ -938,9 +938,12 @@ ControllerResult<Map<Uuid, ApiError>> deleteTopics(ControllerRequestContext cont
                 BoundedList.newArrayBacked(MAX_RECORDS_PER_USER_OP, ids.size());
         for (Uuid id : ids) {
             try {
+                log.info("Starting deletion of topic with ID {}.", id);
                 deleteTopic(context, id, records);
                 results.put(id, ApiError.NONE);
+                log.info("Successfully deleted topic with ID {}.", id);
             } catch (ApiException e) {
+                log.error("Failed to delete topic with ID {} due to API exception.", id, e);

Review Comment:
   This isn't an error. It should be at INFO level. But more importantly, shouldn't all the topics deleted in this RPC share a single log message?



##########
metadata/src/main/java/org/apache/kafka/controller/ReplicationControlManager.java:
##########
@@ -956,8 +959,10 @@ void deleteTopic(ControllerRequestContext context, Uuid id, List<ApiMessageAndVe
             throw new UnknownTopicIdException(UNKNOWN_TOPIC_ID.message());
         }
         int numPartitions = topic.parts.size();
+        log.info("Deleting topic {} with ID {} and {} partitions", topic.name, id, numPartitions);

Review Comment:
   This should be at TRACE level since most people don't care.



-- 
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: jira-unsubscribe@kafka.apache.org

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


Re: [PR] MINOR: Add logging to deleteTopic and deleteTopics functions [kafka]

Posted by "cmccabe (via GitHub)" <gi...@apache.org>.
cmccabe commented on code in PR #17617:
URL: https://github.com/apache/kafka/pull/17617#discussion_r1819767656


##########
metadata/src/main/java/org/apache/kafka/controller/ReplicationControlManager.java:
##########
@@ -947,6 +948,7 @@ ControllerResult<Map<Uuid, ApiError>> deleteTopics(ControllerRequestContext cont
                 results.put(id, ApiError.fromThrowable(e));
             }
         }
+        log.info("DeleteTopics result(s): {}", results);

Review Comment:
   Can we do something like we do with create topics, where we build up a string like:
   
   ```DeleteTopics result(s): {id: p7foLAwZT8yDWn_yzHcYlg, name: foo, result:SUCCESS}, {id:EBxjGbySRfO1tmo13ZVUfA, name: bar, result: UNKNOWN_TOPIC_ID}```
   
   



-- 
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: jira-unsubscribe@kafka.apache.org

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


Re: [PR] MINOR: Add logging to deleteTopic and deleteTopics functions [kafka]

Posted by "cmccabe (via GitHub)" <gi...@apache.org>.
cmccabe commented on code in PR #17617:
URL: https://github.com/apache/kafka/pull/17617#discussion_r1825245360


##########
metadata/src/main/java/org/apache/kafka/controller/ReplicationControlManager.java:
##########
@@ -956,8 +978,10 @@ void deleteTopic(ControllerRequestContext context, Uuid id, List<ApiMessageAndVe
             throw new UnknownTopicIdException(UNKNOWN_TOPIC_ID.message());
         }
         int numPartitions = topic.parts.size();
+        log.trace("Deleting topic {} with ID {} and {} partitions", topic.name, id, numPartitions);
         try {
             context.applyPartitionChangeQuota(numPartitions); // check controller mutation quota
+            log.trace("Applied partition change quota for topic {} with ID {}", topic.name, id);

Review Comment:
   Do we know if there's even a quota set here? There might not be. A better message might be "checked for a partition change quota on topic {} with ID {}"



-- 
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: jira-unsubscribe@kafka.apache.org

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


Re: [PR] MINOR: Add logging to deleteTopic and deleteTopics functions [kafka]

Posted by "cmccabe (via GitHub)" <gi...@apache.org>.
cmccabe merged PR #17617:
URL: https://github.com/apache/kafka/pull/17617


-- 
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: jira-unsubscribe@kafka.apache.org

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


Re: [PR] MINOR: Add logging to deleteTopic and deleteTopics functions [kafka]

Posted by "cmccabe (via GitHub)" <gi...@apache.org>.
cmccabe commented on code in PR #17617:
URL: https://github.com/apache/kafka/pull/17617#discussion_r1819372227


##########
metadata/src/main/java/org/apache/kafka/controller/ReplicationControlManager.java:
##########
@@ -938,9 +938,12 @@ ControllerResult<Map<Uuid, ApiError>> deleteTopics(ControllerRequestContext cont
                 BoundedList.newArrayBacked(MAX_RECORDS_PER_USER_OP, ids.size());
         for (Uuid id : ids) {
             try {
+                log.info("Starting deletion of topic with ID {}.", id);

Review Comment:
   This should be at TRACE level since most people don't care.



-- 
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: jira-unsubscribe@kafka.apache.org

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


Re: [PR] MINOR: Add logging to deleteTopic and deleteTopics functions [kafka]

Posted by "cmccabe (via GitHub)" <gi...@apache.org>.
cmccabe commented on code in PR #17617:
URL: https://github.com/apache/kafka/pull/17617#discussion_r1819374210


##########
metadata/src/main/java/org/apache/kafka/controller/ReplicationControlManager.java:
##########
@@ -956,8 +959,10 @@ void deleteTopic(ControllerRequestContext context, Uuid id, List<ApiMessageAndVe
             throw new UnknownTopicIdException(UNKNOWN_TOPIC_ID.message());
         }
         int numPartitions = topic.parts.size();
+        log.info("Deleting topic {} with ID {} and {} partitions", topic.name, id, numPartitions);
         try {
             context.applyPartitionChangeQuota(numPartitions); // check controller mutation quota
+            log.info("Applied partition change quota for topic {} with ID {}", topic.name, id);

Review Comment:
   This should be at TRACE level since most people dont' care



-- 
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: jira-unsubscribe@kafka.apache.org

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