You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "kevin-wu24 (via GitHub)" <gi...@apache.org> on 2025/08/26 17:46:06 UTC
Re: [PR] KAFKA-19497 Topic replay code does not handle creation and deletion properly if it occurs in the same batch [kafka]
kevin-wu24 commented on code in PR #20242:
URL: https://github.com/apache/kafka/pull/20242#discussion_r2301695264
##########
metadata/src/main/java/org/apache/kafka/image/TopicsDelta.java:
##########
@@ -136,6 +136,7 @@ public String replay(RemoveTopicRecord record) {
String topicName;
if (topicDelta != null) {
topicName = topicDelta.image().name();
+ createdTopics.remove(topicName);
Review Comment:
Apologies, this previous comment is incorrect. If a `TopicRecord` and `RemoveTopicRecord` are ever replayed in the same delta for a topic with ID = X before `apply()` is called, ID X should not be present in `deletedTopicIds`, since it doesn't exist in the previous `image` or in the current `changedTopics` after being removed on L135 (it would throw an exception in apply()). It is sufficient to remove it from the `createdTopics` map.
--
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