Return-Path: Delivered-To: apmail-hadoop-core-dev-archive@www.apache.org Received: (qmail 8416 invoked from network); 4 Oct 2008 00:24:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Oct 2008 00:24:37 -0000 Received: (qmail 14856 invoked by uid 500); 4 Oct 2008 00:24:34 -0000 Delivered-To: apmail-hadoop-core-dev-archive@hadoop.apache.org Received: (qmail 14823 invoked by uid 500); 4 Oct 2008 00:24:33 -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 14812 invoked by uid 99); 4 Oct 2008 00:24:33 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Oct 2008 17:24:33 -0700 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, 04 Oct 2008 00:23:39 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 3D745234C212 for ; Fri, 3 Oct 2008 17:23:44 -0700 (PDT) Message-ID: <2040821662.1223079824250.JavaMail.jira@brutus> Date: Fri, 3 Oct 2008 17:23:44 -0700 (PDT) From: "Pete Wyckoff (JIRA)" To: core-dev@hadoop.apache.org Subject: [jira] Commented: (HADOOP-4110) fuse-dfs implement posix truncate functionality In-Reply-To: <1867709542.1220846684744.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HADOOP-4110?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12636779#action_12636779 ] Pete Wyckoff commented on HADOOP-4110: -------------------------------------- since this is non-trivial to fully implement in hdfs, I am thinking of just implementing it for the case where bytes == 0. This is the common use case for: cp foo bar where bar already exists. truncate(bar, 0) is called and then foo is copied. Getting the user/permissions right would need to do a stat on the file, get the user and groups and permissions and then do a delete, then the create and then chown and chmod. the code would look something like: {code} static int dfs_truncate(const char *path, off_t size) { if (size != 0) { return -ENOTSUP; } dfs_context *dfs = (dfs_context*)fuse_get_context()->private_data; int ret = dfs_unlink(path); if (ret != 0) { return ret; } hdfsFS userFS; // if not connected, try to connect and fail out if we can't. if ((userFS = doConnectAsUser(dfs->nn_hostname,dfs->nn_port)) == NULL) { syslog(LOG_ERR, "ERROR: could not connect to dfs %s:%d\n", __FILE__, __LINE__); return -EIO; } hdfsFile file; if((file = (hdfsFile)hdfsOpenFile(userFS, path, O_WRONLY | O_CREAT, 0, 3, 0)) == NULL) { syslog(LOG_ERR, "ERROR: could not connect open file %s:%d\n", __FILE__, __LINE__); return -EIO; } if(hdfsCloseFile(userFS, file) != 0) { syslog(LOG_ERR, "ERROR: could not connect close file %s:%d\n", __FILE__, __LINE__); return -EIO; } return 0; } {code} > fuse-dfs implement posix truncate functionality > ----------------------------------------------- > > Key: HADOOP-4110 > URL: https://issues.apache.org/jira/browse/HADOOP-4110 > Project: Hadoop Core > Issue Type: New Feature > Components: contrib/fuse-dfs > Reporter: Pete Wyckoff > > dfs_truncate(path, bytes); -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.