Why do you say so? Does it cause a bug in your case? If so, can you explain the 
problem you are facing?
Yong

From: [email protected]
To: [email protected]
Subject: is the HDFS BlockReceiver.PacketResponder  source code wrong ?
Date: Tue, 23 Sep 2014 07:37:41 +0000




In org.apache.hadoop.hdfs.server.datanode.BlockReceiver class, defined a inner 
class PacketResponder.
 
in the the contructor of PacketResponder
 
    PacketResponder(final DataOutputStream upstreamOut,
        final DataInputStream downstreamIn,
        final DatanodeInfo[] downstreams) {
      this.downstreamIn = downstreamIn;
      this.upstreamOut = upstreamOut;
      this.type = downstreams == null? PacketResponderType.NON_PIPELINE
          : downstreams.length == 0? PacketResponderType.LAST_IN_PIPELINE
              : PacketResponderType.HAS_DOWNSTREAM_IN_PIPELINE;
      final StringBuilder b = new StringBuilder(getClass().getSimpleName())
          .append(": ").append(block).append(", type=").append(type);
      if (type != PacketResponderType.HAS_DOWNSTREAM_IN_PIPELINE) {
        b.append(", downstreams=").append(downstreams.length)
            .append(":").append(Arrays.asList(downstreams));
      }
      this.myString = b.toString();
    }

has there mistakes ? 
 
 if (type != PacketResponderType.HAS_DOWNSTREAM_IN_PIPELINE) {
        b.append(", downstreams=").append(downstreams.length)
            .append(":").append(Arrays.asList(downstreams));
      }
 
the if criteria shoud be ==, not !=
 
 
                                                                                
  

Reply via email to