[GitHub] [kafka] showuon commented on a diff in pull request #13304: KAFKA-14726 Move/rewrite of LogReadInfo, LogOffsetSnapshot, LogStartOffsetIncrementReason to storage module

2023-02-25 Thread via GitHub


showuon commented on code in PR #13304:
URL: https://github.com/apache/kafka/pull/13304#discussion_r1118032062


##
core/src/main/scala/kafka/raft/KafkaMetadataLog.scala:
##
@@ -202,7 +202,7 @@ final class KafkaMetadataLog private (
   }
 
   override def highWatermark: LogOffsetMetadata = {
-val LogOffsetSnapshot(_, _, hwm, _) = log.fetchOffsetSnapshot
+val hwm = log.fetchOffsetSnapshot.highWatermark

Review Comment:
   nice refactor!



##
core/src/main/scala/kafka/log/UnifiedLog.scala:
##
@@ -1112,7 +1079,8 @@ class UnifiedLog(@volatile var logStartOffset: Long,
 
 new LogAppendInfo(firstOffset, lastOffset, lastLeaderEpochOpt, 
maxTimestamp, offsetOfMaxTimestamp,
   RecordBatch.NO_TIMESTAMP, logStartOffset, RecordConversionStats.EMPTY, 
sourceCompression, targetCompression,
-  shallowMessageCount, validBytesCount, monotonic, lastOffsetOfFirstBatch)
+  shallowMessageCount, validBytesCount, monotonic, lastOffsetOfFirstBatch, 
Collections.emptyList[RecordError], null,
+  LeaderHwChange.NONE)

Review Comment:
   Why do we need to explicitly set default value here?



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



[GitHub] [kafka] showuon commented on a diff in pull request #13304: KAFKA-14726 Move/rewrite of LogReadInfo, LogOffsetSnapshot, LogStartOffsetIncrementReason to storage module

2023-02-25 Thread via GitHub


showuon commented on code in PR #13304:
URL: https://github.com/apache/kafka/pull/13304#discussion_r1118031367


##
storage/src/main/java/org/apache/kafka/storage/internals/log/LogReadInfo.java:
##
@@ -0,0 +1,60 @@
+/*
+ * 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.storage.internals.log;
+
+import org.apache.kafka.common.message.FetchResponseData;
+
+import java.util.Optional;
+
+/**
+ * Structure used for lower level reads using  
[[kafka.cluster.Partition.fetchRecords()]].

Review Comment:
   The java doc needs to be updated to java style with `@link` 



##
storage/src/main/java/org/apache/kafka/storage/internals/log/LogStartOffsetIncrementReason.java:
##
@@ -0,0 +1,37 @@
+/*
+ * 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.storage.internals.log;
+
+public enum LogStartOffsetIncrementReason {
+LeaderOffsetIncremented("leader offset increment"),
+SegmentDeletion("segment deletion"),
+ClientRecordDeletion("client delete records request"),
+SnapshotGenerated("snapshot generated");
+
+private final String value;

Review Comment:
   nit: rename the `value` to a meaningful name, ex: `reason`?



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