showuon opened a new pull request #11337:
URL: https://github.com/apache/kafka/pull/11337


   JIRA is [here](https://issues.apache.org/jira/browse/KAFKA-13309).
   In https://github.com/apache/kafka/pull/9139, we added backward iterator on 
SessionStore. But there is a bug that  when fetch/backwardFetch the key range, 
if there are multiple records in the same session window, we can't return the 
data in the correct order.
   
   For example:
   We have a session window inactivity gap with 10 ms, and the records:
   
   key: "A", value: "AA", timestamp: 0 --> with SessionWindow(0, 0)
   key: "B", value: "BB", timestamp: 0 --> with SessionWindow(0, 0)
   key: "C", value: "CC", timestamp: 0 --> with SessionWindow(0, 0)
   key: "D" value: "DD", timestamp: 100 --> with SessionWindow(100, 100)
   
   So, when fetch("A" /*key from*/, "D" /*key to*/), we expected to have [A, B, 
C, D], but we'll have [C, B A, D ]
   
   And the reason is that we pass "false" in the "is forward" parameter for 
`fetch` method, and "true" for "backwardFetch" method, which obviously is wrong.
   
   So, why does the tests can't find this issue? 
   It's because the test data we provided doesn't have multiple data in the 
same session window. 
   
   In this PR, I fixed the issue, and add tests to improve the test coverage.
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to