This is an automated email from the ASF dual-hosted git repository. shashikant pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/trunk by this push: new f3d8265 HDDS-996. Incorrect data length gets updated in OM by client in case it hits exception in multiple successive block writes. Contributed by Shashikant Banerjee. f3d8265 is described below commit f3d8265582df88278dccf02e8e63cf0d2ba5286f Author: Shashikant Banerjee <shashik...@apache.org> AuthorDate: Thu Jan 24 16:37:05 2019 +0530 HDDS-996. Incorrect data length gets updated in OM by client in case it hits exception in multiple successive block writes. Contributed by Shashikant Banerjee. --- .../org/apache/hadoop/ozone/client/io/KeyOutputStream.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/KeyOutputStream.java b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/KeyOutputStream.java index 22efab3..042acee 100644 --- a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/KeyOutputStream.java +++ b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/KeyOutputStream.java @@ -286,7 +286,7 @@ public class KeyOutputStream extends OutputStream { BlockOutputStreamEntry current = streamEntries.get(currentStreamIndex); // length(len) will be in int range if the call is happening through - // write API of chunkOutputStream. Length can be in long range if it comes + // write API of blockOutputStream. Length can be in long range if it comes // via Exception path. int writeLen = Math.min((int)len, (int) current.getRemaining()); long currentPos = current.getWrittenDataLength(); @@ -302,7 +302,14 @@ public class KeyOutputStream extends OutputStream { || retryFailure) { // for the current iteration, totalDataWritten - currentPos gives the // amount of data already written to the buffer - writeLen = (int) (current.getWrittenDataLength() - currentPos); + + // In the retryPath, the total data to be written will always be equal + // to or less than the max length of the buffer allocated. + // The len specified here is the combined sum of the data length of + // the buffers + Preconditions.checkState(!retry || len <= streamBufferMaxSize); + writeLen = retry ? (int) len : + (int) (current.getWrittenDataLength() - currentPos); LOG.debug("writeLen {}, total len {}", writeLen, len); handleException(current, currentStreamIndex, retryFailure); } else { --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org