hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sur...@apache.org
Subject svn commit: r1310320 - in /hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs: ./ src/main/java/org/apache/hadoop/hdfs/ src/test/java/org/apache/hadoop/hdfs/
Date Fri, 06 Apr 2012 13:40:27 GMT
Author: suresh
Date: Fri Apr  6 13:40:26 2012
New Revision: 1310320

URL: http://svn.apache.org/viewvc?rev=1310320&view=rev
Log:
HDFS-3185. Add configuration of Journal Service Daemons. Contributed by Hari Mankude.

Added:
    hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-3092.txt
Modified:
    hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java
    hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSUtil.java
    hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSUtil.java

Added: hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-3092.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-3092.txt?rev=1310320&view=auto
==============================================================================
--- hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-3092.txt
(added)
+++ hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-3092.txt
Fri Apr  6 13:40:26 2012
@@ -0,0 +1,16 @@
+Hadoop HDFS Change Log
+
+HDFS-3092 branch changes
+
+  INCOMPATIBLE CHANGES
+
+  NEW FEATURES
+    HDFS-3185. Add configuration of Journal Service Daemons. 
+    (Hari Mankude via suresh)
+
+  IMPROVEMENTS
+
+  OPTIMIZATIONS
+
+  BUG FIXES
+

Modified: hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java?rev=1310320&r1=1310319&r2=1310320&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java
(original)
+++ hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java
Fri Apr  6 13:40:26 2012
@@ -198,6 +198,9 @@ public class DFSConfigKeys extends Commo
   public static final String  DFS_HOSTS = "dfs.hosts";
   public static final String  DFS_HOSTS_EXCLUDE = "dfs.hosts.exclude";
   public static final String  DFS_CLIENT_LOCAL_INTERFACES = "dfs.client.local.interfaces";
+  
+  // This is a comma separated host:port list of addresses hosting the journal service
+  public static final String  DFS_JOURNALNODE_ADDRESS_KEY = "dfs.journalnode.addresses";
 
   // Much code in hdfs is not yet updated to use these keys.
   public static final String  DFS_CLIENT_BLOCK_WRITE_LOCATEFOLLOWINGBLOCK_RETRIES_KEY = "dfs.client.block.write.locateFollowingBlock.retries";
@@ -302,7 +305,7 @@ public class DFSConfigKeys extends Commo
                                            "dfs.image.transfer.bandwidthPerSec";
   public static final long DFS_IMAGE_TRANSFER_RATE_DEFAULT = 0;  //no throttling
 
-  //Keys with no defaults
+  // Keys with no defaults
   public static final String  DFS_DATANODE_PLUGINS_KEY = "dfs.datanode.plugins";
   public static final String  DFS_DATANODE_FSDATASET_FACTORY_KEY = "dfs.datanode.fsdataset.factory";
   public static final String  DFS_DATANODE_FSDATASET_VOLUME_CHOOSING_POLICY_KEY = "dfs.datanode.fsdataset.volume.choosing.policy";

Modified: hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSUtil.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSUtil.java?rev=1310320&r1=1310319&r2=1310320&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSUtil.java
(original)
+++ hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSUtil.java
Fri Apr  6 13:40:26 2012
@@ -25,6 +25,7 @@ import java.net.InetSocketAddress;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.security.SecureRandom;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
@@ -1055,4 +1056,26 @@ public class DFSUtil {
       return null;
     }
   }
+  
+  
+  /**
+   * Returns list of InetSocketAddresses of journalnodes from the
+   * configuration.
+   * 
+   * @param conf configuration
+   * @return list of InetSocketAddresses
+   */
+  public static Collection<InetSocketAddress> getJournalNodeAddresses(
+      Configuration conf) {
+    Collection<String> jnames = conf
+        .getTrimmedStringCollection(DFS_JOURNALNODE_ADDRESS_KEY);
+    Collection<InetSocketAddress> ret = new ArrayList<InetSocketAddress>();
+    for (String jname : emptyAsSingletonNull(jnames)) {
+      if (jname == null) {
+        continue;
+      }
+      ret.add(NetUtils.createSocketAddr(jname));
+    }
+    return ret;
+  }
 }

Modified: hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSUtil.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSUtil.java?rev=1310320&r1=1310319&r2=1310320&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSUtil.java
(original)
+++ hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSUtil.java
Fri Apr  6 13:40:26 2012
@@ -539,4 +539,34 @@ public class TestDFSUtil {
     assertTrue(uris.contains(new URI("hdfs://" + NS2_NN_HOST)));
     assertTrue(uris.contains(new URI("hdfs://" + NN_HOST)));
   }
+  
+  @Test
+  public void testJournalNodeConf() throws Exception {
+    HdfsConfiguration conf = new HdfsConfiguration(false);
+    String str1 = "localhost:50200";
+    String str2 = "localhost:50210";
+    InetSocketAddress isa1 = NetUtils.createSocketAddr(str1);
+    InetSocketAddress isa2 = NetUtils.createSocketAddr(str2);
+    
+    // If nothing is added, zero length collection is returned.
+    Collection<InetSocketAddress> ret = DFSUtil.getJournalNodeAddresses(conf);
+    assertEquals(ret.size(), 0);
+    
+    // Setup single journal node
+    conf.set(DFS_JOURNALNODE_ADDRESS_KEY, str1);  
+    ret = DFSUtil.getJournalNodeAddresses(conf);
+    assertEquals(ret.size(), 1);
+    for (InetSocketAddress addr : ret) {
+      assertTrue(addr.equals(isa1));
+    }
+    
+    // Add two entries now.
+    conf.set(DFS_JOURNALNODE_ADDRESS_KEY, "localhost:50200, localhost:50210");
+    ret = DFSUtil.getJournalNodeAddresses(conf);
+    assertEquals(ret.size(), 2);
+    
+    for (InetSocketAddress addr: ret) {
+      assertTrue(addr.equals(isa1) || addr.equals(isa2));
+    }
+  }
 }



Mime
View raw message