HADOOP-12460. Add overwrite option for 'get' shell command (Contributed by Jagadesh Kiran N)
(cherry picked from commit 7f0e1eb43d
)
This commit is contained in:
parent
23bd017a7b
commit
b6dce3834d
|
@ -306,6 +306,9 @@ Release 2.8.0 - UNRELEASED
|
||||||
HADOOP-12481. JWTRedirectAuthenticationHandler doesn't Retain Original Query
|
HADOOP-12481. JWTRedirectAuthenticationHandler doesn't Retain Original Query
|
||||||
String (Larry McCay via cnauroth)
|
String (Larry McCay via cnauroth)
|
||||||
|
|
||||||
|
HADOOP-12460. Add overwrite option for 'get' shell command
|
||||||
|
(Jagadesh Kiran N via vinayakumarb)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
HADOOP-11785. Reduce the number of listStatus operation in distcp
|
HADOOP-11785. Reduce the number of listStatus operation in distcp
|
||||||
|
|
|
@ -191,11 +191,12 @@ private void popPreserveOption(List<String> args) {
|
||||||
public static class Get extends CommandWithDestination {
|
public static class Get extends CommandWithDestination {
|
||||||
public static final String NAME = "get";
|
public static final String NAME = "get";
|
||||||
public static final String USAGE =
|
public static final String USAGE =
|
||||||
"[-p] [-ignoreCrc] [-crc] <src> ... <localdst>";
|
"[-f] [-p] [-ignoreCrc] [-crc] <src> ... <localdst>";
|
||||||
public static final String DESCRIPTION =
|
public static final String DESCRIPTION =
|
||||||
"Copy files that match the file pattern <src> " +
|
"Copy files that match the file pattern <src> " +
|
||||||
"to the local name. <src> is kept. When copying multiple " +
|
"to the local name. <src> is kept. When copying multiple " +
|
||||||
"files, the destination must be a directory. Passing " +
|
"files, the destination must be a directory. Passing " +
|
||||||
|
"-f overwrites the destination if it already exists and " +
|
||||||
"-p preserves access and modification times, " +
|
"-p preserves access and modification times, " +
|
||||||
"ownership and the mode.\n";
|
"ownership and the mode.\n";
|
||||||
|
|
||||||
|
@ -203,11 +204,12 @@ public static class Get extends CommandWithDestination {
|
||||||
protected void processOptions(LinkedList<String> args)
|
protected void processOptions(LinkedList<String> args)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
CommandFormat cf = new CommandFormat(
|
CommandFormat cf = new CommandFormat(
|
||||||
1, Integer.MAX_VALUE, "crc", "ignoreCrc", "p");
|
1, Integer.MAX_VALUE, "crc", "ignoreCrc", "p", "f");
|
||||||
cf.parse(args);
|
cf.parse(args);
|
||||||
setWriteChecksum(cf.getOpt("crc"));
|
setWriteChecksum(cf.getOpt("crc"));
|
||||||
setVerifyChecksum(!cf.getOpt("ignoreCrc"));
|
setVerifyChecksum(!cf.getOpt("ignoreCrc"));
|
||||||
setPreserve(cf.getOpt("p"));
|
setPreserve(cf.getOpt("p"));
|
||||||
|
setOverwrite(cf.getOpt("f"));
|
||||||
setRecursive(true);
|
setRecursive(true);
|
||||||
getLocalDestination(args);
|
getLocalDestination(args);
|
||||||
}
|
}
|
||||||
|
|
|
@ -320,6 +320,10 @@ Exit Code:
|
||||||
|
|
||||||
Returns 0 on success and -1 on error.
|
Returns 0 on success and -1 on error.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
|
||||||
|
The -f option will overwrite the destination if it already exists.
|
||||||
|
|
||||||
getfacl
|
getfacl
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
|
|
@ -165,7 +165,7 @@
|
||||||
<comparators>
|
<comparators>
|
||||||
<comparator>
|
<comparator>
|
||||||
<type>RegexpComparator</type>
|
<type>RegexpComparator</type>
|
||||||
<expected-output>^-get( )*\[-p\]( )*\[-ignoreCrc\]( )*\[-crc\]( )*<src> \.\.\. <localdst> :\s*</expected-output>
|
<expected-output>^-get( )*\[-f\]( )*\[-p\]( )*\[-ignoreCrc\]( )*\[-crc\]( )*<src> \.\.\. <localdst> :\s*</expected-output>
|
||||||
</comparator>
|
</comparator>
|
||||||
<comparator>
|
<comparator>
|
||||||
<type>RegexpComparator</type>
|
<type>RegexpComparator</type>
|
||||||
|
@ -173,11 +173,15 @@
|
||||||
</comparator>
|
</comparator>
|
||||||
<comparator>
|
<comparator>
|
||||||
<type>RegexpComparator</type>
|
<type>RegexpComparator</type>
|
||||||
<expected-output>\s*When copying multiple files, the destination must be a directory. Passing -p\s*</expected-output>
|
<expected-output>^( |\t)*When copying multiple files, the destination must be a directory. Passing -f( )*</expected-output>
|
||||||
</comparator>
|
</comparator>
|
||||||
<comparator>
|
<comparator>
|
||||||
<type>RegexpComparator</type>
|
<type>RegexpComparator</type>
|
||||||
<expected-output>^( |\t)*preserves access and modification times, ownership and the mode.*</expected-output>
|
<expected-output>^( |\t)*overwrites the destination if it already exists and -p preserves access and( )*</expected-output>
|
||||||
|
</comparator>
|
||||||
|
<comparator>
|
||||||
|
<type>RegexpComparator</type>
|
||||||
|
<expected-output>^( |\t)*modification times, ownership and the mode.*</expected-output>
|
||||||
</comparator>
|
</comparator>
|
||||||
</comparators>
|
</comparators>
|
||||||
</test>
|
</test>
|
||||||
|
@ -566,7 +570,7 @@
|
||||||
<comparators>
|
<comparators>
|
||||||
<comparator>
|
<comparator>
|
||||||
<type>RegexpComparator</type>
|
<type>RegexpComparator</type>
|
||||||
<expected-output>^-get( )*\[-p\]( )*\[-ignoreCrc\]( )*\[-crc\]( )*<src> \.\.\. <localdst> :\s*</expected-output>
|
<expected-output>^-get( )*\[-f\]( )*\[-p\]( )*\[-ignoreCrc\]( )*\[-crc\]( )*<src> \.\.\. <localdst> :\s*</expected-output>
|
||||||
</comparator>
|
</comparator>
|
||||||
<comparator>
|
<comparator>
|
||||||
<type>RegexpComparator</type>
|
<type>RegexpComparator</type>
|
||||||
|
@ -574,11 +578,15 @@
|
||||||
</comparator>
|
</comparator>
|
||||||
<comparator>
|
<comparator>
|
||||||
<type>RegexpComparator</type>
|
<type>RegexpComparator</type>
|
||||||
<expected-output>^( |\t)*When copying multiple files, the destination must be a directory. Passing -p( )*</expected-output>
|
<expected-output>^( |\t)*When copying multiple files, the destination must be a directory. Passing -f( )*</expected-output>
|
||||||
</comparator>
|
</comparator>
|
||||||
<comparator>
|
<comparator>
|
||||||
<type>RegexpComparator</type>
|
<type>RegexpComparator</type>
|
||||||
<expected-output>^( |\t)*preserves access and modification times, ownership and the mode.( )*</expected-output>
|
<expected-output>^( |\t)*overwrites the destination if it already exists and -p preserves access and( )*</expected-output>
|
||||||
|
</comparator>
|
||||||
|
<comparator>
|
||||||
|
<type>RegexpComparator</type>
|
||||||
|
<expected-output>^( |\t)*modification times, ownership and the mode.*</expected-output>
|
||||||
</comparator>
|
</comparator>
|
||||||
</comparators>
|
</comparators>
|
||||||
</test>
|
</test>
|
||||||
|
@ -680,7 +688,7 @@
|
||||||
<comparators>
|
<comparators>
|
||||||
<comparator>
|
<comparator>
|
||||||
<type>RegexpComparator</type>
|
<type>RegexpComparator</type>
|
||||||
<expected-output>^-copyToLocal \[-p\] \[-ignoreCrc\] \[-crc\] <src> \.\.\. <localdst> :\s*</expected-output>
|
<expected-output>^-copyToLocal \[-f\] \[-p\] \[-ignoreCrc\] \[-crc\] <src> \.\.\. <localdst> :\s*</expected-output>
|
||||||
</comparator>
|
</comparator>
|
||||||
<comparator>
|
<comparator>
|
||||||
<type>RegexpComparator</type>
|
<type>RegexpComparator</type>
|
||||||
|
|
Loading…
Reference in New Issue