THUMarkLau commented on code in PR #12476:
URL: https://github.com/apache/iotdb/pull/12476#discussion_r1632198623
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/utils/WALEntryPosition.java:
##########
@@ -100,11 +101,11 @@ ByteBuffer read() throws IOException {
if (!canRead()) {
throw new IOException("Target file hasn't been specified.");
}
- try (FileChannel channel = openReadFileChannel()) {
+ try (WALInputStream is = openReadFileStream()) {
+ is.skipToGivenPosition(position);
ByteBuffer buffer = ByteBuffer.allocate(size);
- channel.position(position);
- channel.read(buffer);
- buffer.clear();
+ is.read(buffer);
+ buffer.flip();
return buffer;
}
Review Comment:
My response is the same as in the previous comments: this is how the
original design was implemented. I just made slight modifications to make it
suitable for compressed cases. Theoretically, the performance is similar to the
original since the original design involved opening a Channel, and a
WALInputStream essentially operates as a Channel. Sharing the Stream is a
reasonable suggestion, but it is unrelated to the current task (Write Ahead Log
compression) and may introduce other bugs and performance issues, so I will not
be modifying this part of the code.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]