AHeise commented on a change in pull request #11507: [FLINK-16587] Add basic CheckpointBarrierHandler for unaligned checkpoint URL: https://github.com/apache/flink/pull/11507#discussion_r404581205
########## File path: flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/serialization/SpillingAdaptiveSpanningRecordDeserializer.java ########## @@ -557,6 +579,28 @@ private void addNextChunkFromMemorySegment(MemorySegment segment, int offset, in } } + @Nullable + MemorySegment copyToTargetSegment() { + // for the case of only partial length, no data + final int position = lengthBuffer.position(); + if (position > 0) { + MemorySegment segment = MemorySegmentFactory.allocateUnpooledSegment(lengthBuffer.remaining()); + segment.put(0, lengthBuffer, lengthBuffer.remaining()); + lengthBuffer.position(position); + return segment; + } + + // for the case of full length, partial data in buffer + if (recordLength != -1) { + // In the PoC we skip the case of large record which size exceeds THRESHOLD_FOR_SPILLING, Review comment: I had an idea, since Roman's `ChannelStateByteBuffer` is reading in chunks of 1024 bytes from the `Buffer(Builder)`, could we create a virtual buffer that spans over all parts? We could even try to evaluate if that is also a proper abstraction to be used instead of `SpillingAdaptiveSpanningRecordDeserializer` in some future PR. ---------------------------------------------------------------- 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 With regards, Apache Git Services