diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 0717c29ce6e..d7dec88c4b1 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -22,6 +22,9 @@ Release 0.23.1 - UNRELEASED HDFS-2568. Use a set to manage child sockets in XceiverServer. (harsh via eli) + HDFS-2454. Move maxXceiverCount check to before starting the + thread in dataXceiver. (harsh via eli) + OPTIMIZATIONS HDFS-2130. Switch default checksum to CRC32C. (todd) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataXceiver.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataXceiver.java index b953978fd16..a6b5301ff95 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataXceiver.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataXceiver.java @@ -165,14 +165,6 @@ class DataXceiver extends Receiver implements Runnable { s.setSoTimeout(stdTimeout); } - // Make sure the xceiver count is not exceeded - int curXceiverCount = datanode.getXceiverCount(); - if (curXceiverCount > dataXceiverServer.maxXceiverCount) { - throw new IOException("xceiverCount " + curXceiverCount - + " exceeds the limit of concurrent xcievers " - + dataXceiverServer.maxXceiverCount); - } - opStartTime = now(); processOp(op); ++opsProcessed; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataXceiverServer.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataXceiverServer.java index f6dcb8f52d8..eed58ecad4c 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataXceiverServer.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataXceiverServer.java @@ -135,6 +135,15 @@ class DataXceiverServer implements Runnable { try { s = ss.accept(); s.setTcpNoDelay(true); + + // Make sure the xceiver count is not exceeded + int curXceiverCount = datanode.getXceiverCount(); + if (curXceiverCount > maxXceiverCount) { + throw new IOException("Xceiver count " + curXceiverCount + + " exceeds the limit of concurrent xcievers: " + + maxXceiverCount); + } + new Daemon(datanode.threadGroup, new DataXceiver(s, datanode, this)) .start(); } catch (SocketTimeoutException ignored) {