From 53a6abfe6eaa663f00b38b2e7491673b9adfb635 Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Mon, 31 Mar 2008 19:26:47 +0000 Subject: [PATCH] HBASE-550 EOF trying to read reconstruction log stops region deployment M src/java/org/apache/hadoop/hbase/HStore.java (Constructor) If an exception out of reconstructionLog method, log it and keep going. Presumption is that its result of a lack of HADOOP--1700. (reconstructionLog): Check for empty log file. git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@643110 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 1 + .../hadoop/hbase/regionserver/HStore.java | 26 ++++++++++++++----- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 596c652bf4f..515a85b9eca 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -105,6 +105,7 @@ Hbase Change Log HBASE-529 RegionServer needs to recover if datanode goes down HBASE-456 Clearly state which ports need to be opened in order to run HBase HBASE-536 Remove MiniDFS startup from MiniHBaseCluster + HBASE-521 Improve client scanner interface Branch 0.1 diff --git a/src/java/org/apache/hadoop/hbase/regionserver/HStore.java b/src/java/org/apache/hadoop/hbase/regionserver/HStore.java index d42d90bc3d4..03a9eaf8bca 100644 --- a/src/java/org/apache/hadoop/hbase/regionserver/HStore.java +++ b/src/java/org/apache/hadoop/hbase/regionserver/HStore.java @@ -44,6 +44,7 @@ import org.apache.hadoop.fs.FSDataInputStream; import org.apache.hadoop.fs.FSDataOutputStream; import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileSystem; +import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.filter.RowFilterInterface; import org.apache.hadoop.hbase.io.ImmutableBytesWritable; @@ -206,10 +207,7 @@ public class HStore implements HConstants { } if(LOG.isDebugEnabled()) { - LOG.debug("starting " + storeName + - ((reconstructionLog == null || !fs.exists(reconstructionLog)) ? - " (no reconstruction log)" : - " with reconstruction log: " + reconstructionLog.toString())); + LOG.debug("starting " + storeName); } // Go through the 'mapdir' and 'infodir' together, make sure that all @@ -236,7 +234,16 @@ public class HStore implements HConstants { this.maxSeqId); } - doReconstructionLog(reconstructionLog, maxSeqId); + try { + doReconstructionLog(reconstructionLog, maxSeqId); + } catch (IOException e) { + // Presume we got here because of some HDFS issue or because of a lack of + // HADOOP-1700; for now keep going but this is probably not what we want + // long term. If we got here there has been data-loss + LOG.warn("Exception processing reconstruction log " + reconstructionLog + + " opening " + this.storeName + + " -- continuing. Probably DATA LOSS!", e); + } // By default, we compact if an HStore has more than // MIN_COMMITS_FOR_COMPACTION map files @@ -303,11 +310,16 @@ public class HStore implements HConstants { private void doReconstructionLog(final Path reconstructionLog, final long maxSeqID) throws UnsupportedEncodingException, IOException { - if (reconstructionLog == null || !fs.exists(reconstructionLog)) { // Nothing to do. return; } + // Check its not empty. + FileStatus[] stats = fs.listStatus(reconstructionLog); + if (stats == null || stats.length == 0) { + LOG.warn("Passed reconstruction log " + reconstructionLog + " is zero-length"); + return; + } long maxSeqIdInLog = -1; TreeMap reconstructedCache = new TreeMap(); @@ -1691,4 +1703,4 @@ public class HStore implements HConstants { } } } -} \ No newline at end of file +}