hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From whe...@apache.org
Subject hadoop git commit: HADOOP-11901. BytesWritable fails to support 2G chunks due to integer overflow. Contributed by Reynold Xin.
Date Thu, 19 Nov 2015 20:56:01 GMT
Repository: hadoop
Updated Branches:
  refs/heads/trunk 866dce4e8 -> 747455a13


HADOOP-11901. BytesWritable fails to support 2G chunks due to integer overflow. Contributed
by Reynold Xin.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/747455a1
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/747455a1
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/747455a1

Branch: refs/heads/trunk
Commit: 747455a13b710266e1084d2f5a3b18ba14b386e5
Parents: 866dce4
Author: Haohui Mai <wheat9@apache.org>
Authored: Thu Nov 19 12:54:08 2015 -0800
Committer: Haohui Mai <wheat9@apache.org>
Committed: Thu Nov 19 12:54:08 2015 -0800

----------------------------------------------------------------------
 hadoop-common-project/hadoop-common/CHANGES.txt                  | 3 +++
 .../src/main/java/org/apache/hadoop/io/BytesWritable.java        | 4 +++-
 2 files changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/747455a1/hadoop-common-project/hadoop-common/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt
index 3bb8620..3058799 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -1426,6 +1426,9 @@ Release 2.8.0 - UNRELEASED
     HADOOP-12484. Single File Rename Throws Incorrectly In Potential Race
     Condition Scenarios. (Gaurav Kanade via cnauroth)
 
+    HADOOP-11901. BytesWritable fails to support 2G chunks due to integer
+    overflow. (Reynold Xin via wheat9)
+
 Release 2.7.3 - UNRELEASED
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/747455a1/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/BytesWritable.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/BytesWritable.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/BytesWritable.java
index 155df3a..7d7b75b 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/BytesWritable.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/BytesWritable.java
@@ -120,7 +120,9 @@ public class BytesWritable extends BinaryComparable
    */
   public void setSize(int size) {
     if (size > getCapacity()) {
-      setCapacity(size * 3 / 2);
+      // Avoid overflowing the int too early by casting to a long.
+      long newSize = Math.min(Integer.MAX_VALUE, (3L * size) / 2L);
+      setCapacity((int) newSize);
     }
     this.size = size;
   }


Mime
View raw message