Return-Path: X-Original-To: apmail-hbase-issues-archive@www.apache.org Delivered-To: apmail-hbase-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BBAE1CFEA for ; Wed, 25 Apr 2012 19:22:39 +0000 (UTC) Received: (qmail 5443 invoked by uid 500); 25 Apr 2012 19:22:39 -0000 Delivered-To: apmail-hbase-issues-archive@hbase.apache.org Received: (qmail 5405 invoked by uid 500); 25 Apr 2012 19:22:39 -0000 Mailing-List: contact issues-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@hbase.apache.org Received: (qmail 5395 invoked by uid 99); 25 Apr 2012 19:22:39 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Apr 2012 19:22:39 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Apr 2012 19:22:38 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 3741840EC09 for ; Wed, 25 Apr 2012 19:22:18 +0000 (UTC) Date: Wed, 25 Apr 2012 19:22:18 +0000 (UTC) From: "Uma Maheswara Rao G (JIRA)" To: issues@hbase.apache.org Message-ID: <2118960529.1819.1335381738350.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Created] (HBASE-5878) Use getVisibleLength public api from HdfsDataInputStream from Hadoop-2. 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 Uma Maheswara Rao G created HBASE-5878: ------------------------------------------ Summary: Use getVisibleLength public api from HdfsDataInputStream from Hadoop-2. Key: HBASE-5878 URL: https://issues.apache.org/jira/browse/HBASE-5878 Project: HBase Issue Type: Bug Components: wal Reporter: Uma Maheswara Rao G Assignee: Uma Maheswara Rao G SequencFileLogReader: Currently Hbase using getFileLength api from DFSInputStream class by reflection. DFSInputStream is not exposed as public. So, this may change in future. Now HDFS exposed HdfsDataInputStream as public API. We can make use of it, when we are not able to find the getFileLength api from DFSInputStream as a else condition. So, that we will not have any sudden surprise like we are facing today. Also, it is just logging one warn message and proceeding if it throws any exception while getting the length. I think we can re-throw the exception because there is no point in continuing with dataloss. {code} long adjust = 0; try { Field fIn = FilterInputStream.class.getDeclaredField("in"); fIn.setAccessible(true); Object realIn = fIn.get(this.in); // In hadoop 0.22, DFSInputStream is a standalone class. Before this, // it was an inner class of DFSClient. if (realIn.getClass().getName().endsWith("DFSInputStream")) { Method getFileLength = realIn.getClass(). getDeclaredMethod("getFileLength", new Class []{}); getFileLength.setAccessible(true); long realLength = ((Long)getFileLength. invoke(realIn, new Object []{})).longValue(); assert(realLength >= this.length); adjust = realLength - this.length; } else { LOG.info("Input stream class: " + realIn.getClass().getName() + ", not adjusting length"); } } catch(Exception e) { SequenceFileLogReader.LOG.warn( "Error while trying to get accurate file length. " + "Truncation / data loss may occur if RegionServers die.", e); } return adjust + super.getPos(); {code} -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira