lidavidm opened a new pull request #9421:
URL: https://github.com/apache/arrow/pull/9421


   A user reported that in the write path in Flight/Java, we were still copying 
data instead of zero-copying it to the network. An initial patch was reverted 
because it had a use-after-free of a Netty buffer, which crashed the JVM in a 
test when Netty/gRPC used Unsafe. A second patch was reverted because we 
realized that this optimization is not safe to enable in general: gRPC buffers 
data before writing it to the network, so Flight applications that wish to use 
the zero-copy optimization must not overwrite that buffer before gRPC writes 
it. This patch reworks the earlier patches such that:
   1. The zero-copy read and zero-copy write are controlled by separate flags 
that can be toggled, and
   2. The zero-copy write can be toggled by the application on a per-call basis.
   (Note that the zero-copy read optimization was always enabled and working, 
but in earlier PRs, it shared a flag with the zero-copy write optimization.)
   This PR also adds a test and updates the benchmark to opt in to the 
zero-copy optimization explicitly at runtime.


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to