You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "clolov (via GitHub)" <gi...@apache.org> on 2023/12/19 16:08:41 UTC

[PR] Implement RemoteLogSizeBytes [kafka]

clolov opened a new pull request, #15050:
URL: https://github.com/apache/kafka/pull/15050

   The pull request should be rebased once https://github.com/apache/kafka/pull/15005 and https://github.com/apache/kafka/pull/15026 are merged
   
   This pull request aims to implement RemoteLogSizeBytes from [KIP-963](https://cwiki.apache.org/confluence/display/KAFKA/KIP-963%3A+Additional+metrics+in+Tiered+Storage).


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


Re: [PR] Implement RemoteLogSizeBytes [kafka]

Posted by "kamalcph (via GitHub)" <gi...@apache.org>.
kamalcph commented on code in PR #15050:
URL: https://github.com/apache/kafka/pull/15050#discussion_r1432252882


##########
core/src/main/scala/kafka/log/UnifiedLog.scala:
##########
@@ -1585,6 +1585,12 @@ class UnifiedLog(@volatile var logStartOffset: Long,
   def onlyLocalLogSegmentsSize: Long =
     UnifiedLog.sizeInBytes(logSegments.stream.filter(_.baseOffset >= highestOffsetInRemoteStorage).collect(Collectors.toList[LogSegment]))
 
+  /**
+   * The log size in bytes for all segments that are only in remote log.
+   */
+  def onlyRemoteLogSegmentsSize: Long =
+    UnifiedLog.sizeInBytes(logSegments.stream.filter(_.baseOffset < highestOffsetInRemoteStorage).collect(Collectors.toList[LogSegment]))

Review Comment:
   The `logSegments` points to the local-log segments, we cannot calculate the size of remote-only-log-segments from 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-unsubscribe@kafka.apache.org

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


Re: [PR] KAFKA-16014: Implement RemoteLogSizeBytes [kafka]

Posted by "showuon (via GitHub)" <gi...@apache.org>.
showuon merged PR #15050:
URL: https://github.com/apache/kafka/pull/15050


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


Re: [PR] Implement RemoteLogSizeBytes [kafka]

Posted by "showuon (via GitHub)" <gi...@apache.org>.
showuon commented on code in PR #15050:
URL: https://github.com/apache/kafka/pull/15050#discussion_r1432303423


##########
core/src/main/scala/kafka/log/UnifiedLog.scala:
##########
@@ -1585,6 +1585,12 @@ class UnifiedLog(@volatile var logStartOffset: Long,
   def onlyLocalLogSegmentsSize: Long =
     UnifiedLog.sizeInBytes(logSegments.stream.filter(_.baseOffset >= highestOffsetInRemoteStorage).collect(Collectors.toList[LogSegment]))
 
+  /**
+   * The log size in bytes for all segments that are only in remote log.
+   */
+  def onlyRemoteLogSegmentsSize: Long =
+    UnifiedLog.sizeInBytes(logSegments.stream.filter(_.baseOffset < highestOffsetInRemoteStorage).collect(Collectors.toList[LogSegment]))

Review Comment:
   We can calculate the size of remote-only-log-segments from remote log metadata (i.e. `RemoteLogSegmentMetadata#segmentSizeInBytes`). So I think we can record the size at the same place I did for remoteLogMetadataCount [here](https://github.com/apache/kafka/pull/15026/files#diff-380e4d8859ea9148f21794c09039425c82d9012a392c2dbbe1ce2ec8677a1970R1005). 



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


Re: [PR] Implement RemoteLogSizeBytes [kafka]

Posted by "kamalcph (via GitHub)" <gi...@apache.org>.
kamalcph commented on code in PR #15050:
URL: https://github.com/apache/kafka/pull/15050#discussion_r1432837641


##########
core/src/main/scala/kafka/server/KafkaRequestHandler.scala:
##########
@@ -426,6 +427,18 @@ class BrokerTopicMetrics(name: Option[String], configOpt: java.util.Optional[Kaf
 
   def remoteLogMetadataCount: Long = metricGaugeTypeMap.get(RemoteStorageMetrics.REMOTE_LOG_METADATA_COUNT_METRIC.getName).brokerTopicAggregatedMetric.value()
 
+  def recordRemoteLogSizeBytes(partition: Int, bytesLag: Long): Unit = {

Review Comment:
   rename `bytesLag` to `size` (or) something similar



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


Re: [PR] KAFKA-16014: Implement RemoteLogSizeBytes [kafka]

Posted by "showuon (via GitHub)" <gi...@apache.org>.
showuon commented on PR #15050:
URL: https://github.com/apache/kafka/pull/15050#issuecomment-1867309312

   Had run twice CI and failed tests are unrelated.


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