Browse Source

HADOOP-3859. Merge -r 683360:683361 from trunk to branch 0.18.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.18@683363 13f79535-47bb-0310-9956-ffa450edef68
Owen O'Malley 17 years ago
parent
commit
756dfd13bb
3 changed files with 21 additions and 10 deletions
  1. 3 0
      CHANGES.txt
  2. 11 9
      src/hdfs/org/apache/hadoop/dfs/DataNode.java
  3. 7 1
      src/test/log4j.properties

+ 3 - 0
CHANGES.txt

@@ -821,6 +821,9 @@ Release 0.17.2 - Unreleased
     FileSystem.delete rather than the FileUtil.fullyDelete. (Amareshwari
     Sri Ramadasu via acmurthy)  
 
+    HADOOP-3859. Allow the maximum number of xceivers in the data node to
+    be configurable. (Johan Oskarsson via omalley)
+
 Release 0.17.1 - 2008-06-23
 
   INCOMPATIBLE CHANGES

+ 11 - 9
src/hdfs/org/apache/hadoop/dfs/DataNode.java

@@ -138,6 +138,14 @@ public class DataNode extends Configured
   
   private static final Random R = new Random();
 
+  /**
+   * Maximal number of concurrent xceivers per node.
+   * Enforcing the limit is required in order to avoid data-node
+   * running out of memory.
+   */
+  private static final int MAX_XCEIVER_COUNT = 256;
+  private int maxXceiverCount = MAX_XCEIVER_COUNT;
+  
   /**
    * We need an estimate for block size to check if the disk partition has
    * enough space. For now we set it to be the default block size set
@@ -282,6 +290,7 @@ public class DataNode extends Configured
     this.dnRegistration.setName(machineName + ":" + tmpPort);
     LOG.info("Opened info server at " + tmpPort);
       
+    this.maxXceiverCount = conf.getInt("dfs.datanode.max.xcievers", MAX_XCEIVER_COUNT);
     this.threadGroup = new ThreadGroup("dataXceiveServer");
     this.dataXceiveServer = new Daemon(threadGroup, new DataXceiveServer(ss));
     this.threadGroup.setDaemon(true); // auto destroy when empty
@@ -608,13 +617,6 @@ public class DataNode extends Configured
     shutdown();
   }
     
-  /**
-   * Maximal number of concurrent xceivers per node.
-   * Enforcing the limit is required in order to avoid data-node
-   * running out of memory.
-   */
-  private final static int MAX_XCEIVER_COUNT = 256;
-
   /** Number of concurrent xceivers per node. */
   int getXceiverCount() {
     return threadGroup == null ? 0 : threadGroup.activeCount();
@@ -1024,10 +1026,10 @@ public class DataNode extends Configured
         byte op = in.readByte();
         // Make sure the xciver count is not exceeded
         int curXceiverCount = getXceiverCount();
-        if(curXceiverCount > MAX_XCEIVER_COUNT) {
+        if (curXceiverCount > maxXceiverCount) {
           throw new IOException("xceiverCount " + curXceiverCount
                                 + " exceeds the limit of concurrent xcievers "
-                                + MAX_XCEIVER_COUNT);
+                                + maxXceiverCount);
         }
         long startTime = now();
         switch ( op ) {

+ 7 - 1
src/test/log4j.properties

@@ -4,4 +4,10 @@ log4j.rootLogger=info,stdout
 log4j.threshhold=ALL
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n
+log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} [%t] %-5p %c{2} %x- %m%n
+
+#this is a logger that prints line numbers; it is unused but can be switched
+#on if desired
+log4j.appender.linenumbers=org.apache.log4j.ConsoleAppender
+log4j.appender.linenumbers.layout=org.apache.log4j.PatternLayout
+log4j.appender.linenumbers.layout.ConversionPattern=%d{ISO8601} [%t] %-5p %c{2} (%F:%M(%L)) %x - %m%n