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

MockConsumer#endOffsets should be idempotent

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • None
    • None
    • None

    Description

          private Long getEndOffset(List<Long> offsets) {
              if (offsets == null || offsets.isEmpty()) {
                  return null;
              }
              return offsets.size() > 1 ? offsets.remove(0) : offsets.get(0);
          }
      

      The above code has two issues.
      1. It does not return the latest offset since the latest offset is at the end of offsets
      1. It removes the element from offsets so MockConsumer#endOffsets gets non-idempotent

      Attachments

        Issue Links

          Activity

            People

              chia7712 Chia-Ping Tsai
              chia7712 Chia-Ping Tsai
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: