Package org.apache.hadoop.hbase.util
Class RecoverLeaseFSUtils
java.lang.Object
org.apache.hadoop.hbase.util.RecoverLeaseFSUtils
Utility methods for recovering file lease for hdfs.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate static void
checkIfCancelled
(CancelableProgressable reporter) private static boolean
checkIfTimedout
(org.apache.hadoop.conf.Configuration conf, long recoveryTimeout, int nbAttempt, org.apache.hadoop.fs.Path p, long startWaiting) private static String
getLogMessageDetail
(int nbAttempt, org.apache.hadoop.fs.Path p, long startWaiting) Returns Detail to append to any log message around lease recovering.(package private) static void
initializeRecoverLeaseMethod
(String className) Initialize reflection classes and methods.private static boolean
isFileClosed
(org.apache.hadoop.fs.FileSystem dfs, Method m, org.apache.hadoop.fs.Path p) Call HDFS-4525 isFileClosed if it is available.static boolean
isLeaseRecoverable
(org.apache.hadoop.fs.FileSystem fs) private static boolean
recoverDFSFileLease
(org.apache.hadoop.fs.FileSystem dfs, org.apache.hadoop.fs.Path p, org.apache.hadoop.conf.Configuration conf, CancelableProgressable reporter) static void
recoverFileLease
(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path p, org.apache.hadoop.conf.Configuration conf) static void
recoverFileLease
(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path p, org.apache.hadoop.conf.Configuration conf, CancelableProgressable reporter) Recover the lease from Hadoop file system, retrying multiple times.private static boolean
recoverLease
(org.apache.hadoop.fs.FileSystem dfs, int nbAttempt, org.apache.hadoop.fs.Path p, long startWaiting) Try to recover the lease.
-
Field Details
-
LOG
-
leaseRecoverableClazz
-
recoverLeaseMethod
-
LEASE_RECOVERABLE_CLASS_NAME
- See Also:
-
-
Constructor Details
-
RecoverLeaseFSUtils
private RecoverLeaseFSUtils()
-
-
Method Details
-
initializeRecoverLeaseMethod
Initialize reflection classes and methods. If LeaseRecoverable class is not found, look for DistributedFilSystem#recoverLease method. -
recoverFileLease
public static void recoverFileLease(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path p, org.apache.hadoop.conf.Configuration conf) throws IOException - Throws:
IOException
-
recoverFileLease
public static void recoverFileLease(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path p, org.apache.hadoop.conf.Configuration conf, CancelableProgressable reporter) throws IOException Recover the lease from Hadoop file system, retrying multiple times.- Throws:
IOException
-
isLeaseRecoverable
-
recoverDFSFileLease
private static boolean recoverDFSFileLease(org.apache.hadoop.fs.FileSystem dfs, org.apache.hadoop.fs.Path p, org.apache.hadoop.conf.Configuration conf, CancelableProgressable reporter) throws IOException - Throws:
IOException
-
checkIfTimedout
private static boolean checkIfTimedout(org.apache.hadoop.conf.Configuration conf, long recoveryTimeout, int nbAttempt, org.apache.hadoop.fs.Path p, long startWaiting) -
recoverLease
private static boolean recoverLease(org.apache.hadoop.fs.FileSystem dfs, int nbAttempt, org.apache.hadoop.fs.Path p, long startWaiting) throws FileNotFoundException Try to recover the lease.- Returns:
- True if dfs#recoverLease came by true.
- Throws:
FileNotFoundException
-
getLogMessageDetail
private static String getLogMessageDetail(int nbAttempt, org.apache.hadoop.fs.Path p, long startWaiting) Returns Detail to append to any log message around lease recovering. -
isFileClosed
private static boolean isFileClosed(org.apache.hadoop.fs.FileSystem dfs, Method m, org.apache.hadoop.fs.Path p) Call HDFS-4525 isFileClosed if it is available.- Returns:
- True if file is closed.
-
checkIfCancelled
- Throws:
InterruptedIOException
-