You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ns...@apache.org on 2011/10/11 04:05:22 UTC
svn commit: r1181399 - in
/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase:
regionserver/wal/HLog.java util/FSUtils.java
Author: nspiegelberg
Date: Tue Oct 11 02:05:21 2011
New Revision: 1181399
URL: http://svn.apache.org/viewvc?rev=1181399&view=rev
Log:
Handle InterruptedException in HLog.splitLog
Summary:
Throw InterruptedIOException when HLog.splitLog is interrupted
Test Plan:
manual test
DiffCamp Revision: 166994
Reviewed By: nspiegelberg
CC: nspiegelberg, hkuang, hbase@lists
Tasks:
#405183: HBASE-3084 : Properly Handle User Interrupts in HLog.splitLog()
Revert Plan:
OK
Modified:
hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java
hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java
Modified: hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java?rev=1181399&r1=1181398&r2=1181399&view=diff
==============================================================================
--- hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java (original)
+++ hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java Tue Oct 11 02:05:21 2011
@@ -26,6 +26,7 @@ import java.io.DataOutput;
import java.io.EOFException;
import java.io.FileNotFoundException;
import java.io.IOException;
+import java.io.InterruptedIOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Method;
@@ -1313,6 +1314,8 @@ public class HLog implements Syncable {
// truncated files are expected if a RS crashes (see HBASE-2643)
LOG.warn("EOF from hlog " + logPath + ". continuing");
processedLogs.add(logPath);
+ } catch (InterruptedIOException iioe) {
+ throw iioe;
} catch (IOException e) {
// If the IOE resulted from bad file format,
// then this problem is idempotent and retrying won't help
@@ -1494,11 +1497,10 @@ public class HLog implements Syncable {
}
} catch(InterruptedException ex) {
- LOG.warn("Hlog writers were interrupted, possible data loss!");
- if (!skipErrors) {
- throw new IOException("Could not finish writing log entries", ex);
- //TODO maybe we should fail here regardless if skipErrors is active or not
- }
+ String errorMsgr = "Hlog writers were interrupted!";
+ LOG.info(errorMsgr, ex);
+ throw (InterruptedIOException)new InterruptedIOException(
+ errorMsgr).initCause(ex);
}
for (Map.Entry<byte[], Future> entry : writeFutureResult.entrySet()) {
@@ -1507,10 +1509,13 @@ public class HLog implements Syncable {
} catch (ExecutionException e) {
throw (new IOException(e.getCause()));
} catch (InterruptedException e1) {
- LOG.warn("Writer for region " + Bytes.toString(entry.getKey()) +
- " was interrupted, however the write process should have " +
- "finished. Throwing up ", e1);
- throw (new IOException(e1.getCause()));
+ String errorMsgr = "Writer for region " +
+ Bytes.toString(entry.getKey()) +
+ " was interrupted, however the write process should have " +
+ "finished. Throwing up ";
+ LOG.info(errorMsgr, e1);
+ throw (InterruptedIOException)new InterruptedIOException(
+ errorMsgr).initCause(e1);
}
}
}
Modified: hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java?rev=1181399&r1=1181398&r2=1181399&view=diff
==============================================================================
--- hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java (original)
+++ hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java Tue Oct 11 02:05:21 2011
@@ -40,6 +40,7 @@ import org.apache.hadoop.io.SequenceFile
import java.io.DataInputStream;
import java.io.IOException;
+import java.io.InterruptedIOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.HashMap;
@@ -634,7 +635,8 @@ public class FSUtils {
try {
Thread.sleep(1000);
} catch (InterruptedException ex) {
- // ignore it and try again
+ throw (InterruptedIOException)
+ new InterruptedIOException().initCause(ex);
}
} else {
throw new IOException("Failed to open " + p + " for append", e);