aswinshakil commented on code in PR #7293:
URL: https://github.com/apache/ozone/pull/7293#discussion_r1841204202
##########
hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/checksum/ContainerMerkleTreeTestUtils.java:
##########
@@ -131,21 +141,221 @@ public static ContainerMerkleTree
buildTestTree(ConfigurationSource conf) {
final long blockID1 = 1;
final long blockID2 = 2;
final long blockID3 = 3;
+ final long blockID4 = 4;
+ final long blockID5 = 5;
ContainerProtos.ChunkInfo b1c1 = buildChunk(conf, 0, ByteBuffer.wrap(new
byte[]{1, 2, 3}));
ContainerProtos.ChunkInfo b1c2 = buildChunk(conf, 1, ByteBuffer.wrap(new
byte[]{4, 5, 6}));
- ContainerProtos.ChunkInfo b2c1 = buildChunk(conf, 0, ByteBuffer.wrap(new
byte[]{7, 8, 9}));
- ContainerProtos.ChunkInfo b2c2 = buildChunk(conf, 1, ByteBuffer.wrap(new
byte[]{12, 11, 10}));
- ContainerProtos.ChunkInfo b3c1 = buildChunk(conf, 0, ByteBuffer.wrap(new
byte[]{13, 14, 15}));
- ContainerProtos.ChunkInfo b3c2 = buildChunk(conf, 1, ByteBuffer.wrap(new
byte[]{16, 17, 18}));
+ ContainerProtos.ChunkInfo b1c3 = buildChunk(conf, 2, ByteBuffer.wrap(new
byte[]{7, 8, 9}));
+ ContainerProtos.ChunkInfo b1c4 = buildChunk(conf, 3, ByteBuffer.wrap(new
byte[]{12, 11, 10}));
+ ContainerProtos.ChunkInfo b2c1 = buildChunk(conf, 0, ByteBuffer.wrap(new
byte[]{13, 14, 15}));
+ ContainerProtos.ChunkInfo b2c2 = buildChunk(conf, 1, ByteBuffer.wrap(new
byte[]{16, 17, 18}));
+ ContainerProtos.ChunkInfo b2c3 = buildChunk(conf, 2, ByteBuffer.wrap(new
byte[]{19, 20, 21}));
+ ContainerProtos.ChunkInfo b2c4 = buildChunk(conf, 3, ByteBuffer.wrap(new
byte[]{22, 23, 24}));
+ ContainerProtos.ChunkInfo b3c1 = buildChunk(conf, 0, ByteBuffer.wrap(new
byte[]{25, 26, 27}));
+ ContainerProtos.ChunkInfo b3c2 = buildChunk(conf, 1, ByteBuffer.wrap(new
byte[]{28, 29, 30}));
+ ContainerProtos.ChunkInfo b3c3 = buildChunk(conf, 2, ByteBuffer.wrap(new
byte[]{31, 32, 33}));
+ ContainerProtos.ChunkInfo b3c4 = buildChunk(conf, 3, ByteBuffer.wrap(new
byte[]{34, 35, 36}));
+ ContainerProtos.ChunkInfo b4c1 = buildChunk(conf, 0, ByteBuffer.wrap(new
byte[]{37, 38, 29}));
+ ContainerProtos.ChunkInfo b4c2 = buildChunk(conf, 1, ByteBuffer.wrap(new
byte[]{40, 41, 42}));
+ ContainerProtos.ChunkInfo b4c3 = buildChunk(conf, 2, ByteBuffer.wrap(new
byte[]{43, 44, 45}));
+ ContainerProtos.ChunkInfo b4c4 = buildChunk(conf, 3, ByteBuffer.wrap(new
byte[]{46, 47, 48}));
+ ContainerProtos.ChunkInfo b5c1 = buildChunk(conf, 0, ByteBuffer.wrap(new
byte[]{49, 50, 51}));
+ ContainerProtos.ChunkInfo b5c2 = buildChunk(conf, 1, ByteBuffer.wrap(new
byte[]{52, 53, 54}));
+ ContainerProtos.ChunkInfo b5c3 = buildChunk(conf, 2, ByteBuffer.wrap(new
byte[]{55, 56, 57}));
+ ContainerProtos.ChunkInfo b5c4 = buildChunk(conf, 3, ByteBuffer.wrap(new
byte[]{58, 59, 60}));
ContainerMerkleTree tree = new ContainerMerkleTree();
- tree.addChunks(blockID1, Arrays.asList(b1c1, b1c2));
- tree.addChunks(blockID2, Arrays.asList(b2c1, b2c2));
- tree.addChunks(blockID3, Arrays.asList(b3c1, b3c2));
+ tree.addChunks(blockID1, Arrays.asList(b1c1, b1c2, b1c3, b1c4));
+ tree.addChunks(blockID2, Arrays.asList(b2c1, b2c2, b2c3, b2c4));
+ tree.addChunks(blockID3, Arrays.asList(b3c1, b3c2, b3c3, b3c4));
+ tree.addChunks(blockID4, Arrays.asList(b4c1, b4c2, b4c3, b4c4));
+ tree.addChunks(blockID5, Arrays.asList(b5c1, b5c2, b5c3, b5c4));
return tree;
}
+ public static Pair<ContainerMerkleTree,
ContainerChecksumTreeManager.ContainerDiff> buildTestTreeWithMismatches(
+ ConfigurationSource conf, int numMissingBlocks, int numMissingChunks,
int numCorruptChunks) {
+
+ ContainerMerkleTree tree = buildTestTree(conf);
Review Comment:
I would rather keep the current implementation and pass on the tree in the
function, Rather than creating it here.
--
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]