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 72B4A1042D for ; Wed, 15 Jan 2014 21:33:32 +0000 (UTC) Received: (qmail 95199 invoked by uid 500); 15 Jan 2014 21:33:25 -0000 Delivered-To: apmail-hadoop-hdfs-issues-archive@hadoop.apache.org Received: (qmail 95032 invoked by uid 500); 15 Jan 2014 21:33:24 -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 94955 invoked by uid 99); 15 Jan 2014 21:33:23 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Jan 2014 21:33:23 +0000 Date: Wed, 15 Jan 2014 21:33:23 +0000 (UTC) From: "David Powell (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (HDFS-5782) BlockListAsLongs should take lists of Replicas rather than concrete classes 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-5782?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] David Powell updated HDFS-5782: ------------------------------- Target Version/s: 3.0.0 Status: Patch Available (was: Open) > BlockListAsLongs should take lists of Replicas rather than concrete classes > --------------------------------------------------------------------------- > > Key: HDFS-5782 > URL: https://issues.apache.org/jira/browse/HDFS-5782 > Project: Hadoop HDFS > Issue Type: Sub-task > Components: datanode > Affects Versions: 3.0.0 > Reporter: David Powell > Priority: Minor > Attachments: HDFS-5782.patch > > > From HDFS-5194: > {quote} > BlockListAsLongs's constructor takes a list of Blocks and a list of ReplicaInfos. On the surface, the former is mildly irritating because it is a concrete class, while the latter is a greater concern due to being a File-based implementation of Replica. > On deeper inspection, BlockListAsLongs passes members of both to an internal method that accepts just Blocks, which conditionally casts them *back* to ReplicaInfos (this cast only happens to the latter, though this isn't immediately obvious to the reader). > Conveniently, all methods called on these objects are found in the Replica interface, and all functional (i.e. non-test) consumers of this interface pass in Replica subclasses. If this constructor took Lists of Replicas instead, it would be more generally useful and its implementation would be cleaner as well. > {quote} > Fixing this indeed makes the business end of BlockListAsLongs cleaner while requiring no changes to FsDatasetImpl. As suggested by the above description, though, the HDFS tests use BlockListAsLongs differently from the production code -- they pretty much universally provide a list of actual Blocks. To handle this: > - In the case of SimulatedFSDataset, providing a list of Replicas is actually less work. > - In the case of NNThroughputBenchmark, rewriting to use Replicas is fairly invasive. Instead, the patch creates a second constructor in BlockListOfLongs specifically for the use of NNThrougputBenchmark. It turns the stomach a little, but is clearer and requires less code than the alternatives (and isn't without precedent). -- This message was sent by Atlassian JIRA (v6.1.5#6160)