reswqa commented on PR #22084:
URL: https://github.com/apache/flink/pull/22084#issuecomment-1482982621
Thanks @akalash and @1996fanrui for the review.
> Is there an easy way to check that we allocate an overdraft buffer only
when isRequestedSizeReached? I mean we can create test version of
networkBufferPool to check this
The main reasons why I don't think there's an easy way are:
- `NetworkBufferPool` does not distinguish between `overdraft` and
`non-overdraft` buffers request.
- `NetworkBufferPool` itself is not an interface, it is not easy to make a
very beautiful mock for it (i.e. `TestingNetworkBufferPool`), of course it can
also be done through inheritance, but this will make our test still partly
dependent on its implementation.
One solution I can think of is: we keep requesting and returning buffers
until there are `currentPoolSize` buffers in `availableMemorySegment`. Next, we
intercept the `requestPooledMemorySegment` method of the test version
of `NetworkBufferPool` and keep requesting buffers. Then we check that this
method will be called only `isRequestedSizeReached()` is satisfied. Is this
really necessary compared to the complexity? The tests introduced in this PR
already cover this part, at least to some extent.
Perhaps it is enough if we can adding more checks for tests like
`testDecreasePoolSize` to ensure that the condition must be met before
requesting the overdraft buffer. 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]