Kafka
  1. Kafka
  2. KAFKA-89

consumer should initialize to a valid offset

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.7
    • Fix Version/s: 0.7
    • Component/s: core
    • Labels:
      None

      Description

      Currently, when a consumer starts up for the very first time, the server will log kafka.common.OffsetOutOfRangeException. To avoid that, the consumer should pick up a valid offset if offset is not available in ZK.

      1. KAFKA-89.v3.patch
        3 kB
        Jun Rao
      2. KAFKA-89.v2.patch
        3 kB
        Jun Rao
      3. KAFKA-89.v1.patch
        3 kB
        Jun Rao

        Activity

        Jun Rao created issue -
        Jun Rao made changes -
        Field Original Value New Value
        Attachment KAFKA-89.v1.patch [ 12498037 ]
        Hide
        Jun Rao added a comment -

        Patch available for review.

        Show
        Jun Rao added a comment - Patch available for review.
        Jun Rao made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Affects Version/s 0.7 [ 12317243 ]
        Hide
        Joel Koshy added a comment -

        The second case should be OffsetRequest.Latest

        Also, the latestOffset val in getEarliestOrLatestOffset would be better renamed to earliestOrLatestOffset.

        Show
        Joel Koshy added a comment - The second case should be OffsetRequest.Latest Also, the latestOffset val in getEarliestOrLatestOffset would be better renamed to earliestOrLatestOffset.
        Hide
        Jun Rao added a comment -

        Good catch. Uploaded v2 patch.

        Show
        Jun Rao added a comment - Good catch. Uploaded v2 patch.
        Jun Rao made changes -
        Attachment KAFKA-89.v2.patch [ 12498051 ]
        Hide
        Neha Narkhede added a comment -

        Also, in the function earliestOrLatestOffset, the variable still says latestOffset. Can you rename it to say earliestOrLatestOffset ?

        Show
        Neha Narkhede added a comment - Also, in the function earliestOrLatestOffset, the variable still says latestOffset. Can you rename it to say earliestOrLatestOffset ?
        Hide
        Jun Rao added a comment -

        Attached v3. Fixed variable name and message in the exception.

        Show
        Jun Rao added a comment - Attached v3. Fixed variable name and message in the exception.
        Jun Rao made changes -
        Attachment KAFKA-89.v3.patch [ 12498054 ]
        Hide
        Joel Koshy added a comment -

        +1

        Looks great.

        Show
        Joel Koshy added a comment - +1 Looks great.
        Hide
        Neha Narkhede added a comment -

        +1.

        Show
        Neha Narkhede added a comment - +1.
        Jun Rao made changes -
        Status Patch Available [ 10002 ] Resolved [ 5 ]
        Assignee Jun Rao [ junrao ]
        Fix Version/s 0.7 [ 12317243 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Jun Rao
            Reporter:
            Jun Rao
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development