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 7805617379 for ; Tue, 12 May 2015 12:16:00 +0000 (UTC) Received: (qmail 80723 invoked by uid 500); 12 May 2015 12:16:00 -0000 Delivered-To: apmail-hadoop-hdfs-issues-archive@hadoop.apache.org Received: (qmail 80658 invoked by uid 500); 12 May 2015 12:16:00 -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 80646 invoked by uid 99); 12 May 2015 12:16:00 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 May 2015 12:16:00 +0000 Date: Tue, 12 May 2015 12:16:00 +0000 (UTC) From: "Yi Liu (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (HDFS-8376) Erasure Coding: Update last cellsize calculation according to whether the erasure codec has chunk boundary 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-8376?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Yi Liu updated HDFS-8376: ------------------------- Description: Current calculation for last cell size is as following. For parity cell, the last cell size is the same as the first data cell. But some erasure codec has chunk boundary, then the last cellsize for parity block is the codec chunk size. {code} private static int lastCellSize(int size, int cellSize, int numDataBlocks, int i) { if (i < numDataBlocks) { // parity block size (i.e. i >= numDataBlocks) is the same as // the first data block size (i.e. i = 0). size -= i*cellSize; if (size < 0) { size = 0; } } return size > cellSize? cellSize: size; } {code} was: Current calculation for last cell size is as following. For parity cell, the last cell size is the same as the first data cell. But as discussed in HDFS-8347 and on-line meeting, some erasure codec is not linear, then the last cellsize for parity block is the codec chunk size. {code} private static int lastCellSize(int size, int cellSize, int numDataBlocks, int i) { if (i < numDataBlocks) { // parity block size (i.e. i >= numDataBlocks) is the same as // the first data block size (i.e. i = 0). size -= i*cellSize; if (size < 0) { size = 0; } } return size > cellSize? cellSize: size; } {code} This JIRA also removes some duplicate code {{StripedBlockUtil#constructStripedBlock}} and {{StripedBlockUtil#getStripedBlockLength}} are duplicated with some other methods, we can clean up. Summary: Erasure Coding: Update last cellsize calculation according to whether the erasure codec has chunk boundary (was: Erasure Coding: Update last cellsize calculation according to whether the erasure codec is linear) > Erasure Coding: Update last cellsize calculation according to whether the erasure codec has chunk boundary > ---------------------------------------------------------------------------------------------------------- > > Key: HDFS-8376 > URL: https://issues.apache.org/jira/browse/HDFS-8376 > Project: Hadoop HDFS > Issue Type: Sub-task > Reporter: Yi Liu > Assignee: Yi Liu > > Current calculation for last cell size is as following. For parity cell, the last cell size is the same as the first data cell. But some erasure codec has chunk boundary, then the last cellsize for parity block is the codec chunk size. > {code} > private static int lastCellSize(int size, int cellSize, int numDataBlocks, > int i) { > if (i < numDataBlocks) { > // parity block size (i.e. i >= numDataBlocks) is the same as > // the first data block size (i.e. i = 0). > size -= i*cellSize; > if (size < 0) { > size = 0; > } > } > return size > cellSize? cellSize: size; > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)