Github user pnowojski commented on a diff in the pull request:

    https://github.com/apache/flink/pull/6071#discussion_r191700141
  
    --- Diff: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/NetworkBuffer.java
 ---
    @@ -424,6 +480,19 @@ public int setBytes(int index, ScatteringByteChannel 
in, int length) throws IOEx
                }
        }
     
    +   @Override
    +   public int setBytes(int index, FileChannel in, long position, int 
length) throws IOException {
    +           // adapted from UnpooledDirectByteBuf:
    +           checkIndex(index, length);
    +
    +           ByteBuffer tmpBuf = memorySegment.wrap(index, length);
    +           try {
    +                   return in.read(tmpBuf);
    --- End diff --
    
    ops, good catch. Even better catch is that this was not covered by any 
test, because I assumed `AbstractByteBufTest` comes from netty, while in 
reality it was copied to our code.
    
    Fixed this lack of `position` bug and upgraded the `AbstractByteBufTest` as 
well - newer version was correctly failing with this bug.


---

Reply via email to