MarcoLotz opened a new pull request #10091:
URL: https://github.com/apache/kafka/pull/10091


   **Reproducing:**
   The bug can be easily reproduced for any TimeWindow where window + grace 
period > 1 day. Changing any test in TimeWindowedKStreamImplTest.java for this 
condition will reproduce the bug.
   
   **Cause:**
   The root cause is that .grace(...) never updates the default 
maintainDurationMs field value. The value is thus always 1 day - throwing the 
IllegalArgumentException when validating it at a later stage.
   
   **Implementation comments:**
   I believe that a minimum retention period of 1 day is desired because of log 
compaction - thus I used the Math.Max(window+grace, default 
maintainDurationMs-1 day-) to calculate the minimum retention period.
   
   I am a bit unsure about the test - currently it indirectly tests the bug. 
The bug would throw a IllegalArgumentException, preventing the test scenario 
from working with any aggregation (count, reduce, etc). I've implemented the 
test with count operation to ensure consistency of the window behaviour. If 
this is not required, maybe just calling processData() and asserting that the 
original reported exception is not thrown should be enough. 
   
   ### 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.

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


Reply via email to