public class ReplChangeManager extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ReplChangeManager.CMClearer
Thread to clear old files of cmroot recursively
|
static class |
ReplChangeManager.FileInfo |
static class |
ReplChangeManager.RecycleType |
| Modifier and Type | Field and Description |
|---|---|
static String |
CM_THREAD_NAME_PREFIX |
static org.apache.hadoop.fs.PathFilter |
CMROOT_PATH_FILTER |
static String |
SOURCE_OF_REPLICATION |
| Modifier and Type | Method and Description |
|---|---|
static String |
checksumFor(org.apache.hadoop.fs.Path path,
org.apache.hadoop.fs.FileSystem fs) |
static String[] |
decodeFileUri(String fileURIStr)
Split uri with fragment into file uri, subdirs, checksum and source cmroot uri.
|
String |
encodeFileUri(String fileUriStr,
String fileChecksum,
String encodedSubDir)
Concatenate filename, checksum, source cmroot uri and subdirectory with "#"
|
static String |
encodeFileUri(String fileUriStr,
String fileChecksum,
String cmRoot,
String encodedSubDir) |
static ReplChangeManager.FileInfo |
getFileInfo(org.apache.hadoop.fs.Path src,
String checksumString,
String srcCMRootURI,
String subDir,
org.apache.hadoop.conf.Configuration conf)
Get original file specified by src and chksumString.
|
static ReplChangeManager |
getInstance() |
static ReplChangeManager |
getInstance(org.apache.hadoop.conf.Configuration conf) |
static String[] |
getListFromSeparatedString(String commaSeparatedString) |
static String |
getReplPolicyIdString(Database db) |
static boolean |
isCMFileUri(org.apache.hadoop.fs.Path fromPath) |
static boolean |
isSourceOfReplication(Database db) |
static String |
joinWithSeparator(Iterable<?> strings) |
int |
recycle(org.apache.hadoop.fs.Path path,
ReplChangeManager.RecycleType type,
boolean ifPurge)
Move a path into cmroot.
|
static boolean |
shouldEnableCm(Database db,
Table table) |
public static final String SOURCE_OF_REPLICATION
public static final String CM_THREAD_NAME_PREFIX
public static final org.apache.hadoop.fs.PathFilter CMROOT_PATH_FILTER
public static ReplChangeManager getInstance(org.apache.hadoop.conf.Configuration conf) throws MetaException
MetaExceptionpublic static ReplChangeManager getInstance()
public int recycle(org.apache.hadoop.fs.Path path,
ReplChangeManager.RecycleType type,
boolean ifPurge)
throws IOException
path - a single file or directorytype - if the files to be copied or moved to cmpath.
Copy is costly but preserve the source fileifPurge - if the file should skip Trash when move/delete source file.
This is referred only if type is MOVE.IOExceptionpublic static String checksumFor(org.apache.hadoop.fs.Path path, org.apache.hadoop.fs.FileSystem fs) throws IOException
IOExceptionpublic static ReplChangeManager.FileInfo getFileInfo(org.apache.hadoop.fs.Path src, String checksumString, String srcCMRootURI, String subDir, org.apache.hadoop.conf.Configuration conf) throws IOException
src - Original file locationchecksumString - Checksum of the original filesrcCMRootURI - CM root URI of the source clustersubDir - Sub directory to which the source file belongs toconf - Hive configurationIOExceptionpublic String encodeFileUri(String fileUriStr, String fileChecksum, String encodedSubDir) throws IOException
fileUriStr - Filename stringfileChecksum - Checksum stringencodedSubDir - sub directory path into which this file belongs to. Here encoded means,
the multiple levels of subdirectories are concatenated with path separator "/"IOExceptionpublic static String encodeFileUri(String fileUriStr, String fileChecksum, String cmRoot, String encodedSubDir)
public static String[] decodeFileUri(String fileURIStr)
fileURIStr - uri with fragmentpublic static boolean isCMFileUri(org.apache.hadoop.fs.Path fromPath)
public static boolean isSourceOfReplication(Database db)
Copyright © 2024 The Apache Software Foundation. All rights reserved.