Savonitar commented on PR #28920: URL: https://github.com/apache/flink/pull/28920#issuecomment-5207432800
@1996fanrui thanks for the questions and feedback. > Two questions: > The gate now closes while capacity is still unused, so a cycle always emits less than capacityPerCycle and never reaches it — with capacityPerCycle=100 and 6 events per request, every cycle stops at 96. 1. Yes, it undershoots now instead of overshooting, but isn't that the direction a rate limiter should err in? With capacityPerCycle=100, a single acquire(1000) was granted immediately and in full before this PR, because `100 <= 0` is false. Also, doesn't it seem strange to use negative value for capacity(which can happen in pre-PR code)? > A single request larger than the cycle capacity still exceeds it: with capacityPerCycle=100 and acquire(10000), the first cycle emits nothing and then every following checkpoint releases the whole 10000, since notifyCheckpointComplete resets capacityLeft and drops the negative balance. 2.That one is pre-existing, not introduced here: before the PR it produced [10000, 10000, ...], now it produces [0, 10000, ...]. So this is an iterative improvement rather than a complete fix, a strict cap would need a redesign. This PR fixes three separate things: the gate, an NPE when a checkpoint completes before the first acquire(), and a missing argument check. I'm happy to drop the gate change and keep the overshoot if you think that's better by design. WDYT? -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
