hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmcc...@apache.org
Subject hadoop git commit: HDFS-5445. PacketReceiver populates the packetLen field in PacketHeader incorrectly (Jonathan Mace via Colin P. McCabe)
Date Tue, 13 Jan 2015 01:11:22 GMT
Repository: hadoop
Updated Branches:
  refs/heads/trunk b3ddd7ee3 -> f761bd8fe


HDFS-5445. PacketReceiver populates the packetLen field in PacketHeader incorrectly (Jonathan
Mace via Colin P. McCabe)


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

Branch: refs/heads/trunk
Commit: f761bd8fe472c311bdff7c9d469f2805b867855a
Parents: b3ddd7e
Author: Colin Patrick Mccabe <cmccabe@cloudera.com>
Authored: Mon Jan 12 17:11:03 2015 -0800
Committer: Colin Patrick Mccabe <cmccabe@cloudera.com>
Committed: Mon Jan 12 17:11:03 2015 -0800

----------------------------------------------------------------------
 hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt                     | 3 +++
 .../hadoop/hdfs/protocol/datatransfer/PacketReceiver.java       | 2 +-
 .../hadoop/hdfs/protocol/datatransfer/TestPacketReceiver.java   | 5 ++++-
 3 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/f761bd8f/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
index b57503a..487b209 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
@@ -679,6 +679,9 @@ Release 2.7.0 - UNRELEASED
     HDFS-7533. Datanode sometimes does not shutdown on receiving upgrade
     shutdown command (Eric Payne via kihwal)
 
+    HDFS-5445. PacketReceiver populates the packetLen field in PacketHeader
+    incorrectly (Jonathan Mace via Colin P. McCabe)
+
 Release 2.6.1 - UNRELEASED
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/f761bd8f/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/PacketReceiver.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/PacketReceiver.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/PacketReceiver.java
index 0de445c..3045a13 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/PacketReceiver.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/PacketReceiver.java
@@ -178,7 +178,7 @@ public class PacketReceiver implements Closeable {
     if (curHeader == null) {
       curHeader = new PacketHeader();
     }
-    curHeader.setFieldsFromData(dataPlusChecksumLen, headerBuf);
+    curHeader.setFieldsFromData(payloadLen, headerBuf);
     
     // Compute the sub-slices of the packet
     int checksumLen = dataPlusChecksumLen - curHeader.getDataLen();

http://git-wip-us.apache.org/repos/asf/hadoop/blob/f761bd8f/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/protocol/datatransfer/TestPacketReceiver.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/protocol/datatransfer/TestPacketReceiver.java
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/protocol/datatransfer/TestPacketReceiver.java
index 6a87cdf..64ca3fa 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/protocol/datatransfer/TestPacketReceiver.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/protocol/datatransfer/TestPacketReceiver.java
@@ -27,6 +27,8 @@ import org.apache.hadoop.hdfs.AppendTestUtil;
 import org.junit.Test;
 import org.mockito.Mockito;
 
+import com.google.common.primitives.Ints;
+
 import static org.junit.Assert.*;
 
 public class TestPacketReceiver {
@@ -38,7 +40,7 @@ public class TestPacketReceiver {
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
     DataOutputStream dos = new DataOutputStream(baos);
     
-    int packetLen = data.length + sums.length + 4;
+    int packetLen = data.length + sums.length + Ints.BYTES;
     PacketHeader header = new PacketHeader(
         packetLen, OFFSET_IN_BLOCK, SEQNO, false, data.length, false);
     header.write(dos);
@@ -87,6 +89,7 @@ public class TestPacketReceiver {
     PacketHeader header = pr.getHeader();
     assertEquals(SEQNO, header.getSeqno());
     assertEquals(OFFSET_IN_BLOCK, header.getOffsetInBlock());
+    assertEquals(dataLen + checksumsLen + Ints.BYTES, header.getPacketLen());
     
     // Mirror the packet to an output stream and make sure it matches
     // the packet we sent.


Mime
View raw message