dengziming commented on a change in pull request #9819:
URL: https://github.com/apache/kafka/pull/9819#discussion_r562516704



##########
File path: 
raft/src/main/java/org/apache/kafka/snapshot/FileRawSnapshotWriter.java
##########
@@ -53,13 +54,13 @@ public long sizeInBytes() throws IOException {
     }
 
     @Override
-    public void append(ByteBuffer buffer) throws IOException {
+    public void append(MemoryRecords records) throws IOException {

Review comment:
       This will be more clear and got 3 little problems when I tried:
   1. `Readable.readRecords` still returns a `MemoryRecords` and we need to 
convert it to `UnalignedMemoryRecords`, this is simple
   2. We need to implement `UnalignedFileRecords.toSend` which need to return 
RecordSend, but this is unreasonable, I added a `FileChannelSend` similar to 
`ByteBufferSend` to solve this problem
   3. We should still use `UnalignedMemoryRecords` in `FileRawSnapshotWriter` 
so we don't restore symmetry
   
   @hachikuji @jsancio ,I think my implementation is not the perfect one, 
please take a look to see whether we could make some improvement, thank you.




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