Return-Path: Delivered-To: apmail-hadoop-core-dev-archive@www.apache.org Received: (qmail 22610 invoked from network); 31 Mar 2009 05:44:14 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 31 Mar 2009 05:44:14 -0000 Received: (qmail 65556 invoked by uid 500); 31 Mar 2009 05:44:13 -0000 Delivered-To: apmail-hadoop-core-dev-archive@hadoop.apache.org Received: (qmail 65476 invoked by uid 500); 31 Mar 2009 05:44:13 -0000 Mailing-List: contact core-dev-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: core-dev@hadoop.apache.org Delivered-To: mailing list core-dev@hadoop.apache.org Received: (qmail 65466 invoked by uid 99); 31 Mar 2009 05:44:13 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 Mar 2009 05:44:13 +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; Tue, 31 Mar 2009 05:44:11 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id A6035234C051 for ; Mon, 30 Mar 2009 22:43:50 -0700 (PDT) Message-ID: <1433224042.1238478230678.JavaMail.jira@brutus> Date: Mon, 30 Mar 2009 22:43:50 -0700 (PDT) From: "He Yongqiang (JIRA)" To: core-dev@hadoop.apache.org Subject: [jira] Updated: (HADOOP-5438) Merge FileSystem.create and FileSystem.append In-Reply-To: <932951280.1236578332104.JavaMail.jira@brutus> 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 [ https://issues.apache.org/jira/browse/HADOOP-5438?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] He Yongqiang updated HADOOP-5438: --------------------------------- Attachment: Hadoop-5438-2009-03-31.patch 1) attach an update version according to dhruba's suggestions. Thanks, dhruba. 2) create HADOOP-5596 for the EnumSet problem. I have tried to add the EnumSet support in ObjectWritable, it seems will not need much work to do. > Merge FileSystem.create and FileSystem.append > --------------------------------------------- > > Key: HADOOP-5438 > URL: https://issues.apache.org/jira/browse/HADOOP-5438 > Project: Hadoop Core > Issue Type: Improvement > Reporter: He Yongqiang > Attachments: Hadoop-5438-2009-03-30.patch, Hadoop-5438-2009-03-31.patch > > > Currently, when a user wants to modify a file, the user first calls exists() to know if this file is already there. And then uses create() or append() according to whether the file exists or not. > the code looks like: > {code} > FSDataOutputStream out_1 = null; > if (fs.exists(path_1)) > out_1 = fs.append(path_1); > else > out_1 = fs.create(path_1); > {code} > . On the performace side,It involes two RPCs. On the easy-of-use side, it is not very convient in contrast to the traditional open interface. > It will more complicate if there is a overwrite parameter specified. I donot know whether there is a bug about 'overwrite' in 0.19, some times it takes a long time for overwrite creates to reture. So i make the write file code with overwrite param works like: > {code} > boolean exists = fs.exists(name); > if (overwrite) { > if (exists) > fs.delete(name, true); > this.out = fs.create(name, overwrite, bufferSize, replication, > blockSize, progress); > this.currentRowID = 0; > } else { > if (!exists) > this.out = fs.create(name, overwrite, bufferSize, > replication, blockSize, progress); > else > this.out = fs.append(name, bufferSize, progress); > {code} > Some code statements there are really redundant and not needed, especialy with the delete(). But without deleting first, the overwrite takes a long time to reture. > BTW, i will create another issue about the overwrite problem. If it is not a bug at all or a duplicate, someone please close it. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.