Selaa lähdekoodia

HADOOP-3859. Allow the maximum number of xceivers in the data node to
be configurable. Contributed by Johan Oskarsson.


git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@683361 13f79535-47bb-0310-9956-ffa450edef68

Owen O'Malley 17 vuotta sitten
vanhempi
commit
ba89ebba71
2 muutettua tiedostoa jossa 14 lisäystä ja 9 poistoa
  1. 3 0
      CHANGES.txt
  2. 11 9
      src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java

+ 3 - 0
CHANGES.txt

@@ -1043,6 +1043,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/hdfs/server/datanode/DataNode.java

@@ -160,6 +160,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
@@ -304,6 +312,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
@@ -632,13 +641,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();
@@ -1040,10 +1042,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 ) {