Class HFileReplicator
java.lang.Object
org.apache.hadoop.hbase.replication.regionserver.HFileReplicator
- All Implemented Interfaces:
Closeable,AutoCloseable
It is used for replicating HFile entries. It will first copy parallely all the hfiles to a local
staging directory and then it will use (
BulkLoadHFiles to prepare a collection of
BulkLoadHFiles.LoadQueueItem which will finally be loaded(replicated) into the table of this cluster.
Call close() when done.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classThis class will copy the given hfiles from the given source file system to the given local file system staging directory. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.apache.hadoop.conf.Configurationprivate AsyncClusterConnectionprivate intprivate ThreadPoolExecutorprivate FsDelegationTokenprivate org.apache.hadoop.fs.Pathprivate static final org.slf4j.Loggerprivate intprivate static final org.apache.hadoop.fs.permission.FsPermissionstatic final intstatic final StringNumber of hfiles to copy per thread during replicationstatic final intstatic final StringMaximum number of threads to allow in pool to copy hfiles during replicationprivate org.apache.hadoop.fs.FileSystemprivate Stringprivate org.apache.hadoop.conf.Configurationprivate Stringprivate static final Stringprivate UserProvider -
Constructor Summary
ConstructorsConstructorDescriptionHFileReplicator(org.apache.hadoop.conf.Configuration sourceClusterConf, String sourceBaseNamespaceDirPath, String sourceHFileArchiveDirPath, Map<String, List<Pair<byte[], List<String>>>> tableQueueMap, org.apache.hadoop.conf.Configuration conf, AsyncClusterConnection connection, List<String> sourceClusterIds) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidcleanup(org.apache.hadoop.fs.Path stagingDir) voidclose()private org.apache.hadoop.fs.PathcreateStagingDir(org.apache.hadoop.fs.Path baseDir, User user, String randomDir) private org.apache.hadoop.fs.PathcreateStagingDir(org.apache.hadoop.fs.Path baseDir, User user, TableName tableName) private voiddoBulkLoad(org.apache.hadoop.conf.Configuration conf, TableName tableName, org.apache.hadoop.fs.Path stagingDir, Deque<BulkLoadHFiles.LoadQueueItem> queue, int maxRetries)
-
Field Details
-
REPLICATION_BULKLOAD_COPY_MAXTHREADS_KEY
Maximum number of threads to allow in pool to copy hfiles during replication- See Also:
-
REPLICATION_BULKLOAD_COPY_MAXTHREADS_DEFAULT
- See Also:
-
REPLICATION_BULKLOAD_COPY_HFILES_PERTHREAD_KEY
Number of hfiles to copy per thread during replication- See Also:
-
REPLICATION_BULKLOAD_COPY_HFILES_PERTHREAD_DEFAULT
- See Also:
-
LOG
-
UNDERSCORE
- See Also:
-
PERM_ALL_ACCESS
-
sourceClusterConf
-
sourceBaseNamespaceDirPath
-
sourceHFileArchiveDirPath
-
bulkLoadHFileMap
-
sinkFs
-
fsDelegationToken
-
userProvider
-
conf
-
connection
-
hbaseStagingDir
-
exec
-
maxCopyThreads
-
copiesPerThread
-
sourceClusterIds
-
-
Constructor Details
-
HFileReplicator
public HFileReplicator(org.apache.hadoop.conf.Configuration sourceClusterConf, String sourceBaseNamespaceDirPath, String sourceHFileArchiveDirPath, Map<String, List<Pair<byte[], throws IOExceptionList<String>>>> tableQueueMap, org.apache.hadoop.conf.Configuration conf, AsyncClusterConnection connection, List<String> sourceClusterIds) - Throws:
IOException
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
replicate
- Throws:
IOException
-
doBulkLoad
private void doBulkLoad(org.apache.hadoop.conf.Configuration conf, TableName tableName, org.apache.hadoop.fs.Path stagingDir, Deque<BulkLoadHFiles.LoadQueueItem> queue, int maxRetries) throws IOException - Throws:
IOException
-
cleanup
-
copyHFilesToStagingDir
- Throws:
IOException
-
createStagingDir
private org.apache.hadoop.fs.Path createStagingDir(org.apache.hadoop.fs.Path baseDir, User user, TableName tableName) throws IOException - Throws:
IOException
-
createStagingDir
private org.apache.hadoop.fs.Path createStagingDir(org.apache.hadoop.fs.Path baseDir, User user, String randomDir) throws IOException - Throws:
IOException
-