You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by ma...@apache.org on 2022/03/21 02:25:05 UTC

[ozone] branch revert-3202-HDDS-6459 created (now c578817)

This is an automated email from the ASF dual-hosted git repository.

markgui pushed a change to branch revert-3202-HDDS-6459
in repository https://gitbox.apache.org/repos/asf/ozone.git.


      at c578817  Revert "EC: Check isFullCell inside handleDataWrite (#3202)"

This branch includes the following new commits:

     new c578817  Revert "EC: Check isFullCell inside handleDataWrite (#3202)"

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


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


[ozone] 01/01: Revert "EC: Check isFullCell inside handleDataWrite (#3202)"

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markgui pushed a commit to branch revert-3202-HDDS-6459
in repository https://gitbox.apache.org/repos/asf/ozone.git

commit c5788178118d37553ba67b2f95c748a6b20a6850
Author: Gui Hecheng <ma...@tencent.com>
AuthorDate: Mon Mar 21 10:24:46 2022 +0800

    Revert "EC: Check isFullCell inside handleDataWrite (#3202)"
    
    This reverts commit 217c1911b273018fe1a6e8b2770ab05d1247a509.
---
 .../hadoop/ozone/client/io/ECKeyOutputStream.java  | 24 +++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/ECKeyOutputStream.java b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/ECKeyOutputStream.java
index 234c1d3..34a6957 100644
--- a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/ECKeyOutputStream.java
+++ b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/ECKeyOutputStream.java
@@ -160,11 +160,16 @@ public class ECKeyOutputStream extends KeyOutputStream {
             .getCurrentStreamEntry().getCurrentStreamIdx();
         int bufferRem =
             ecChunkBufferCache.dataBuffers[currentStreamIdx].remaining();
-        int writeLen = Math.min(rem, Math.min(bufferRem, ecChunkSize));
-        int pos = handleDataWrite(currentStreamIdx, b, off, writeLen);
+        int expectedWriteLen = Math.min(rem, Math.min(bufferRem, ecChunkSize));
+        int oldPos =
+            ecChunkBufferCache.dataBuffers[currentStreamIdx].position();
+        int pos =
+            handleDataWrite(currentStreamIdx, b, off, expectedWriteLen,
+                oldPos + expectedWriteLen == ecChunkSize);
         checkAndWriteParityCells(pos);
-        rem -= writeLen;
-        off += writeLen;
+        long writtenLength = pos - oldPos;
+        rem -= writtenLength;
+        off += writtenLength;
       } catch (Exception e) {
         markStreamClosed();
         throw new IOException(e.getMessage());
@@ -370,9 +375,14 @@ public class ECKeyOutputStream extends KeyOutputStream {
     }
   }
 
-  private int handleDataWrite(int currIdx, byte[] b, int off, int len) {
-    int pos = ecChunkBufferCache.addToDataBuffer(currIdx, b, off, len);
-    if (pos == ecChunkSize) {
+  private int handleDataWrite(int currIdx, byte[] b, int off, long len,
+      boolean isFullCell) {
+    int pos = ecChunkBufferCache.addToDataBuffer(currIdx, b, off, (int) len);
+
+    if (isFullCell) {
+      Preconditions.checkArgument(pos == ecChunkSize,
+          "When full cell passed, the pos: " + pos
+              + " should match to ec chunk size.");
       handleOutputStreamWrite(currIdx, pos, false);
       blockOutputStreamEntryPool.getCurrentStreamEntry().useNextBlockStream();
     }

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