[ 
https://issues.apache.org/jira/browse/FLINK-10469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16638378#comment-16638378
 ] 

Yun Gao commented on FLINK-10469:
---------------------------------

I commented on the pull request, but it seems that the comment fails to be 
synchronized here, so I copied it here manually. Sorry if repeat emails are 
received. :)

==================================================================================

This is consistent with what I had in mind. :)

I also checked other calls to WritableByteChannel.write(ByteBuffer), the only 
calls left unchanged are the ones in NetworkBuffer.getBytes() and 
AbstractByteBufTest.write(). I agree not to change them referring to the other 
implementations of ByteBuf in Netty.

For the testing, the existing tests seem to have covered the writeComplete 
method from the upper level scenarios, and do you think it is still necessary 
to add a test for writeComplete itself? We may mock a channel who only writes 
half of a buffer at one time and assert the whole buffer is written in a single 
call to writeComplete.

> FileChannel may not write the whole buffer in a single call to 
> FileChannel.write(Buffer buffer)
> -----------------------------------------------------------------------------------------------
>
>                 Key: FLINK-10469
>                 URL: https://issues.apache.org/jira/browse/FLINK-10469
>             Project: Flink
>          Issue Type: Bug
>          Components: Core, Network
>    Affects Versions: 1.4.1, 1.4.2, 1.5.3, 1.6.0, 1.6.1, 1.7.0, 1.5.4, 1.6.2
>            Reporter: Yun Gao
>            Assignee: Yun Gao
>            Priority: Blocker
>              Labels: pull-request-available
>             Fix For: 1.7.0, 1.6.2, 1.5.5
>
>
> Currently all the calls to _FileChannel.write(ByteBuffer src)_ assumes that 
> this method will not return before the whole buffer is written, like the one 
> in _AsynchronousFileIOChannel.write()._
>  
> However, this assumption may not be right for all the environments. We have 
> encountered the case that only part of a buffer was written on a cluster with 
> a high IO load, and the target file got messy. 
>  
> To fix this issue, I think we should add a utility method in the 
> org.apache.flink.util.IOUtils to ensure the whole buffer is written with a 
> loop,and replace all the calls to _FileChannel.write(ByteBuffer)_ with this 
> new method. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to