aswinshakil commented on code in PR #3790:
URL: https://github.com/apache/ozone/pull/3790#discussion_r1008474025
##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/ECBlockOutputStreamEntry.java:
##########
@@ -384,6 +400,35 @@ private Stream<ECBlockOutputStream> dataStreams() {
.filter(Objects::nonNull);
}
+ public String calculateChecksum() throws IOException {
+ if (blockOutputStreams == null) {
+ throw new IOException("Block Output Stream is null");
+ }
+
+ List<ContainerProtos.ChunkInfo> chunkInfos = new ArrayList<>();
+ // First chunk should always have the additional chunks in a partial
stripe.
+ int currentIdx = blockOutputStreams[0]
+ .getContainerBlockData().getChunksCount();
+ for (ECBlockOutputStream stream: blockOutputStreams) {
+ List<ContainerProtos.ChunkInfo> chunks =
+ stream.getContainerBlockData().getChunksList();
+ if (chunks.size() > currentIdx - 1) {
+ chunkInfos.add(chunks.get(currentIdx - 1));
+ }
+ }
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ for (ContainerProtos.ChunkInfo info : chunkInfos) {
+ List<ByteString> byteStrings = new ArrayList<>(info.getChecksumData()
+ .getChecksumsList());
+ for (ByteString byteString : byteStrings) {
+ out.write(byteString.toByteArray());
+ }
+ }
+
Review Comment:
I tried using UTF_8, had some issues in the early stage. Maybe because of
the few bugs I fixed later. Will try it out.
--
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]