Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

As per the Tiered Storage feature introduced in KIP-405, the follower fetch protocol was modified for topics enabled with tiered storage. For such topics, the follower finds the offset and leader epoch, up to which the auxiliary state (i.e. leader epoch sequence, producer snapshot state) needs to be built from the leader. The follower then starts fetching the data from the leader starting from that offset. In the KIP, it was decided to use the local-log-start-offset as the offset for this purpose. Instead of the local-log-start-offset, we could also last-tiered-offset which would help the followers quickly catch up with the leader as it only needs to fetch the followers that are not moved to tiered storage. The disadvantage of using the last-tiered-offset is that this new follower would possess only a limited number of locally stored segments. Should it ascend to the role of leader, there is a risk of needing to fetch these segments from remote locations, potentially impacting broker performance.

...

Let us quicky look at the current follower fetch protocol. An empty The follower does the following:

  • It starts with Fetch-Offset as 0 and requests data from this offset from the leaderthe leader, beginning from its Fetch-Offset 
    • If the follower is empty, the Fetch-Offset is zero.
  • The requested offset may or may not be a valid offset on the leader
    • Case 1: The requested offset is present on the leader
      • Leader responds with the data to the follower
      • Follower receives the data, appends records to the local disk, updates its Log-End-Offset and its Fetch-Offset
      • Follower requests data beginning from the new fetch offset
    • Case 2: The requested offset is not present on the leader. There are two possible scenarios here:
      • Case 2.1: The requested offset is lower than the earliest offset the leader knows
        • Leader response with OFFSET_OUT_OF_RANGE error
        • Follower fetches the earliest offset on the leader (Log-Start-Offset)
        • Follower updates its offsets
          • Log-Start-Offset → leader's Log-Start-Offset
          • Log-End-Offset → leader's Log-Start-Offset
          • Fetch-Offset → leader's Log-Start-Offset
        • Follower requests data from the new fetch offset.
      • Case 2.2: The requested offset is greater than or equal to the earliest offset the leader knows, but the offset has moved to tiered storage.
        • Leader responds with OFFSET_MOVED_TO_TIERED_STORAGE error (also returns its Log-Start-Offset)
        • Follower fetches the leader's Local-Log-Start-Offset
        • Follower builds the remote log auxiliary states for the leader offsets in the range [Log-Start-Offset,  Local-Log-Start-Offset]
        • Follower updates its offsets
          • Log-Start-Offset → Leader's Log-Start-Offset
          • Log-End-Offset → Leader's Local-Log-Start-Offset
          • Fetch-Offset → Leader's Local-Log-Start-Offset
        • Follower requests data from the new fetch offset.

...