jeffkbkim commented on code in PR #14885:
URL: https://github.com/apache/kafka/pull/14885#discussion_r1412575325
##########
core/src/main/scala/kafka/coordinator/group/CoordinatorPartitionWriter.scala:
##########
@@ -66,6 +65,10 @@ class CoordinatorPartitionWriter[T](
compressionType: CompressionType,
time: Time
) extends PartitionWriter[T] {
+ private val threadLocalBufferSupplier = ThreadLocal.withInitial(
+ () => new BufferSupplier.GrowableBufferSupplier()
+ )
Review Comment:
some general questions for my understanding:
1. We are introducing a buffer supplier so that we can reuse the same buffer
and not reallocate a new buffer each time.
2. It's a growable buffer supplier since maxBatchSize may change on
subsequent append()
3. we're adding a try-finally block to always clear the buffer in the case
of exceptions. this was not needed previously since we were not using a buffer
supplier
4. it's a thread local supplier because we don't want the buffer to be
reused across different threads - i don't think i fully understand the
repercussions
is 1-3 correct? 4 is the actual question. thanks!
--
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]