Return-Path: X-Original-To: apmail-hadoop-hdfs-issues-archive@minotaur.apache.org Delivered-To: apmail-hadoop-hdfs-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D434C11D90 for ; Fri, 16 May 2014 23:14:45 +0000 (UTC) Received: (qmail 75019 invoked by uid 500); 16 May 2014 22:56:46 -0000 Delivered-To: apmail-hadoop-hdfs-issues-archive@hadoop.apache.org Received: (qmail 50139 invoked by uid 500); 16 May 2014 22:51:24 -0000 Mailing-List: contact hdfs-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hdfs-issues@hadoop.apache.org Delivered-To: mailing list hdfs-issues@hadoop.apache.org Received: (qmail 54990 invoked by uid 99); 16 May 2014 22:40:33 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 May 2014 22:40:32 +0000 Date: Fri, 16 May 2014 22:40:29 +0000 (UTC) From: "Jing Zhao (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (HDFS-6423) Diskspace quota usage is wrongly updated when appending data from partial block 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/HDFS-6423?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jing Zhao updated HDFS-6423: ---------------------------- Status: Patch Available (was: Open) > Diskspace quota usage is wrongly updated when appending data from partial block > ------------------------------------------------------------------------------- > > Key: HDFS-6423 > URL: https://issues.apache.org/jira/browse/HDFS-6423 > Project: Hadoop HDFS > Issue Type: Bug > Reporter: Jing Zhao > Assignee: Jing Zhao > Attachments: HDFS-6423.000.patch > > > When appending new data to a file whose last block is a partial block, the diskspace quota usage is not correctly update. For example, suppose the block size is 1024 bytes, and a file has size 1536 bytes (1.5 blocks). If we then append another 1024 bytes to the file, the diskspace usage for this file will not be updated to (2560 * replication) as expected, but (2048 * replication). > The cause of the issue is that in FSNamesystem#commitOrCompleteLastBlock, we have > {code} > // Adjust disk space consumption if required > final long diff = fileINode.getPreferredBlockSize() - commitBlock.getNumBytes(); > if (diff > 0) { > try { > String path = fileINode.getFullPathName(); > dir.updateSpaceConsumed(path, 0, -diff*fileINode.getFileReplication()); > } catch (IOException e) { > LOG.warn("Unexpected exception while updating disk space.", e); > } > } > {code} > This code assumes that the last block of the file has never been completed before, thus is always counted with the preferred block size in quota computation. -- This message was sent by Atlassian JIRA (v6.2#6252)