Return-Path: X-Original-To: apmail-hadoop-hdfs-issues-archive@minotaur.apache.org Delivered-To: apmail-hadoop-hdfs-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4F31F9073 for ; Sun, 1 Apr 2012 20:40:51 +0000 (UTC) Received: (qmail 82112 invoked by uid 500); 1 Apr 2012 20:40:51 -0000 Delivered-To: apmail-hadoop-hdfs-issues-archive@hadoop.apache.org Received: (qmail 82059 invoked by uid 500); 1 Apr 2012 20:40:51 -0000 Mailing-List: contact hdfs-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hdfs-issues@hadoop.apache.org Delivered-To: mailing list hdfs-issues@hadoop.apache.org Received: (qmail 82051 invoked by uid 99); 1 Apr 2012 20:40:50 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 01 Apr 2012 20:40:50 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 01 Apr 2012 20:40:48 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id A57B6352D0F for ; Sun, 1 Apr 2012 20:40:27 +0000 (UTC) Date: Sun, 1 Apr 2012 20:40:27 +0000 (UTC) From: "Aaron T. Myers (Commented) (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: <1740966578.3721.1333312827694.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <80010819.13733.1332633507427.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (HDFS-3144) Refactor DatanodeID#getName by use MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HDFS-3144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13243846#comment-13243846 ] Aaron T. Myers commented on HDFS-3144: -------------------------------------- This is great cleanup, Eli. Thanks a lot for doing it. A few small comments. +1 once these and the findbugs warning is explained or fixed. # In UnregisteredNodeException, I wonder if you shouldn't just be using toString instead of getXferAdder? Looks to me like it's going to be used just as a log message. # Likewise seems like we should just use toString() in InvalidateBlocks#dump. # To hopefully prevent these misuses of DatanodeID methods, maybe add a comment at the top of DatanodeID explaining clearly when each should be used? e.g. "use toString() in log messages, use dataXferPort for..., etc." > Refactor DatanodeID#getName by use > ---------------------------------- > > Key: HDFS-3144 > URL: https://issues.apache.org/jira/browse/HDFS-3144 > Project: Hadoop HDFS > Issue Type: Improvement > Components: data-node > Reporter: Eli Collins > Assignee: Eli Collins > Attachments: hdfs-3144.txt, hdfs-3144.txt, hdfs-3144.txt > > > DatanodeID#getName, which returns a string containing the IP:xferPort of a Datanode, is used in a variety of contexts: > # Putting the ID in a log message > # Connecting to the DN for data transfer > # Getting a string to use as a key (eg for comparison) > # Using as a hostname, eg for excludes/includes, topology files > Same for DatanodeID#getHost, which returns just the IP part, and sometimes we use it as a key, sometimes we tack on the IPC port, etc. > Let's have a method for each use, eg toString can be used for #1, a new method (eg getDataXferAddr) for #2, a new method (eg getKey) for #3, new method (eg getHostID) for #4, etc. Aside from the code being more clear, we can change the value for particular uses, eg we can change the format in a log message without changing the address used that clients connect to the DN, or modify the address used for data transfer without changing the other uses. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira