public class RenameOperation extends ExecutingStoreOperation<Long>
RenameTracker
the store provides.
The parallel execution is in groups of size
InternalConstants.RENAME_PARALLEL_LIMIT
; it is only
after one group completes that the next group is initiated.
Once enough files have been copied that they meet the
InternalConstants.MAX_ENTRIES_TO_DELETE
threshold, a delete
is initiated.
If it succeeds, the rename continues with the next group of files.
The RenameTracker has the task of keeping the metastore up to date
as the rename proceeds.
The rename operation implements the classic HDFS rename policy of
rename(file, dir) renames the file under the directory.
There is no validation of input and output paths.
Callers are required to themselves verify that destination is not under
the source, above the source, the source itself, etc, etc.Constructor and Description |
---|
RenameOperation(StoreContext storeContext,
org.apache.hadoop.fs.Path sourcePath,
String sourceKey,
S3AFileStatus sourceStatus,
org.apache.hadoop.fs.Path destPath,
String destKey,
S3AFileStatus destStatus,
OperationCallbacks callbacks,
int pageSize)
Initiate the rename.
|
Modifier and Type | Method and Description |
---|---|
Long |
execute()
Execute the operation.
|
protected CompletableFuture<org.apache.hadoop.fs.Path> |
initiateCopy(S3ALocatedFileStatus source,
String key,
org.apache.hadoop.fs.Path childSourcePath,
String newDestKey,
org.apache.hadoop.fs.Path childDestPath)
Initiate a copy operation in the executor.
|
protected void |
recursiveDirectoryRename()
Execute a full recursive rename.
|
protected void |
renameFileToDest()
The source is a file: rename it to the destination.
|
executeOnlyOnce
getStoreContext
public RenameOperation(StoreContext storeContext, org.apache.hadoop.fs.Path sourcePath, String sourceKey, S3AFileStatus sourceStatus, org.apache.hadoop.fs.Path destPath, String destKey, S3AFileStatus destStatus, OperationCallbacks callbacks, int pageSize)
storeContext
- store contextsourcePath
- source pathsourceKey
- key of sourcesourceStatus
- pre-fetched source statusdestPath
- destination path.destKey
- destination keydestStatus
- destination status.callbacks
- callback providerpageSize
- size of delete requests@Retries.RetryMixed public Long execute() throws IOException
ExecutingStoreOperation
ExecutingStoreOperation.executeOnlyOnce()
so as to force
the (atomic) re-entrancy check.execute
in class ExecutingStoreOperation<Long>
IOException
- IO problemprotected void renameFileToDest() throws IOException
IOException
- failureprotected void recursiveDirectoryRename() throws IOException
IOException
- failureprotected CompletableFuture<org.apache.hadoop.fs.Path> initiateCopy(S3ALocatedFileStatus source, String key, org.apache.hadoop.fs.Path childSourcePath, String newDestKey, org.apache.hadoop.fs.Path childDestPath)
source
- status of the source object.key
- source keychildSourcePath
- source as a path.newDestKey
- destination keychildDestPath
- destination path.Copyright © 2008–2020 Apache Software Foundation. All rights reserved.