Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-1093

Log.getOffsetsBefore(t, …) does not return the last confirmed offset before t

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Invalid
    • Affects Version/s: 0.8.0
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Let's say there are three log segments s1, s2, s3.

      In Log.getoffsetsBefore(t, …), the offsetTimeArray will look like - [(s1.start, s1.lastModified), (s2.start, s2.lastModified), (s3.start, s3.lastModified), (logEndOffset, currentTimeMs)].

      Let's say s2.lastModified < t < s3.lastModified. getOffsetsBefore(t, 1) will return Seq(s2.start).

      However, we already know s3.firstAppendTime (s3.created in trunk). So, if s3.firstAppendTime < t < s3.lastModified, we should rather return s3.start.

      This also resolves another bug wherein the log has only one segment and getOffsetsBefore() returns an empty Seq if the timestamp provided is less than the lastModified of the only segment. We should rather return the startOffset of the segment if the timestamp is greater than the firstAppendTime of the segment.

      1. KAFKA-1093.patch
        0.9 kB
        Swapnil Ghike

        Activity

        Hide
        omkreddy Manikumar added a comment -

        relavent part of the code is not available now. So closing this now.

        Show
        omkreddy Manikumar added a comment - relavent part of the code is not available now. So closing this now.
        Hide
        swapnilghike Swapnil Ghike added a comment -
        Show
        swapnilghike Swapnil Ghike added a comment - Created reviewboard https://reviews.apache.org/r/14771/

          People

          • Assignee:
            swapnilghike Swapnil Ghike
            Reporter:
            swapnilghike Swapnil Ghike
          • Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development