squah-confluent commented on code in PR #20847:
URL: https://github.com/apache/kafka/pull/20847#discussion_r2513894442
##########
clients/src/main/java/org/apache/kafka/common/utils/BufferSupplier.java:
##########
@@ -58,6 +63,11 @@ public static BufferSupplier create() {
*/
public abstract void release(ByteBuffer buffer);
+ /**
+ * Return total size in bytes of cached buffers.
+ */
+ public abstract long size();
Review Comment:
Thanks for updating the PR!
Avoiding locks is the right thing to do but the fixes do not look complete.
* The `ArrayDeque`s within `DefaultSupplier` suffer from the same visibility
issue as `cachedBuffer`.
* The first read of `cachedBuffer` within `GrowableBufferSupplier.size` can
be non-`null` while the second read can be `null`.
Instead I would propose we introduce a size `AtomicLong` and update them in
`get` and `release`.
--
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]