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



##########
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:
       Thanks for your reply, it's right if will always keep the delta not 
replay before, which means we must persist the checkpoint offset every commit, 
but now we are not. for example, if the broker crash, we maybe replay the 
latest snapshot and the delta after the snapshot offset, but it may be the 
delta after the snapshot has been replay before. I don't sure it's right? thank 
you.




-- 
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-unsubscr...@kafka.apache.org

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


Reply via email to