adoroszlai commented on a change in pull request #1336:
URL: https://github.com/apache/hadoop-ozone/pull/1336#discussion_r477253394



##########
File path: 
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockOutputStream.java
##########
@@ -209,9 +224,16 @@ public IOException getIoException() {
   @Override
   public void write(int b) throws IOException {
     checkOpen();
-    byte[] buf = new byte[1];
-    buf[0] = (byte) b;
-    write(buf, 0, 1);
+    if (currentBufferRemaining == 0) {
+      allocateNewBuffer();
+    }
+    currentBuffer.put((byte) b);
+    currentBufferRemaining--;
+    if (currentBufferRemaining == 0) {
+      writeChunk(currentBuffer);
+    }

Review comment:
       `checkOpen()` and `doFlushOrWatchIfNeeded()` calls are both concise.  I 
think moving the conditions for these two other calls would help make the level 
of abstraction in `write()` more similar.  But it's optional.




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

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



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

Reply via email to