Return-Path: Delivered-To: apmail-hadoop-common-issues-archive@minotaur.apache.org Received: (qmail 55796 invoked from network); 5 Apr 2010 18:01:49 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 5 Apr 2010 18:01:49 -0000 Received: (qmail 9653 invoked by uid 500); 5 Apr 2010 18:01:49 -0000 Delivered-To: apmail-hadoop-common-issues-archive@hadoop.apache.org Received: (qmail 9626 invoked by uid 500); 5 Apr 2010 18:01:49 -0000 Mailing-List: contact common-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: common-issues@hadoop.apache.org Delivered-To: mailing list common-issues@hadoop.apache.org Received: (qmail 9618 invoked by uid 99); 5 Apr 2010 18:01:49 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Apr 2010 18:01:49 +0000 X-ASF-Spam-Status: No, hits=-1218.9 required=10.0 tests=ALL_TRUSTED,AWL X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Apr 2010 18:01:48 +0000 Received: from brutus.apache.org (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 154C0234C4AD for ; Mon, 5 Apr 2010 18:01:28 +0000 (UTC) Message-ID: <816889941.693011270490488086.JavaMail.jira@brutus.apache.org> Date: Mon, 5 Apr 2010 18:01:28 +0000 (UTC) From: "Todd Lipcon (JIRA)" To: common-issues@hadoop.apache.org Subject: [jira] Commented: (HADOOP-6678) Propose some changes to FileContext In-Reply-To: <360625036.668801270253667713.JavaMail.jira@brutus.apache.org> 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/HADOOP-6678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12853468#action_12853468 ] Todd Lipcon commented on HADOOP-6678: ------------------------------------- OK, sounds good. Thanks for the info, Hairong. > Propose some changes to FileContext > ----------------------------------- > > Key: HADOOP-6678 > URL: https://issues.apache.org/jira/browse/HADOOP-6678 > Project: Hadoop Common > Issue Type: Improvement > Components: fs > Reporter: Hairong Kuang > Fix For: 0.21.0, 0.22.0 > > > # Add a method Iterator listStatus(Path), which allows HDFS client not to have the whole listing in the memory, benefit more from the iterative listing added in HDFS-985. Move the current FileStatus[] listStatus(Path) to be a utility method. > # Remove methods isFile(Path), isDirectory(Path), and exists. > All these methods are implemented by calling getFileStatus(Path).But most users are not aware of this. They would write code as below: > {code} > FileContext fc = ..; > if (fc.exists(path)) { > if (fc.isFile(path)) { > ... > } else { > ... > } > } > {code} > The above code adds unnecessary getFileInfo RPC to NameNode. In our production clusters, we often see that the number of getFileStatus calls is multiple times of the open calls. If we remove isFile, isDirectory, and exists from FileContext, users have to explicitly call getFileStatus first, it is more likely that they will write more efficient code as follow: > {code} > FileContext fc = ...; > FileStatus fstatus = fc.getFileStatus(path); > if (fstatus.isFile() { > ... > } else { > ... > } > {code} -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.