Return-Path: X-Original-To: apmail-hbase-dev-archive@www.apache.org Delivered-To: apmail-hbase-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1BD5710B38 for ; Wed, 19 Nov 2014 04:38:36 +0000 (UTC) Received: (qmail 85806 invoked by uid 500); 19 Nov 2014 04:38:35 -0000 Delivered-To: apmail-hbase-dev-archive@hbase.apache.org Received: (qmail 85655 invoked by uid 500); 19 Nov 2014 04:38:35 -0000 Mailing-List: contact dev-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list dev@hbase.apache.org Received: (qmail 85427 invoked by uid 99); 19 Nov 2014 04:38:35 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Nov 2014 04:38:35 +0000 Date: Wed, 19 Nov 2014 04:38:34 +0000 (UTC) From: "dennislee (JIRA)" To: dev@hbase.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (HBASE-12531) bug in cachedataonwrite MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 dennislee created HBASE-12531: ---------------------------------- Summary: bug in cachedataonwrite Key: HBASE-12531 URL: https://issues.apache.org/jira/browse/HBASE-12531 Project: HBase Issue Type: Bug Components: regionserver Affects Versions: 0.98.6.1 Reporter: dennislee when configuring {color:red}hbase.rs.cacheblocksonwrite{color} as true on a region server ,or setting cacheDataOnWrite as true on a column family in a table ,we flush the header bytes,ondisk bytebuffer and checksum bytes to disk,but only store the header and uncompressedBytesWithoutHeader to the block cache . so if we read a block from block cache which cached on write ,the method {color:red} getBufferWithoutHeader{color}of{color:red} org.apache.hadoop.hbase.io.hfile.HFileBlock{color} will cut off the head and checksum bytes,even if the checksum was never written ,and then we get a IllegalArgumentException thrown by ByteBuffer cause there is not enough bytes to read or skip at the end of the ByteBuffer. I fixed this problem but I don't know how to commit a patch ,so I paste my code here : {code:title=org.apache.hadoop.hbase.io.hfile.HFileBlock.java|borderStyle=solid} public ByteBuffer getBufferWithoutHeader() { int length,lengthWithoutHeader=buf.limit()-headerSize(),lengthWithoutHeaderAndCheckSum=lengthWithoutHeader - totalChecksumBytes(); if(lengthWithoutHeader==uncompressedSizeWithoutHeader){ // NO check sum tail length=lengthWithoutHeader; } else if(lengthWithoutHeaderAndCheckSum==uncompressedSizeWithoutHeader){ // has check sum tail length=lengthWithoutHeaderAndCheckSum; } else { throw new IllegalArgumentException(this.toString()+",this block may be crashed"); } ByteBuffer buffer =ByteBuffer.wrap(buf.array(), buf.arrayOffset() + headerSize(),length)//length .slice(); return buffer; } {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)