THUMarkLau commented on code in PR #12476:
URL: https://github.com/apache/iotdb/pull/12476#discussion_r1630743958


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/io/WALInputStream.java:
##########
@@ -250,10 +250,14 @@ public void skipToGivenPosition(long pos) throws 
IOException {
         buffer.clear();
         channel.read(buffer);
         buffer.flip();
-        buffer.get();
+        CompressionType type = CompressionType.deserialize(buffer.get());
         currSegmentSize = buffer.getInt();
         if (posRemain >= currSegmentSize) {
           posRemain -= currSegmentSize;
+          channel.position(
+              channel.position()
+                  + currSegmentSize
+                  + (type == CompressionType.UNCOMPRESSED ? 0 : 
Integer.BYTES));

Review Comment:
   No. posRemain is a logical size, not a physical size. It represents the 
offset of the WAL before compression, so you only need to subtract the 
originalSegmentSize.



-- 
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: reviews-unsubscr...@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to