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 6A9C06882 for ; Fri, 24 Jun 2011 02:34:11 +0000 (UTC) Received: (qmail 85816 invoked by uid 500); 24 Jun 2011 02:34:11 -0000 Delivered-To: apmail-hadoop-hdfs-issues-archive@hadoop.apache.org Received: (qmail 85695 invoked by uid 500); 24 Jun 2011 02:34:11 -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 85684 invoked by uid 99); 24 Jun 2011 02:34:08 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Jun 2011 02:34:08 +0000 X-ASF-Spam-Status: No, hits=-1996.4 required=5.0 tests=ALL_TRUSTED,FS_REPLICA,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; Fri, 24 Jun 2011 02:34:07 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 72BF742CBFA for ; Fri, 24 Jun 2011 02:33:47 +0000 (UTC) Date: Fri, 24 Jun 2011 02:33:47 +0000 (UTC) From: "Todd Lipcon (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: <1524730217.35300.1308882827466.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <5574784.91051288137021012.JavaMail.jira@thor> Subject: [jira] [Commented] (HDFS-1480) All replicas for a block with repl=2 end up in same 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-1480?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13054217#comment-13054217 ] Todd Lipcon commented on HDFS-1480: ----------------------------------- There's definitely a bug still in trunk, here. Here's my analysis (in this case with repl=3): - Cluster has 2 racks, A and B, each with three nodes. - Block initially written on A1, B1, B2 - Admin decommissions two of these nodes (let's say A1 and B1 but it doesn't matter) - in {{computeReplicationWorkForBlock}}, it calls {{chooseSourceDatanode}} which populates {{containingNodes}} with all three nodes regardless of decom status - this is then passed through as {{chosenNodes}} in the call to {{chooseTarget}} - maxNodesPerRack is then assigned (5-1)/2 + 2 = 4 - {{chooseTarget}} initializes {{result}} with these same three nodes - {numOfResults}} is thus 3, and it calls {{chooseRandom}} rather than basing its decision on local/remote racks - {{chooseRandom}} is free to pick any two nodes since maxNodesPerRack is 4 Will attach a failing unit test momentarily > All replicas for a block with repl=2 end up in same rack > -------------------------------------------------------- > > Key: HDFS-1480 > URL: https://issues.apache.org/jira/browse/HDFS-1480 > Project: Hadoop HDFS > Issue Type: Bug > Components: name-node > Affects Versions: 0.20.2 > Reporter: T Meyarivan > > It appears that all replicas of a block can end up in the same rack. The likelihood of such replicas seems to be directly related to decommissioning of nodes. > Post rolling OS upgrade (decommission 3-10% of nodes, re-install etc, add them back) of a running cluster, all replicas of about 0.16% of blocks ended up in the same rack. > Hadoop Namenode UI etc doesn't seem to know about such incorrectly replicated blocks. "hadoop fsck .." does report that the blocks must be replicated on additional racks. > Looking at ReplicationTargetChooser.java, following seem suspect: > snippet-01: > {code} > int maxNodesPerRack = > (totalNumOfReplicas-1)/clusterMap.getNumOfRacks()+2; > {code} > snippet-02: > {code} > case 2: > if (clusterMap.isOnSameRack(results.get(0), results.get(1))) { > chooseRemoteRack(1, results.get(0), excludedNodes, > blocksize, maxNodesPerRack, results); > } else if (newBlock){ > chooseLocalRack(results.get(1), excludedNodes, blocksize, > maxNodesPerRack, results); > } else { > chooseLocalRack(writer, excludedNodes, blocksize, > maxNodesPerRack, results); > } > if (--numOfReplicas == 0) { > break; > } > {code} > snippet-03: > {code} > do { > DatanodeDescriptor[] selectedNodes = > chooseRandom(1, nodes, excludedNodes); > if (selectedNodes.length == 0) { > throw new NotEnoughReplicasException( > "Not able to place enough replicas"); > } > result = (DatanodeDescriptor)(selectedNodes[0]); > } while(!isGoodTarget(result, blocksize, maxNodesPerRack, results)); > {code} -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira