chia7712 commented on code in PR #22873:
URL: https://github.com/apache/kafka/pull/22873#discussion_r3912215351


##########
storage/src/main/java/org/apache/kafka/storage/internals/log/UnifiedLog.java:
##########
@@ -2005,10 +2005,16 @@ private int deleteRetentionMsBreachedSegments() throws 
IOException {
         long startMs = time().milliseconds();
 
         DeletionCondition shouldDelete = (segment, nextSegmentOpt) -> {
-            if (startMs < segment.largestTimestamp()) {
-                futureTimestampLogger.warn("{} contains future timestamp(s), 
making it ineligible to be deleted", segment);
+            long anchorTimestamp = segment.largestTimestamp();
+            if (startMs < anchorTimestamp) {
+                if (remoteLogEnabledAndRemoteCopyEnabled() && 
segment.largestRecordTimestamp().isPresent()) {

Review Comment:
   It seems `segment.largestRecordTimestamp().isPresent()` is redundant, right? 
When it's empty, `largestTimestamp()` already returns `lastModified()`, so the 
result is the same with or without it :)



##########
storage/src/main/java/org/apache/kafka/storage/internals/log/UnifiedLog.java:
##########


Review Comment:
   This log message hasn't heard about the PR yet :)



##########
storage/src/test/java/org/apache/kafka/tiered/storage/integration/DeleteSegmentsTest.java:
##########
@@ -104,19 +107,23 @@ private static void 
executeDeleteSegmentsTest(ClusterInstance clusterInstance,
                 .expectSegmentToBeOffloaded(broker0, topicA, p0, 2, new 
KeyValueSpec("k2", "v2"))
                 .expectEarliestLocalOffsetInLogDirectory(topicA, p0, 3L)
                 .produceWithTimestamp(topicA, p0, new KeyValueSpec("k0", 
"v0"), new KeyValueSpec("k1", "v1"),
-                        // testDeleteSegmentsByRetentionTime* uses a tiny 
retention time, which could cause the active
-                        // segment to be rolled and deleted. We use a future 
timestamp to prevent that from happening.

Review Comment:
   Would you mind adding the new behavior instead of removing previous comments?



##########
storage/src/test/java/org/apache/kafka/tiered/storage/actions/WaitForEarliestLocalOffsetAction.java:
##########
@@ -0,0 +1,55 @@
+/*
+ * 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.tiered.storage.actions;
+
+import org.apache.kafka.common.TopicPartition;
+import org.apache.kafka.tiered.storage.TieredStorageTestAction;
+import org.apache.kafka.tiered.storage.TieredStorageTestContext;
+import org.apache.kafka.tiered.storage.utils.BrokerLocalStorage;
+
+import java.io.PrintStream;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+
+public final class WaitForEarliestLocalOffsetAction implements 
TieredStorageTestAction {
+
+    private final TopicPartition topicPartition;
+    private final Long earliestLocalOffset;
+
+    public WaitForEarliestLocalOffsetAction(TopicPartition topicPartition,
+                                            Long earliestLocalOffset) {

Review Comment:
   `long`



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

Reply via email to