public class ReplChangeManager extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ReplChangeManager.FileInfo |
static class |
ReplChangeManager.RecycleType |
Modifier and Type | Field and Description |
---|---|
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.
|
static String |
encodeFileUri(String fileUriStr,
String fileChecksum,
String encodedSubDir)
Concatenate filename, checksum, source cmroot uri and subdirectory with "#"
|
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(org.apache.hadoop.conf.Configuration conf) |
static String |
getReplPolicyIdString(Database db) |
static boolean |
isCMFileUri(org.apache.hadoop.fs.Path fromPath) |
static boolean |
isSourceOfReplication(Database db) |
int |
recycle(org.apache.hadoop.fs.Path path,
ReplChangeManager.RecycleType type,
boolean ifPurge)
Move a path into cmroot.
|
public static final String SOURCE_OF_REPLICATION
public static ReplChangeManager getInstance(org.apache.hadoop.conf.Configuration conf) throws MetaException
MetaException
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.IOException
public static String checksumFor(org.apache.hadoop.fs.Path path, org.apache.hadoop.fs.FileSystem fs) throws IOException
IOException
public static ReplChangeManager.FileInfo getFileInfo(org.apache.hadoop.fs.Path src, String checksumString, String srcCMRootURI, String subDir, org.apache.hadoop.conf.Configuration conf) throws MetaException
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 configurationMetaException
public static 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 "/"IOException
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 © 2022 The Apache Software Foundation. All rights reserved.