HBASE-7878 Addendum for trying fs.append in case recoverLease throws exception

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1450928 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2013-02-27 19:16:37 +00:00
parent 76314737e3
commit 21eda243ad
1 changed files with 4 additions and 6 deletions

View File

@ -91,15 +91,13 @@ public class FSHDFSUtils extends FSUtils{
throw (IOException) ite.getCause(); throw (IOException) ite.getCause();
} }
} catch (Exception e) { } catch (Exception e) {
// hdfs 2.0 may throw RecoveryInProgressException
if (!e.getClass().getName().contains("RecoveryInProgressException")) {
LOG.debug("Failed fs.recoverLease invocation, " + e.toString() + LOG.debug("Failed fs.recoverLease invocation, " + e.toString() +
", trying fs.append instead"); ", trying fs.append instead");
ex = e; ex = e;
} }
}
if (ex != null || System.currentTimeMillis() - startWaiting > recoveryTimeout) { if (ex != null || System.currentTimeMillis() - startWaiting > recoveryTimeout) {
ex = null; // assume the following append() call would succeed ex = null; // assume the following append() call would succeed
LOG.debug("trying fs.append for " + p);
FSDataOutputStream out = fs.append(p); FSDataOutputStream out = fs.append(p);
out.close(); out.close();
recovered = true; recovered = true;