浏览代码

HDFS-3617. Port HDFS-96 to branch-1 (support blocks greater than 2GB). Contributed by Patrick Kling and Harsh J

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1@1359853 13f79535-47bb-0310-9956-ffa450edef68
Eli Collins 13 年之前
父节点
当前提交
390e414eea

+ 3 - 0
CHANGES.txt

@@ -24,6 +24,9 @@ Release 1.2.0 - unreleased
     HDFS-3596. Improve FSEditLog pre-allocation in branch-1
     HDFS-3596. Improve FSEditLog pre-allocation in branch-1
     (Colin Patrick McCabe via mattf)
     (Colin Patrick McCabe via mattf)
 
 
+    HDFS-3617. Port HDFS-96 to branch-1 (support blocks greater than 2GB).
+    (Patrick Kling and harsh via eli)
+
   BUG FIXES
   BUG FIXES
 
 
     HADOOP-8460. Document proper setting of HADOOP_PID_DIR and
     HADOOP-8460. Document proper setting of HADOOP_PID_DIR and

+ 1 - 1
src/hdfs/org/apache/hadoop/hdfs/DFSClient.java

@@ -2396,7 +2396,7 @@ public class DFSClient implements FSConstants, java.io.Closeable {
             if (pos > blockEnd) {
             if (pos > blockEnd) {
               currentNode = blockSeekTo(pos);
               currentNode = blockSeekTo(pos);
             }
             }
-            int realLen = Math.min(len, (int) (blockEnd - pos + 1));
+            int realLen = (int) Math.min((long) len, (blockEnd - pos + 1L));
             int result = readBuffer(buf, off, realLen);
             int result = readBuffer(buf, off, realLen);
             
             
             if (result >= 0) {
             if (result >= 0) {

+ 2 - 2
src/hdfs/org/apache/hadoop/hdfs/server/datanode/BlockSender.java

@@ -236,8 +236,8 @@ class BlockSender implements java.io.Closeable, FSConstants {
                          throws IOException {
                          throws IOException {
     // Sends multiple chunks in one packet with a single write().
     // Sends multiple chunks in one packet with a single write().
 
 
-    int len = Math.min((int) (endOffset - offset),
-                       bytesPerChecksum*maxChunks);
+    int len = (int) Math.min(endOffset - offset,
+        (((long) bytesPerChecksum) * ((long) maxChunks)));
     
     
     // truncate len so that any partial chunks will be sent as a final packet.
     // truncate len so that any partial chunks will be sent as a final packet.
     // this is not necessary for correctness, but partial chunks are 
     // this is not necessary for correctness, but partial chunks are