jeqo commented on code in PR #13561:
URL: https://github.com/apache/kafka/pull/13561#discussion_r1246792402
##########
core/src/main/scala/kafka/log/UnifiedLog.scala:
##########
@@ -147,11 +147,15 @@ class UnifiedLog(@volatile var logStartOffset: Long,
def localLogStartOffset(): Long = _localLogStartOffset
+ // This is the offset(inclusive) until which segments are copied to the
remote storage.
@volatile private var highestOffsetInRemoteStorage: Long = -1L
locally {
initializePartitionMetadata()
updateLogStartOffset(logStartOffset)
+ updateLocalLogStartOffset(math.max(logStartOffset,
localLog.segments.firstSegmentBaseOffset.getOrElse(0L)))
+ if (!remoteLogEnabled())
+ logStartOffset = localLogStartOffset()
maybeIncrementFirstUnstableOffset()
Review Comment:
I also find it strange to repeat the mutations of HWM and local log recovery
point in both updates, we can pull those two updates into a single method and
call it once?
##########
core/src/main/scala/kafka/log/UnifiedLog.scala:
##########
@@ -945,13 +976,19 @@ class UnifiedLog(@volatile var logStartOffset: Long,
localLog.checkIfMemoryMappedBufferClosed()
if (newLogStartOffset > logStartOffset) {
- updatedLogStartOffset = true
- updateLogStartOffset(newLogStartOffset)
- _localLogStartOffset = newLogStartOffset
- info(s"Incremented log start offset to $newLogStartOffset due to
$reason")
- leaderEpochCache.foreach(_.truncateFromStart(logStartOffset))
- producerStateManager.onLogStartOffsetIncremented(newLogStartOffset)
- maybeIncrementFirstUnstableOffset()
+ _localLogStartOffset = math.max(newLogStartOffset,
localLogStartOffset())
+
+ // it should always get updated if tiered-storage is not enabled.
+ if (!onlyLocalLogStartOffsetUpdate || !remoteLogEnabled()) {
+ updatedLogStartOffset = true
+ updateLogStartOffset(newLogStartOffset)
Review Comment:
is it correct to update localLogStartOffset directly, but use
updateLogStartOffset method to also update related values (HWM and local log
recovery)?
--
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]