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 2011/03/07 19:52:13 UTC
svn commit: r1078890 - in /hbase/branches/0.90: CHANGES.txt
src/main/java/org/apache/hadoop/hbase/util/FSUtils.java
Author: stack
Date: Mon Mar 7 18:52:13 2011
New Revision: 1078890
URL: http://svn.apache.org/viewvc?rev=1078890&view=rev
Log:
HBASE-3285 Hlog recovery takes too much time
Modified:
hbase/branches/0.90/CHANGES.txt
hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java
Modified: hbase/branches/0.90/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/CHANGES.txt?rev=1078890&r1=1078889&r2=1078890&view=diff
==============================================================================
--- hbase/branches/0.90/CHANGES.txt (original)
+++ hbase/branches/0.90/CHANGES.txt Mon Mar 7 18:52:13 2011
@@ -25,6 +25,7 @@ Release 0.90.2 - February 9th, 2011
Purtell)
HBASE-3603 Remove -XX:+HeapDumpOnOutOfMemoryError autodump of heap option
on OOME
+ HBASE-3285 Hlog recovery takes too much time
Release 0.90.1 - February 9th, 2011
Modified: hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java?rev=1078890&r1=1078889&r2=1078890&view=diff
==============================================================================
--- hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java (original)
+++ hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java Mon Mar 7 18:52:13 2011
@@ -43,6 +43,8 @@ import java.io.DataInputStream;
import java.io.EOFException;
import java.io.FileNotFoundException;
import java.io.IOException;
+import java.io.InterruptedIOException;
+import java.lang.reflect.InvocationTargetException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.HashMap;
@@ -631,8 +633,23 @@ public class FSUtils {
boolean recovered = false;
while (!recovered) {
try {
- FSDataOutputStream out = fs.append(p);
- out.close();
+ try {
+ if (fs instanceof DistributedFileSystem) {
+ DistributedFileSystem dfs = (DistributedFileSystem)fs;
+ DistributedFileSystem.class.getMethod("recoverLease",
+ new Class[] {Path.class}).invoke(dfs, p);
+ } else {
+ throw new Exception("Not a DistributedFileSystem");
+ }
+ } catch (InvocationTargetException ite) {
+ // function was properly called, but threw it's own exception
+ throw (IOException) ite.getCause();
+ } catch (Exception e) {
+ LOG.debug("Failed fs.recoverLease invocation, " + e.toString() +
+ ", trying fs.append instead");
+ FSDataOutputStream out = fs.append(p);
+ out.close();
+ }
recovered = true;
} catch (IOException e) {
e = RemoteExceptionHandler.checkIOException(e);
@@ -646,11 +663,6 @@ public class FSUtils {
LOG.warn("Waited " + waitedFor + "ms for lease recovery on " + p +
":" + e.getMessage());
}
- try {
- Thread.sleep(1000);
- } catch (InterruptedException ex) {
- // ignore it and try again
- }
} else if (e instanceof LeaseExpiredException &&
e.getMessage().contains("File does not exist")) {
// This exception comes out instead of FNFE, fix it
@@ -660,8 +672,12 @@ public class FSUtils {
throw new IOException("Failed to open " + p + " for append", e);
}
}
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException ex) {
+ new InterruptedIOException().initCause(ex);
+ }
}
LOG.info("Finished lease recover attempt for " + p);
}
-
}