Kalvin2077 commented on code in PR #3809:
URL: https://github.com/apache/celeborn/pull/3809#discussion_r3850269320
##########
worker/src/main/scala/org/apache/celeborn/service/deploy/worker/storage/TierWriter.scala:
##########
@@ -88,6 +88,32 @@ abstract class TierWriterBase(
protected def writeInternal(buf: ByteBuf): Unit
+ protected def accountAddedBytes(numBytes: Int): Unit
+
+ protected def appendToFlushBuffer(buf: ByteBuf): Unit = {
+ val numBytes = buf.readableBytes()
+ val writerIndexBefore = flushBuffer.writerIndex()
+ val numComponentsBefore = flushBuffer.numComponents()
+ buf.retain()
+ try {
+ flushBuffer.addComponent(true, buf)
+ } catch {
+ case t: Throwable =>
+ // addComponent can fail after taking ownership while consolidating
components.
+ val componentAdded =
+ flushBuffer.writerIndex() != writerIndexBefore ||
+ flushBuffer.numComponents() != numComponentsBefore
+ if (componentAdded) {
+ accountAddedBytes(numBytes)
+ }
+ logError(
+ s"Failed to add $numBytes bytes to flush buffer for shuffle
$shuffleKey file $filename.",
+ t)
+ throw t
+ }
+ accountAddedBytes(numBytes)
+ }
Review Comment:
Netty 4.2.17 already releases the buffer when insertion fails before
ownership transfer. Releasing again in Celeborn would consume the caller’s
reference. See addComponent0.
--
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]