Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Copy, Rename and delete FileAction #773

Merged
merged 6 commits into from
Jul 26, 2017
Merged

Copy, Rename and delete FileAction #773

merged 6 commits into from
Jul 26, 2017

Conversation

qiyuangong
Copy link
Contributor

  • CopyFileAction
  • RenameFileAction
  • DeleteFileAction

qiyuangong and others added 5 commits July 21, 2017 14:05
* Modify ReadAction
* CopyFileAction basic.
* Finish single file copy.
* Rename constant values.
	Modify DeleteFileAction.
	Add RenameFileAction and DeleteFileAction to HdfsActionFactory.
Configuration conf = new Configuration();
//get FileSystem object
FileSystem fs = FileSystem.get(URI.create(filePath), conf);
if (!fs.exists(new Path(filePath))){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a blank before {

}
appendLog(
String.format("Action starts at %s : Read %s", Utils.getFormatedCurrentTime(), srcPath));
if (!dfsClient.exists(srcPath)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to check the existence of dstPath too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need more parameters from configuration/map. Will be done later.

//get FileSystem object
FileSystem fs = FileSystem.get(URI.create(dest), conf);
return fs.rename(new Path(src), new Path(dest));
} else if (!dest.startsWith("hdfs") && !src.startsWith("hdfs")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about the following case: dest prefixed with the default hdfs uri while src not, the two path are in the same cluster

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That should be done after url handler is finished.

@littlezhou littlezhou merged commit 1c27ec6 into trunk Jul 26, 2017
@qiyuangong qiyuangong deleted the disaster-recovery branch July 26, 2017 02:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants