ソースを参照

Port from 0.20-append - HDFS-1346. DFSClient receives out of order packet ack. Contributed by Hairong Kuang.


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20-security@1164754 13f79535-47bb-0310-9956-ffa450edef68
Suresh Srinivas 14 年 前
コミット
f12860b95d

+ 2 - 0
CHANGES.txt

@@ -75,6 +75,8 @@ Release 0.20.205.0 - unreleased
     HDFS-1204. Lease expiration should recover single files, 
     HDFS-1204. Lease expiration should recover single files, 
     not entire lease holder (Sam Rash via dhruba)
     not entire lease holder (Sam Rash via dhruba)
 
 
+    HDFS-1346. DFSClient receives out of order packet ack. (hairong)
+
   IMPROVEMENTS
   IMPROVEMENTS
 
 
     MAPREDUCE-2187. Reporter sends progress during sort/merge. (Anupam Seth via
     MAPREDUCE-2187. Reporter sends progress during sort/merge. (Anupam Seth via

+ 4 - 3
src/hdfs/org/apache/hadoop/hdfs/server/datanode/BlockReceiver.java

@@ -875,8 +875,9 @@ class BlockReceiver implements java.io.Closeable, FSConstants {
             long expected = -2;
             long expected = -2;
             PipelineAck ack = new PipelineAck();
             PipelineAck ack = new PipelineAck();
             long seqno = -2;
             long seqno = -2;
+            boolean localMirrorError = mirrorError;
             try { 
             try { 
-              if (!mirrorError) {
+              if (!localMirrorError) {
                 // read an ack from downstream datanode
                 // read an ack from downstream datanode
                 ack.readFields(mirrorIn);
                 ack.readFields(mirrorIn);
                 if (LOG.isDebugEnabled()) {
                 if (LOG.isDebugEnabled()) {
@@ -885,7 +886,7 @@ class BlockReceiver implements java.io.Closeable, FSConstants {
                 }
                 }
                 seqno = ack.getSeqno();
                 seqno = ack.getSeqno();
               }
               }
-              if (seqno >= 0 || mirrorError) {
+              if (seqno >= 0 || localMirrorError) {
                 Packet pkt = null;
                 Packet pkt = null;
                 synchronized (this) {
                 synchronized (this) {
                   while (running && datanode.shouldRun && ackQueue.size() == 0) {
                   while (running && datanode.shouldRun && ackQueue.size() == 0) {
@@ -903,7 +904,7 @@ class BlockReceiver implements java.io.Closeable, FSConstants {
                   pkt = ackQueue.removeFirst();
                   pkt = ackQueue.removeFirst();
                   expected = pkt.seqno;
                   expected = pkt.seqno;
                   notifyAll();
                   notifyAll();
-                  if (seqno != expected && !mirrorError) {
+                  if (seqno != expected && !localMirrorError) {
                     throw new IOException("PacketResponder " + numTargets +
                     throw new IOException("PacketResponder " + numTargets +
                                           " for block " + block +
                                           " for block " + block +
                                           " expected seqno:" + expected +
                                           " expected seqno:" + expected +