You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2008/05/28 20:38:47 UTC
svn commit: r661040 - in /hadoop/hbase/trunk: CHANGES.txt
src/java/org/apache/hadoop/hbase/regionserver/HRegion.java
src/java/org/apache/hadoop/hbase/regionserver/HStore.java
Author: stack
Date: Wed May 28 11:38:46 2008
New Revision: 661040
URL: http://svn.apache.org/viewvc?rev=661040&view=rev
Log:
HBASE-646 EOFException opening HStoreFile info file (spin on HBASE-645 and 550)
Modified:
hadoop/hbase/trunk/CHANGES.txt
hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java
hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HStore.java
Modified: hadoop/hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=661040&r1=661039&r2=661040&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Wed May 28 11:38:46 2008
@@ -26,6 +26,7 @@
HBASE-641 Improve master split logging
HBASE-642 Splitting log in a hostile environment -- bad hdfs -- we drop
write-ahead-log edits
+ HBASE-646 EOFException opening HStoreFile info file (spin on HBASE-645and 550)
IMPROVEMENTS
HBASE-559 MR example job to count table rows
Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java?rev=661040&r1=661039&r2=661040&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java Wed May 28 11:38:46 2008
@@ -1704,7 +1704,7 @@
filter != null ?
(RowFilterInterface)WritableUtils.clone(filter, conf) : filter);
}
- } catch(IOException e) {
+ } catch (IOException e) {
for (int i = 0; i < this.scanners.length; i++) {
if(scanners[i] != null) {
closeScanner(i);
@@ -1828,12 +1828,17 @@
try {
scanners[i].close();
} catch (IOException e) {
- LOG.warn("Failed closeing scanner " + i, e);
+ LOG.warn("Failed closing scanner " + i, e);
}
} finally {
scanners[i] = null;
- resultSets[i] = null;
- keys[i] = null;
+ // These data members can be null if exception in constructor
+ if (resultSets != null) {
+ resultSets[i] = null;
+ }
+ if (keys != null) {
+ keys[i] = null;
+ }
}
}
Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HStore.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HStore.java?rev=661040&r1=661039&r2=661040&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HStore.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HStore.java Wed May 28 11:38:46 2008
@@ -392,6 +392,14 @@
ArrayList<Path> mapfiles = new ArrayList<Path>(infofiles.length);
for (int i = 0; i < infofiles.length; i++) {
Path p = infofiles[i].getPath();
+ // Check for empty info file. Should never be the case but can happen
+ // after data loss in hdfs for whatever reason (upgrade, etc.): HBASE-646
+ if (this.fs.getFileStatus(p).getLen() <= 0) {
+ LOG.warn("Skipping " + p + " because its empty. DATA LOSS? Can " +
+ "this scenario be repaired? HBASE-646");
+ continue;
+ }
+
Matcher m = REF_NAME_PARSER.matcher(p.getName());
/*
* * * * * N O T E * * * * *
@@ -434,6 +442,13 @@
"Cleaned up info file. Continuing...Probable DATA LOSS!!!");
continue;
}
+ if (isEmptyDataFile(mapfile)) {
+ curfile.delete();
+ // We can have empty data file if data loss in hdfs.
+ LOG.warn("Mapfile " + mapfile.toString() + " has empty data. " +
+ "Deleting. Continuing...Probable DATA LOSS!!! See HBASE-646.");
+ continue;
+ }
// TODO: Confirm referent exists.
@@ -460,7 +475,22 @@
}
return results;
}
-
+
+ /*
+ * @param mapfile
+ * @return True if the passed mapfile has a zero-length data component (its
+ * broken).
+ * @throws IOException
+ */
+ private boolean isEmptyDataFile(final Path mapfile)
+ throws IOException {
+ // Mapfiles are made of 'data' and 'index' files. Confirm 'data' is
+ // non-null if it exists (may not have been written to yet).
+ Path dataFile = new Path(mapfile, "data");
+ return this.fs.exists(dataFile) &&
+ this.fs.getFileStatus(dataFile).getLen() == 0;
+ }
+
//////////////////////////////////////////////////////////////////////////////
// Bloom filters
//////////////////////////////////////////////////////////////////////////////