You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2022/05/05 23:41:08 UTC

[GitHub] [ozone] umamaheswararao commented on a diff in pull request #3372: HDDS-6400. EC: Refactor ECKeyOutputStream for better code reuse

umamaheswararao commented on code in PR #3372:
URL: https://github.com/apache/ozone/pull/3372#discussion_r866396130


##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/ECKeyOutputStream.java:
##########
@@ -150,39 +152,25 @@ public void write(byte[] b, int off, int len) throws IOException {
         || ((off + len) < 0)) {
       throw new IndexOutOfBoundsException();
     }
-    int rem = len;
-    while (rem > 0) {
-      try {
-        blockOutputStreamEntryPool.allocateBlockIfNeeded();
-        int currentStreamIdx = blockOutputStreamEntryPool
-            .getCurrentStreamEntry().getCurrentStreamIdx();
-        int bufferRem =
-            ecChunkBufferCache.dataBuffers[currentStreamIdx].remaining();
-        int writeLen = Math.min(rem, Math.min(bufferRem, ecChunkSize));
-        int pos = handleDataWrite(currentStreamIdx, b, off, writeLen);
-        checkAndWriteParityCells(pos);
-        rem -= writeLen;
-        off += writeLen;
-      } catch (Exception e) {
-        markStreamClosed();
-        throw new IOException(e.getMessage());
+    try {
+      int i = 0;

Review Comment:
   Let's change i as "writtenLen" ?
   
   Also change the below "i+off" to "off + writtenLen"



-- 
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: issues-unsubscribe@ozone.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org