OneSizeFitsQuorum commented on code in PR #13059:
URL: https://github.com/apache/iotdb/pull/13059#discussion_r1696283026
##########
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/wal/compression/WALCompressionTest.java:
##########
@@ -162,6 +162,38 @@ public void testSkipToGivenPosition()
}
}
+ @Test
+ public void testWALInputStreamReadByteBufferInDifferentSegment()
+ throws QueryProcessException, IllegalPathException, IOException {
+ LogWriter writer = new WALWriter(walFile);
+ List<Pair<Long, Integer>> positionAndEntryPairList = new ArrayList<>();
+ int memTableId = 0;
+ long fileOffset = 0;
+ ByteBuffer buffer = ByteBuffer.allocate(1024 * 4);
+ InsertRowNode insertRowNode = WALTestUtils.getInsertRowNode(devicePath +
memTableId, 0);
+ for (int i = 0; i < 2; i++) {
+ insertRowNode.serialize(buffer);
+ positionAndEntryPairList.add(new Pair<>(fileOffset, buffer.position()));
+ fileOffset += buffer.position();
+ writer.write(buffer);
+ buffer.clear();
+ }
+ writer.close();
+
+ try (WALInputStream stream = new WALInputStream(walFile)) {
+ stream.skipToGivenLogicalPosition(positionAndEntryPairList.get(0).left);
+ ByteBuffer buffer1 =
Review Comment:
Smark test!
##########
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/wal/compression/WALCompressionTest.java:
##########
@@ -162,6 +162,38 @@ public void testSkipToGivenPosition()
}
}
+ @Test
+ public void testWALInputStreamReadByteBufferInDifferentSegment()
+ throws QueryProcessException, IllegalPathException, IOException {
+ LogWriter writer = new WALWriter(walFile);
+ List<Pair<Long, Integer>> positionAndEntryPairList = new ArrayList<>();
+ int memTableId = 0;
+ long fileOffset = 0;
+ ByteBuffer buffer = ByteBuffer.allocate(1024 * 4);
+ InsertRowNode insertRowNode = WALTestUtils.getInsertRowNode(devicePath +
memTableId, 0);
+ for (int i = 0; i < 2; i++) {
+ insertRowNode.serialize(buffer);
+ positionAndEntryPairList.add(new Pair<>(fileOffset, buffer.position()));
+ fileOffset += buffer.position();
+ writer.write(buffer);
+ buffer.clear();
+ }
+ writer.close();
+
+ try (WALInputStream stream = new WALInputStream(walFile)) {
+ stream.skipToGivenLogicalPosition(positionAndEntryPairList.get(0).left);
+ ByteBuffer buffer1 =
Review Comment:
Smark test!
--
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]