Package org.apache.hadoop.hbase.fs
Class ErasureCodingUtils
java.lang.Object
org.apache.hadoop.hbase.fs.ErasureCodingUtils
-
Nested Class Summary
Modifier and TypeClassDescriptionprivate static interface
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate static <T> T
callDfsMethod
(org.apache.hadoop.hdfs.DistributedFileSystem dfs, String name, Object... params) private static <T> T
callObjectMethod
(Object object, String name, Object... params) private static void
checkAvailable
(org.apache.hadoop.hdfs.DistributedFileSystem dfs, String requestedPolicy) private static boolean
checkPolicyMatch
(Object policyInfo, String requestedPolicy) private static org.apache.hadoop.fs.Path
createTempDir
(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path tempDir) static void
enablePolicy
(org.apache.hadoop.fs.FileSystem fs, String policy) private static org.apache.hadoop.hdfs.DistributedFileSystem
getDfs
(org.apache.hadoop.conf.Configuration conf) private static org.apache.hadoop.hdfs.DistributedFileSystem
getDfs
(org.apache.hadoop.fs.FileSystem fs) static String
getPolicyNameForPath
(org.apache.hadoop.hdfs.DistributedFileSystem dfs, org.apache.hadoop.fs.Path path) private static String
getPolicyNameFromInfo
(Object policyInfo) private static String
getPolicyNames
(Collection<Object> policyInfos) static boolean
needsSync
(TableDescriptor oldDescriptor, TableDescriptor newDescriptor) Check if EC policy is different between two descriptorsstatic void
Sets the EC policy on the pathstatic void
setPolicy
(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path rootDir, TableName tableName, String policy) Sets the EC policy on the table directory for the specified tablestatic void
sync
(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path rootDir, TableDescriptor newDescriptor) Sync the EC policy state from the newDescriptor onto the FS for the table dir of the provided table descriptor.static void
unsetPolicy
(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path rootDir, TableName tableName) Unsets any EC policy specified on the path.private static <T> T
static void
verifySupport
(org.apache.hadoop.conf.Configuration conf, String policy) Runs checks against the FileSystem, verifying that HDFS is supported and the policy is available, enabled, and works with a simple write.
-
Field Details
-
LOG
-
-
Constructor Details
-
ErasureCodingUtils
private ErasureCodingUtils()
-
-
Method Details
-
verifySupport
public static void verifySupport(org.apache.hadoop.conf.Configuration conf, String policy) throws HBaseIOException Runs checks against the FileSystem, verifying that HDFS is supported and the policy is available, enabled, and works with a simple write.- Throws:
HBaseIOException
-
createTempDir
private static org.apache.hadoop.fs.Path createTempDir(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path tempDir) throws HBaseIOException - Throws:
HBaseIOException
-
checkAvailable
private static void checkAvailable(org.apache.hadoop.hdfs.DistributedFileSystem dfs, String requestedPolicy) throws HBaseIOException - Throws:
HBaseIOException
-
checkPolicyMatch
private static boolean checkPolicyMatch(Object policyInfo, String requestedPolicy) throws DoNotRetryIOException - Throws:
DoNotRetryIOException
-
getPolicyNameFromInfo
- Throws:
IOException
-
getPolicyNames
-
needsSync
Check if EC policy is different between two descriptors- Returns:
- true if a sync is necessary
-
sync
public static void sync(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path rootDir, TableDescriptor newDescriptor) throws IOException Sync the EC policy state from the newDescriptor onto the FS for the table dir of the provided table descriptor. If the policy is null, we will remove erasure coding from the FS for the table dir. If it's non-null, we'll set it to that policy.- Parameters:
newDescriptor
- descriptor containing the policy and table name- Throws:
IOException
-
setPolicy
public static void setPolicy(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path rootDir, TableName tableName, String policy) throws IOException Sets the EC policy on the table directory for the specified table- Throws:
IOException
-
setPolicy
public static void setPolicy(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path, String policy) throws IOException Sets the EC policy on the path- Throws:
IOException
-
unsetPolicy
public static void unsetPolicy(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path rootDir, TableName tableName) throws IOException Unsets any EC policy specified on the path.- Throws:
IOException
-
enablePolicy
public static void enablePolicy(org.apache.hadoop.fs.FileSystem fs, String policy) throws IOException - Throws:
IOException
-
getDfs
private static org.apache.hadoop.hdfs.DistributedFileSystem getDfs(org.apache.hadoop.conf.Configuration conf) throws HBaseIOException - Throws:
HBaseIOException
-
getDfs
private static org.apache.hadoop.hdfs.DistributedFileSystem getDfs(org.apache.hadoop.fs.FileSystem fs) throws DoNotRetryIOException - Throws:
DoNotRetryIOException
-
getPolicyNameForPath
public static String getPolicyNameForPath(org.apache.hadoop.hdfs.DistributedFileSystem dfs, org.apache.hadoop.fs.Path path) throws IOException - Throws:
IOException
-
callDfsMethod
private static <T> T callDfsMethod(org.apache.hadoop.hdfs.DistributedFileSystem dfs, String name, Object... params) throws IOException - Throws:
IOException
-
callObjectMethod
private static <T> T callObjectMethod(Object object, String name, Object... params) throws IOException - Throws:
IOException
-
unwrapInvocationException
private static <T> T unwrapInvocationException(ErasureCodingUtils.ThrowingObjectSupplier runnable) throws IOException - Throws:
IOException
-