You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2021/06/27 11:55:12 UTC

[GitHub] [kafka] jacky1193610322 commented on a change in pull request #10931: KAFKA-12998: Implement broker-side KRaft snapshots (WIP)

jacky1193610322 commented on a change in pull request #10931:
URL: https://github.com/apache/kafka/pull/10931#discussion_r659292704



##########
File path: metadata/src/main/java/org/apache/kafka/image/TopicsDelta.java
##########
@@ -0,0 +1,165 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kafka.image;
+
+import org.apache.kafka.common.Uuid;
+import org.apache.kafka.common.metadata.PartitionChangeRecord;
+import org.apache.kafka.common.metadata.PartitionRecord;
+import org.apache.kafka.common.metadata.RemoveTopicRecord;
+import org.apache.kafka.common.metadata.TopicRecord;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+
+/**
+ * Represents changes to the topics in the metadata image.
+ */
+public final class TopicsDelta {
+    private final TopicsImage image;
+
+    /**
+     * A map from topic IDs to the topic deltas for each topic. Topics which have been
+     * deleted will not appear in this map.
+     */
+    private final Map<Uuid, TopicDelta> changedTopics = new HashMap<>();
+
+    /**
+     * The IDs of topics that exist in the image but that have been deleted. Note that if
+     * a topic does not exist in the image, it will also not exist in this set. Topics
+     * that are created and then deleted within the same delta will leave no trace.
+     */
+    private final Set<Uuid> deletedTopicIds = new HashSet<>();

Review comment:
       `Topics that are created and then deleted within the same delta will leave no trace.`
   if do this, we will not delete the topic log dir and some other file.
   Maybe we need a timeline, which can compact the partition change event but can't compact the create topic event and delete topic event. I create a jira before. [jira](https://issues.apache.org/jira/browse/KAFKA-12682)




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