Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 23FC1200B4F for ; Tue, 26 Jul 2016 23:35:23 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 22968160AA2; Tue, 26 Jul 2016 21:35:23 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 6C12F160AA4 for ; Tue, 26 Jul 2016 23:35:22 +0200 (CEST) Received: (qmail 48042 invoked by uid 500); 26 Jul 2016 21:35:20 -0000 Mailing-List: contact common-dev-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list common-dev@hadoop.apache.org Received: (qmail 47610 invoked by uid 99); 26 Jul 2016 21:35:20 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Jul 2016 21:35:20 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 801F22C0D5E for ; Tue, 26 Jul 2016 21:35:20 +0000 (UTC) Date: Tue, 26 Jul 2016 21:35:20 +0000 (UTC) From: "Steven K. Wong (JIRA)" To: common-dev@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (HADOOP-13430) Optimize and fix getFileStatus in S3A MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 26 Jul 2016 21:35:23 -0000 Steven K. Wong created HADOOP-13430: --------------------------------------- Summary: Optimize and fix getFileStatus in S3A Key: HADOOP-13430 URL: https://issues.apache.org/jira/browse/HADOOP-13430 Project: Hadoop Common Issue Type: Improvement Components: fs/s3 Affects Versions: 2.8.0 Reporter: Steven K. Wong Priority: Minor Currently, S3AFileSystem.getFileStatus(Path f) sends up to 3 requests to S3 when pathToKey(f) = key = "foo/bar" is a directory: 1. HEAD key=foo/bar \[continue if not found] 2. HEAD key=foo/bar/ \[continue if not found] 3. LIST prefix=foo/bar/ delimiter=/ max-keys=1 My experience (and generally true, I reckon) is that almost all directories are nonempty directories without a "fake directory" file (e.g. "foo/bar/"). Under this condition, request #2 is mostly unhelpful; it only slows down getFileStatus. Therefore, I propose swapping the order of requests #2 and #3. Furthermore, when key = "foo/bar" is a nonempty directory that contains a "fake directory" file (in addition to actual files), getFileStatus currently returns an S3AFileStatus with isEmptyDirectory=true, which is wrong. Swapping will fix this. The swapped LIST request will use max-keys=2 to determine isEmptyDirectory correctly. The swapped HEAD request will be skipped if the directory is empty. (Removing the delimiter from the LIST request should make the logic a little simpler than otherwise.) Note that key = "foo/bar/" has the same problem with isEmptyDirectory. To fix it, I propose skipping request #1 when key ends with "/". The price is this will, for an empty directory, replace a HEAD request with a LIST request that's generally more taxing on S3. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: common-dev-unsubscribe@hadoop.apache.org For additional commands, e-mail: common-dev-help@hadoop.apache.org