From 6dda57a81718ce8251b50366e1b54d93480628ae Mon Sep 17 00:00:00 2001 From: Yongjun Zhang Date: Sun, 14 Jun 2015 11:20:32 -0700 Subject: [PATCH] HDFS-8596. TestDistributedFileSystem et al tests are broken in branch-2 due to incorrect setting of "datanode" attribute. Contributed by Yongjun Zhang. (cherry picked from commit b0dc291961410b6ac2b275cdcff4b95d75727e8d) Conflicts: hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/DatanodeHttpServer.java (cherry picked from commit cd578fa289252b0ae1e27f7e7b097cceeb2c30ff) --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../java/org/apache/hadoop/hdfs/server/datanode/DataNode.java | 2 +- .../hadoop/hdfs/server/datanode/web/DatanodeHttpServer.java | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 2d04e9b757d..2feaa97d428 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -116,6 +116,9 @@ Release 2.7.1 - UNRELEASED HDFS-8572. DN always uses HTTP/localhost@REALM principals in SPNEGO. (wheat9) + HDFS-8596. TestDistributedFileSystem et al tests are broken in branch-2 + due to incorrect setting of "datanode" attribute. (Yongjun Zhang) + Release 2.7.0 - 2015-04-20 INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java index 8bb807b5fe9..c39540eff77 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java @@ -756,7 +756,7 @@ public class DataNode extends ReconfigurableBase ServerSocketChannel httpServerChannel = secureResources != null ? secureResources.getHttpServerChannel() : null; - this.httpServer = new DatanodeHttpServer(conf, httpServerChannel); + this.httpServer = new DatanodeHttpServer(conf, this, httpServerChannel); httpServer.start(); if (httpServer.getHttpAddress() != null) { infoPort = httpServer.getHttpAddress().getPort(); diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/DatanodeHttpServer.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/DatanodeHttpServer.java index 4cb0571d7f8..86e2811a1c7 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/DatanodeHttpServer.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/DatanodeHttpServer.java @@ -75,6 +75,7 @@ public class DatanodeHttpServer implements Closeable { static final Log LOG = LogFactory.getLog(DatanodeHttpServer.class); public DatanodeHttpServer(final Configuration conf, + final DataNode datanode, final ServerSocketChannel externalHttpChannel) throws IOException { this.conf = conf; @@ -95,7 +96,7 @@ public class DatanodeHttpServer implements Closeable { this.infoServer.addInternalServlet(null, "/getFileChecksum/*", FileChecksumServlets.GetServlet.class); - this.infoServer.setAttribute("datanode", this); + this.infoServer.setAttribute("datanode", datanode); this.infoServer.setAttribute(JspHelper.CURRENT_CONF, conf); this.infoServer.addServlet(null, "/blockScannerReport", BlockScanner.Servlet.class);