jojochuang commented on code in PR #5662:
URL: https://github.com/apache/ozone/pull/5662#discussion_r1454844418


##########
hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/impl/TestBlockManagerImpl.java:
##########
@@ -225,4 +230,173 @@ public void testListBlock() throws Exception {
     assertNotNull(listBlockData);
     assertTrue(listBlockData.size() == 10);
   }
+
+  private BlockData createBlockData(long containerID, long blockNo,
+      int chunkID, long begining, long offset, long len, long bcsID)
+      throws IOException {
+    blockID1 = new BlockID(containerID, blockNo);
+    blockData = new BlockData(blockID1);
+    List<ContainerProtos.ChunkInfo> chunkList1 = new ArrayList<>();
+    ChunkInfo info1 = new ChunkInfo(String.format("%d_chunk_%d", blockID1
+        .getLocalID(), chunkID), offset, len);
+    chunkList1.add(info1.getProtoBufMessage());
+    blockData.setChunks(chunkList1);
+    blockData.setBlockCommitSequenceId(bcsID);
+    blockData.addMetadata(INCREMENTAL_CHUNK_LIST, "");
+
+    return blockData;
+  }
+
+  private BlockData createBlockDataWithOneFullChunk(long containerID,
+      long blockNo, int chunkID, long begining, long offset, long len,
+      long bcsID)
+      throws IOException {
+    blockID1 = new BlockID(containerID, blockNo);
+    blockData = new BlockData(blockID1);
+    List<ContainerProtos.ChunkInfo> chunkList1 = new ArrayList<>();
+    ChunkInfo info1 = new ChunkInfo(String.format("%d_chunk_%d", blockID1
+        .getLocalID(), 1), 0, 4 * 1024 * 1024);
+    info1.addMetadata(FULL_CHUNK, "");
+
+    ChunkInfo info2 = new ChunkInfo(String.format("%d_chunk_%d", blockID1
+        .getLocalID(), chunkID), offset, len);
+    chunkList1.add(info1.getProtoBufMessage());
+    chunkList1.add(info2.getProtoBufMessage());
+    blockData.setChunks(chunkList1);
+    blockData.setBlockCommitSequenceId(bcsID);
+    blockData.addMetadata(INCREMENTAL_CHUNK_LIST, "");
+
+    return blockData;
+  }
+
+  private BlockData createBlockDataWithThreeFullChunks(long containerID,
+      long blockNo, long bcsID) throws IOException {
+    blockID1 = new BlockID(containerID, blockNo);
+    blockData = new BlockData(blockID1);
+    List<ContainerProtos.ChunkInfo> chunkList1 = new ArrayList<>();
+    long chunkLimit = 4 * 1024 * 1024;
+    for (int i = 1; i < 4; i++) {
+      ChunkInfo info1 = new ChunkInfo(
+          String.format("%d_chunk_%d", blockID1.getLocalID(), i),
+          chunkLimit * i, chunkLimit);
+      info1.addMetadata(FULL_CHUNK, "");
+      chunkList1.add(info1.getProtoBufMessage());
+    }
+    blockData.setChunks(chunkList1);
+    blockData.setBlockCommitSequenceId(bcsID);
+    blockData.addMetadata(INCREMENTAL_CHUNK_LIST, "");
+
+    return blockData;
+  }
+
+  @Test
+  public void testFlush1() throws Exception {
+    assumeTrue(isSameSchemaVersion(schemaVersion, OzoneConsts.SCHEMA_V3));

Review Comment:
   do it in another way: skip if schema is v1.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to