Return-Path: Delivered-To: apmail-hadoop-common-issues-archive@minotaur.apache.org Received: (qmail 94794 invoked from network); 3 Apr 2010 00:14:51 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 3 Apr 2010 00:14:51 -0000 Received: (qmail 71223 invoked by uid 500); 3 Apr 2010 00:14:51 -0000 Delivered-To: apmail-hadoop-common-issues-archive@hadoop.apache.org Received: (qmail 71186 invoked by uid 500); 3 Apr 2010 00:14:51 -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 71178 invoked by uid 99); 3 Apr 2010 00:14:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 03 Apr 2010 00:14:51 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED 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; Sat, 03 Apr 2010 00:14:48 +0000 Received: from brutus.apache.org (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id AE573234C1EF for ; Sat, 3 Apr 2010 00:14:27 +0000 (UTC) Message-ID: <360625036.668801270253667713.JavaMail.jira@brutus.apache.org> Date: Sat, 3 Apr 2010 00:14:27 +0000 (UTC) From: "Hairong Kuang (JIRA)" To: common-issues@hadoop.apache.org Subject: [jira] Created: (HADOOP-6678) Propose some changes to FileContext MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org 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.