HADOOP-11901. BytesWritable fails to support 2G chunks due to integer overflow. Contributed by Reynold Xin.
This commit is contained in:
parent
866dce4e8e
commit
747455a13b
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue