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 1FB6C100EB for ; Thu, 15 Aug 2013 05:09:53 +0000 (UTC) Received: (qmail 17349 invoked by uid 500); 15 Aug 2013 05:09:52 -0000 Delivered-To: apmail-hadoop-hdfs-issues-archive@hadoop.apache.org Received: (qmail 17237 invoked by uid 500); 15 Aug 2013 05:09: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 17140 invoked by uid 99); 15 Aug 2013 05:09:49 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Aug 2013 05:09:49 +0000 Date: Thu, 15 Aug 2013 05:09:49 +0000 (UTC) From: "Tsz Wo (Nicholas), SZE (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HDFS-4898) BlockPlacementPolicyWithNodeGroup.chooseRemoteRack() fails to properly fallback to local rack 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-4898?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13740680#comment-13740680 ] Tsz Wo (Nicholas), SZE commented on HDFS-4898: ---------------------------------------------- Also committed the branch-1 patch. > BlockPlacementPolicyWithNodeGroup.chooseRemoteRack() fails to properly fallback to local rack > --------------------------------------------------------------------------------------------- > > Key: HDFS-4898 > URL: https://issues.apache.org/jira/browse/HDFS-4898 > Project: Hadoop HDFS > Issue Type: Bug > Components: namenode > Affects Versions: 1.2.0, 2.0.4-alpha > Reporter: Eric Sirianni > Assignee: Tsz Wo (Nicholas), SZE > Priority: Minor > Fix For: 1.3.0, 2.1.1-beta > > Attachments: h4898_20130809_b-1.patch, h4898_20130809.patch > > > As currently implemented, {{BlockPlacementPolicyWithNodeGroup}} does not properly fallback to local rack when no nodes are available in remote racks, resulting in an improper {{NotEnoughReplicasException}}. > {code:title=BlockPlacementPolicyWithNodeGroup.java} > @Override > protected void chooseRemoteRack(int numOfReplicas, > DatanodeDescriptor localMachine, HashMap excludedNodes, > long blocksize, int maxReplicasPerRack, List results, > boolean avoidStaleNodes) throws NotEnoughReplicasException { > int oldNumOfReplicas = results.size(); > // randomly choose one node from remote racks > try { > chooseRandom( > numOfReplicas, > "~" + NetworkTopology.getFirstHalf(localMachine.getNetworkLocation()), > excludedNodes, blocksize, maxReplicasPerRack, results, > avoidStaleNodes); > } catch (NotEnoughReplicasException e) { > chooseRandom(numOfReplicas - (results.size() - oldNumOfReplicas), > localMachine.getNetworkLocation(), excludedNodes, blocksize, > maxReplicasPerRack, results, avoidStaleNodes); > } > } > {code} > As currently coded the {{chooseRandom()}} call in the {{catch}} block will never succeed as the set of nodes within the passed in node path (e.g. {{/rack1/nodegroup1}}) is entirely contained within the set of excluded nodes (both are the set of nodes within the same nodegroup as the node chosen first replica). > The bug is that the fallback {{chooseRandom()}} call in the catch block should be passing in the _complement_ of the node path used in the initial {{chooseRandom()}} call in the try block (e.g. {{/rack1}}) - namely: > {code} > NetworkTopology.getFirstHalf(localMachine.getNetworkLocation()) > {code} > This will yield the proper fallback behavior of choosing a random node from _within the same rack_, but still excluding those nodes _in the same nodegroup_ -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira