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

Unable to fetch elements from WindowStore when timestamp is before the first inserted Elem timestamp

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 0.10.2.1
    • None
    • streams
    • None

    Description

      I am unable to fetch elements that are inserted with a timestamp before the timestamp of the first element inserted into a WindowStore.

      This affects newly created WindowStores or one that is restored from a changelog topic.

      The method I use to insert into the Window Store is

      http://docs.confluent.io/3.2.1/streams/javadocs/org/apache/kafka/streams/state/WindowStore.html#put-K-V-long-

      Looking into the code, the issue might be with how the minSegmentId is being calculated here.

      https://github.com/apache/kafka/blob/trunk/streams/src/main/java/org/apache/kafka/streams/state/internals/Segments.java#L88

      Something like the below fixes the issue with regards to the WindowStore but I am not sure what the implications would be for Streams as a whole.

      if (minSegmentId == Long.MAX_VALUE) {
      minSegmentId = maxSegmentId;
      } else {
      minSegmentId = segmentId < minSegmentId ? segmentId : minSegmentId;
      }

      Attachments

        Activity

          People

            Unassigned Unassigned
            jeetu.bethina Jeetu Bethina
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: