boolean checkIfTimedout(final Configuration conf, final long recoveryTimeout, final int nbAttempt, final Path p, final long startWaiting) { if (recoveryTimeout < System.currentTimeMillis()) { LOG.warn("Cannot recoverLease after trying for " + conf.getInt("hbase.lease.recovery.timeout", 900000) + "ms (hbase.lease.recovery.timeout); continuing, but may be DATALOSS!!!; " + getLogMessageDetail(nbAttempt, p, startWaiting)); return true; } return false; }
/** * Recover the lease from HDFS, retrying multiple times. */ public void recoverFileLease(final FileSystem fs, final Path p, Configuration conf) throws IOException { // lease recovery not needed for local file system case. if (!(fs instanceof DistributedFileSystem)) { return; } recoverDFSFileLease((DistributedFileSystem) fs, p, conf); }
recovered = recoverLease(dfs, nbAttempt, p, startWaiting); if (recovered || checkIfTimedout(conf, recoveryTimeout, nbAttempt, p, startWaiting)) { break; if (isFileClosedMeth != null && isFileClosed(dfs, isFileClosedMeth, p)) { recovered = true; break;
HDFSUtil hdfsUtil = new HDFSUtil(); hdfsUtil.recoverFileLease(fs, logPath, hConf); try { FileStatus newStatus = fs.getFileStatus(logPath);
recovered = recoverLease(dfs, nbAttempt, p, startWaiting); if (recovered || checkIfTimedout(conf, recoveryTimeout, nbAttempt, p, startWaiting)) { break; if (isFileClosedMeth != null && isFileClosed(dfs, isFileClosedMeth, p)) { recovered = true; break;
HDFSUtil hdfsUtil = new HDFSUtil(); hdfsUtil.recoverFileLease(fs, logPath, hConf); try { FileStatus newStatus = fs.getFileStatus(logPath);
boolean checkIfTimedout(final Configuration conf, final long recoveryTimeout, final int nbAttempt, final Path p, final long startWaiting) { if (recoveryTimeout < System.currentTimeMillis()) { LOG.warn("Cannot recoverLease after trying for " + conf.getInt("hbase.lease.recovery.timeout", 900000) + "ms (hbase.lease.recovery.timeout); continuing, but may be DATALOSS!!!; " + getLogMessageDetail(nbAttempt, p, startWaiting)); return true; } return false; }
/** * Recover the lease from HDFS, retrying multiple times. */ public void recoverFileLease(final FileSystem fs, final Path p, Configuration conf) throws IOException { // lease recovery not needed for local file system case. if (!(fs instanceof DistributedFileSystem)) { return; } recoverDFSFileLease((DistributedFileSystem) fs, p, conf); }
/** * Try to recover the lease. * @param dfs The filesystem instance. * @param nbAttempt Count number of this attempt. * @param p Path of the file to recover. * @param startWaiting Timestamp of when we started attempting to recover the file lease. * @return True if dfs#recoverLease came by true. * @throws java.io.FileNotFoundException */ boolean recoverLease(final DistributedFileSystem dfs, final int nbAttempt, final Path p, final long startWaiting) throws FileNotFoundException { boolean recovered = false; try { recovered = dfs.recoverLease(p); LOG.info("recoverLease=" + recovered + ", " + getLogMessageDetail(nbAttempt, p, startWaiting)); } catch (IOException e) { if (e instanceof LeaseExpiredException && e.getMessage().contains("File does not exist")) { // This exception comes out instead of FNFE, fix it throw new FileNotFoundException("The given file wasn't found at " + p); } else if (e instanceof FileNotFoundException) { throw (FileNotFoundException) e; } LOG.warn(getLogMessageDetail(nbAttempt, p, startWaiting), e); } return recovered; }
/** * Try to recover the lease. * @param dfs The filesystem instance. * @param nbAttempt Count number of this attempt. * @param p Path of the file to recover. * @param startWaiting Timestamp of when we started attempting to recover the file lease. * @return True if dfs#recoverLease came by true. * @throws java.io.FileNotFoundException */ boolean recoverLease(final DistributedFileSystem dfs, final int nbAttempt, final Path p, final long startWaiting) throws FileNotFoundException { boolean recovered = false; try { recovered = dfs.recoverLease(p); LOG.info("recoverLease=" + recovered + ", " + getLogMessageDetail(nbAttempt, p, startWaiting)); } catch (IOException e) { if (e instanceof LeaseExpiredException && e.getMessage().contains("File does not exist")) { // This exception comes out instead of FNFE, fix it throw new FileNotFoundException("The given file wasn't found at " + p); } else if (e instanceof FileNotFoundException) { throw (FileNotFoundException) e; } LOG.warn(getLogMessageDetail(nbAttempt, p, startWaiting), e); } return recovered; }