Author: ecn Date: Wed Jan 9 20:24:23 2013 New Revision: 1431042 URL: http://svn.apache.org/viewvc?rev=1431042&view=rev Log: ACCUMULO-797: ignore empty wal files
Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/log/SortedLogRecovery.java Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/log/SortedLogRecovery.java URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/log/SortedLogRecovery.java?rev=1431042&r1=1431041&r2=1431042&view=diff ============================================================================== --- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/log/SortedLogRecovery.java (original) +++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/log/SortedLogRecovery.java Wed Jan 9 20:24:23 2013 @@ -46,6 +46,12 @@ import org.apache.log4j.Logger; public class SortedLogRecovery { private static final Logger log = Logger.getLogger(SortedLogRecovery.class); + static class EmptyMapFileException extends Exception { + private static final long serialVersionUID = 1L; + + public EmptyMapFileException() { super(); } + } + public SortedLogRecovery() {} private enum Status { @@ -87,7 +93,12 @@ public class SortedLogRecovery { log.info("Looking at mutations from " + logfile + " for " + extent); MultiReader reader = new MultiReader(fs, conf, logfile); try { - tids[i] = findLastStartToFinish(reader, i, extent, tabletFiles, lastStartToFinish); + try { + tids[i] = findLastStartToFinish(reader, i, extent, tabletFiles, lastStartToFinish); + } catch (EmptyMapFileException ex) { + log.info("Ignoring empty map file " + logfile); + tids[i] = -1; + } } finally { try { reader.close(); @@ -117,13 +128,13 @@ public class SortedLogRecovery { } } - int findLastStartToFinish(MultiReader reader, int fileno, KeyExtent extent, Set<String> tabletFiles, LastStartToFinish lastStartToFinish) throws IOException { + int findLastStartToFinish(MultiReader reader, int fileno, KeyExtent extent, Set<String> tabletFiles, LastStartToFinish lastStartToFinish) throws IOException, EmptyMapFileException { // Scan for tableId for this extent (should always be in the log) LogFileKey key = new LogFileKey(); LogFileValue value = new LogFileValue(); int tid = -1; if (!reader.next(key, value)) - throw new RuntimeException("Unable to read log entries"); + throw new EmptyMapFileException(); if (key.event != OPEN) throw new RuntimeException("First log entry value is not OPEN");