Skip to content

The problem of new consumer with 'CONSUME_FROM_LAST_OFFSET' model #1135

@baomingyu

Description

@baomingyu

  When i create consumer using a new consumer group with 'CONSUME_FROM_LAST_OFFSET'
model and subscribe a topic that has been created and has contained messages ,it will
consumer all exit messages rather than begin from last offset.

   I have found this problem is here .RebalancePushImpl.java -- > computePullFromWhere

   case CONSUME_FROM_LAST_OFFSET

  when user new consumer group the result will be 0 rather than last offset or max offset ,
because broker will allways not do return -1 .
  so it will be modified with such way

   if (lastOffset > 0) {
                 result = lastOffset;
             }
             // First start,no offset
             else if (0 == lastOffset) {
             ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions