Return-Path: X-Original-To: apmail-hadoop-hdfs-commits-archive@minotaur.apache.org Delivered-To: apmail-hadoop-hdfs-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9D9969D9C for ; Thu, 1 Mar 2012 22:52:27 +0000 (UTC) Received: (qmail 70150 invoked by uid 500); 1 Mar 2012 22:52:27 -0000 Delivered-To: apmail-hadoop-hdfs-commits-archive@hadoop.apache.org Received: (qmail 70099 invoked by uid 500); 1 Mar 2012 22:52:27 -0000 Mailing-List: contact hdfs-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hdfs-dev@hadoop.apache.org Delivered-To: mailing list hdfs-commits@hadoop.apache.org Received: (qmail 70086 invoked by uid 99); 1 Mar 2012 22:52:27 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Mar 2012 22:52:27 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Mar 2012 22:52:25 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 1DC8723889D7; Thu, 1 Mar 2012 22:52:06 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1295961 - in /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs: CHANGES.txt src/main/java/org/apache/hadoop/hdfs/DFSUtil.java src/test/java/org/apache/hadoop/hdfs/TestDFSUtil.java Date: Thu, 01 Mar 2012 22:52:05 -0000 To: hdfs-commits@hadoop.apache.org From: atm@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120301225206.1DC8723889D7@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: atm Date: Thu Mar 1 22:52:05 2012 New Revision: 1295961 URL: http://svn.apache.org/viewvc?rev=1295961&view=rev Log: HDFS-3036. Remove unused method DFSUtil#isDefaultNamenodeAddress. Contributed by Aaron T. Myers. Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSUtil.java hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSUtil.java Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt?rev=1295961&r1=1295960&r2=1295961&view=diff ============================================================================== --- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt (original) +++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt Thu Mar 1 22:52:05 2012 @@ -68,6 +68,8 @@ Trunk (unreleased changes) HDFS-3030. Remove getProtocolVersion and getProtocolSignature from translators. (jitendra) + HDFS-3036. Remove unused method DFSUtil#isDefaultNamenodeAddress. (atm) + OPTIMIZATIONS HDFS-2477. Optimize computing the diff between a block report and the Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSUtil.java URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSUtil.java?rev=1295961&r1=1295960&r2=1295961&view=diff ============================================================================== --- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSUtil.java (original) +++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSUtil.java Thu Mar 1 22:52:05 2012 @@ -446,8 +446,7 @@ public class DFSUtil { * namenode, this method returns the corresponding nameservice ID, * by doing a reverse lookup on the list of nameservices until it * finds a match. - * If null is returned, client should try {@link #isDefaultNamenodeAddress} - * to check pre-Federated configurations. + * * Since the process of resolving URIs to Addresses is slightly expensive, * this utility method should not be used in performance-critical routines. * @@ -470,7 +469,6 @@ public class DFSUtil { // Configuration with a single namenode and no nameserviceId if (nameserviceIds == null || nameserviceIds.isEmpty()) { - // client should try {@link isDefaultNamenodeAddress} instead return null; } // Get the candidateAddresses for all the configured nameServiceIds @@ -484,7 +482,6 @@ public class DFSUtil { } } // didn't find a match - // client should try {@link isDefaultNamenodeAddress} instead return null; } @@ -528,38 +525,6 @@ public class DFSUtil { } /** - * Given the InetSocketAddress for any configured communication with a - * namenode, this method determines whether it is the configured - * communication channel for the "default" namenode. - * It does a reverse lookup on the list of default communication parameters - * to see if the given address matches any of them. - * Since the process of resolving URIs to Addresses is slightly expensive, - * this utility method should not be used in performance-critical routines. - * - * @param conf - configuration - * @param address - InetSocketAddress for configured communication with NN. - * Configured addresses are typically given as URIs, but we may have to - * compare against a URI typed in by a human, or the server name may be - * aliased, so we compare unambiguous InetSocketAddresses instead of just - * comparing URI substrings. - * @param keys - list of configured communication parameters that should - * be checked for matches. For example, to compare against RPC addresses, - * provide the list DFS_NAMENODE_SERVICE_RPC_ADDRESS_KEY, - * DFS_NAMENODE_RPC_ADDRESS_KEY - * @return - boolean confirmation if matched generic parameter - */ - public static boolean isDefaultNamenodeAddress(Configuration conf, - InetSocketAddress address, String... keys) { - for (String key : keys) { - String candidateAddress = conf.get(key); - if (candidateAddress != null - && address.equals(NetUtils.createSocketAddr(candidateAddress))) - return true; - } - return false; - } - - /** * @return key specific to a nameserviceId from a generic key */ public static String getNameServiceIdKey(String key, String nameserviceId) { Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSUtil.java URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSUtil.java?rev=1295961&r1=1295960&r2=1295961&view=diff ============================================================================== --- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSUtil.java (original) +++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSUtil.java Thu Mar 1 22:52:05 2012 @@ -208,27 +208,6 @@ public class TestDFSUtil { assertEquals(expectedNameServiceId, nameserviceId); } - /** - * Test for - * {@link DFSUtil#isDefaultNamenodeAddress(Configuration, InetSocketAddress, String...)} - */ - @Test - public void testSingleNamenode() { - HdfsConfiguration conf = new HdfsConfiguration(); - final String DEFAULT_ADDRESS = "localhost:9000"; - final String NN2_ADDRESS = "localhost:9001"; - conf.set(DFS_NAMENODE_RPC_ADDRESS_KEY, DEFAULT_ADDRESS); - - InetSocketAddress testAddress1 = NetUtils.createSocketAddr(DEFAULT_ADDRESS); - boolean isDefault = DFSUtil.isDefaultNamenodeAddress(conf, testAddress1, - DFS_NAMENODE_SERVICE_RPC_ADDRESS_KEY, DFS_NAMENODE_RPC_ADDRESS_KEY); - assertTrue(isDefault); - InetSocketAddress testAddress2 = NetUtils.createSocketAddr(NN2_ADDRESS); - isDefault = DFSUtil.isDefaultNamenodeAddress(conf, testAddress2, - DFS_NAMENODE_SERVICE_RPC_ADDRESS_KEY, DFS_NAMENODE_RPC_ADDRESS_KEY); - assertFalse(isDefault); - } - /** Tests to ensure default namenode is used as fallback */ @Test public void testDefaultNamenode() throws IOException {