HBASE-3285 Hlog recovery takes too much time
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1078892 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e27a683cac
commit
87a95ec3e1
|
@ -142,6 +142,7 @@ Release 0.90.2 - Unreleased
|
|||
|
||||
IMPROVEMENTS
|
||||
HBASE-3542 MultiGet methods in Thrift
|
||||
HBASE-3285 Hlog recovery takes too much time
|
||||
|
||||
Release 0.90.1 - Unreleased
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue