Author: szetszwo
Date: Tue May 24 21:00:33 2011
New Revision: 1127287
URL: http://svn.apache.org/viewvc?rev=1127287&view=rev
Log:
svn merge -c 1102068 from trunk for HADOOP-7237.
Added:
hadoop/common/branches/yahoo-merge/src/java/org/apache/hadoop/fs/shell/Touchz.java
- copied unchanged from r1102068,
hadoop/common/trunk/src/java/org/apache/hadoop/fs/shell/Touchz.java
Modified:
hadoop/common/branches/yahoo-merge/ (props changed)
hadoop/common/branches/yahoo-merge/CHANGES.txt (contents, props changed)
hadoop/common/branches/yahoo-merge/src/contrib/ec2/ (props changed)
hadoop/common/branches/yahoo-merge/src/docs/ (props changed)
hadoop/common/branches/yahoo-merge/src/java/ (props changed)
hadoop/common/branches/yahoo-merge/src/java/org/apache/hadoop/fs/FsShell.java
hadoop/common/branches/yahoo-merge/src/java/org/apache/hadoop/fs/shell/FsCommand.java
hadoop/common/branches/yahoo-merge/src/test/core/ (props changed)
hadoop/common/branches/yahoo-merge/src/test/core/org/apache/hadoop/cli/testConf.xml
Propchange: hadoop/common/branches/yahoo-merge/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May 24 21:00:33 2011
@@ -1,2 +1,2 @@
-/hadoop/common/trunk:1043117,1076296,1078148,1080396,1081598,1082329,1082787-1082788,1084415,1084769,1085043,1085122,1086309,1087159,1087844,1090039,1090485,1091618,1091902,1091970,1092519,1092565,1094750,1095121,1095761,1096522,1096988,1099612,1099633,1100026,1100356,1100369,1100400,1101132,1101199,1101653,1102012
+/hadoop/common/trunk:1043117,1076296,1078148,1080396,1081598,1082329,1082787-1082788,1084415,1084769,1085043,1085122,1086309,1087159,1087844,1090039,1090485,1091618,1091902,1091970,1092519,1092565,1094750,1095121,1095761,1096522,1096988,1099612,1099633,1100026,1100356,1100369,1100400,1101132,1101199,1101653,1102012,1102068
/hadoop/core/branches/branch-0.19/core:713112
Modified: hadoop/common/branches/yahoo-merge/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hadoop/common/branches/yahoo-merge/CHANGES.txt?rev=1127287&r1=1127286&r2=1127287&view=diff
==============================================================================
--- hadoop/common/branches/yahoo-merge/CHANGES.txt (original)
+++ hadoop/common/branches/yahoo-merge/CHANGES.txt Tue May 24 21:00:33 2011
@@ -65,6 +65,9 @@ Trunk (unreleased changes)
HADOOP-7275. Refactor the stat commands to conform to new FsCommand
class. (Daryn Sharp via szetszwo)
+ HADOOP-7237. Refactor the touchz commands to conform to new FsCommand
+ class. (Daryn Sharp via szetszwo)
+
OPTIMIZATIONS
BUG FIXES
Propchange: hadoop/common/branches/yahoo-merge/CHANGES.txt
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May 24 21:00:33 2011
@@ -1,4 +1,4 @@
-/hadoop/common/trunk/CHANGES.txt:1043117,1076296,1078148,1080396,1081598,1082329,1082787-1082788,1084415,1084769,1085043,1085122,1086309,1087159,1087844,1090039,1090485,1091618,1091902,1091970,1092519,1092565,1092832,1094750,1095121,1095761,1096522,1096988,1099612,1099633,1100026,1100356,1100369,1100400,1101132,1101199,1101653,1102012
+/hadoop/common/trunk/CHANGES.txt:1043117,1076296,1078148,1080396,1081598,1082329,1082787-1082788,1084415,1084769,1085043,1085122,1086309,1087159,1087844,1090039,1090485,1091618,1091902,1091970,1092519,1092565,1092832,1094750,1095121,1095761,1096522,1096988,1099612,1099633,1100026,1100356,1100369,1100400,1101132,1101199,1101653,1102012,1102068
/hadoop/core/branches/branch-0.18/CHANGES.txt:727226
/hadoop/core/branches/branch-0.19/CHANGES.txt:713112
/hadoop/core/trunk/CHANGES.txt:776175-785643,785929-786278
Propchange: hadoop/common/branches/yahoo-merge/src/contrib/ec2/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May 24 21:00:33 2011
@@ -1,3 +1,3 @@
-/hadoop/common/trunk/src/contrib/ec2:1043117,1076296,1078148,1081598,1082329,1082787-1082788,1084415,1084769,1085043,1085122,1086309,1087159,1087844,1090039,1090485,1091618,1091902,1091970,1092519,1092565,1094750,1095121,1095761,1096522,1096988,1099612,1099633,1100026,1100356,1100369,1100400,1101132,1101199,1101653,1102012
+/hadoop/common/trunk/src/contrib/ec2:1043117,1076296,1078148,1081598,1082329,1082787-1082788,1084415,1084769,1085043,1085122,1086309,1087159,1087844,1090039,1090485,1091618,1091902,1091970,1092519,1092565,1094750,1095121,1095761,1096522,1096988,1099612,1099633,1100026,1100356,1100369,1100400,1101132,1101199,1101653,1102012,1102068
/hadoop/core/branches/branch-0.19/core/src/contrib/ec2:713112
/hadoop/core/trunk/src/contrib/ec2:776175-784663
Propchange: hadoop/common/branches/yahoo-merge/src/docs/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May 24 21:00:33 2011
@@ -1,2 +1,2 @@
-/hadoop/common/trunk/src/docs:1043117,1076296,1078148,1080396,1081598,1082329,1082787-1082788,1084415,1084769,1085043,1085122,1086309,1087159,1087844,1090039,1090485,1091618,1091902,1091970,1092519,1092565,1094750,1095121,1095761,1096522,1096988,1099612,1099633,1100026,1100356,1100369,1100400,1101132,1101199,1101653,1102012
+/hadoop/common/trunk/src/docs:1043117,1076296,1078148,1080396,1081598,1082329,1082787-1082788,1084415,1084769,1085043,1085122,1086309,1087159,1087844,1090039,1090485,1091618,1091902,1091970,1092519,1092565,1094750,1095121,1095761,1096522,1096988,1099612,1099633,1100026,1100356,1100369,1100400,1101132,1101199,1101653,1102012,1102068
/hadoop/core/branches/branch-0.19/src/docs:713112
Propchange: hadoop/common/branches/yahoo-merge/src/java/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May 24 21:00:33 2011
@@ -1,3 +1,3 @@
-/hadoop/common/trunk/src/java:1043117,1076296,1078148,1080396,1081598,1082329,1082787-1082788,1084415,1084769,1085043,1085122,1086309,1087159,1087844,1090039,1090485,1091618,1091902,1091970,1092519,1092565,1094750,1095121,1095761,1096522,1096988,1099612,1099633,1100026,1100356,1100369,1100400,1101132,1101199,1101653,1102012
+/hadoop/common/trunk/src/java:1043117,1076296,1078148,1080396,1081598,1082329,1082787-1082788,1084415,1084769,1085043,1085122,1086309,1087159,1087844,1090039,1090485,1091618,1091902,1091970,1092519,1092565,1094750,1095121,1095761,1096522,1096988,1099612,1099633,1100026,1100356,1100369,1100400,1101132,1101199,1101653,1102012,1102068
/hadoop/core/branches/branch-0.19/core/src/java:713112
/hadoop/core/trunk/src/core:776175-785643,785929-786278
Modified:
hadoop/common/branches/yahoo-merge/src/java/org/apache/hadoop/fs/FsShell.java
URL:
http://svn.apache.org/viewvc/hadoop/common/branches/yahoo-merge/src/java/org/apache/hadoop/fs/FsShell.java?rev=1127287&r1=1127286&r2=1127287&view=diff
==============================================================================
---
hadoop/common/branches/yahoo-merge/src/java/org/apache/hadoop/fs/FsShell.java
(original)
+++
hadoop/common/branches/yahoo-merge/src/java/org/apache/hadoop/fs/FsShell.java
Tue May 24 21:00:33 2011
@@ -432,27 +432,6 @@ public class FsShell extends Configured
}
/**
- * (Re)create zero-length file at the specified path.
- * This will be replaced by a more UNIX-like touch when files may be
- * modified.
- */
- void touchz(String src) throws IOException {
- Path f = new Path(src);
- FileSystem srcFs = f.getFileSystem(getConf());
- FileStatus st;
- if (srcFs.exists(f)) {
- st = srcFs.getFileStatus(f);
- if (st.isDirectory()) {
- // TODO: handle this
- throw new IOException(src + " is a directory");
- } else if (st.getLen() != 0)
- throw new IOException(src + " must be a zero-length file");
- }
- FSDataOutputStream out = srcFs.create(f);
- out.close();
- }
-
- /**
* Check file types.
*/
int test(String argv[], int i) throws IOException {
@@ -763,7 +742,7 @@ public class FsShell extends Configured
GET_SHORT_USAGE + "\n\t" +
"[" + COPYTOLOCAL_SHORT_USAGE + "] [-moveToLocal <src> <localdst>]\n\t" +
"[-report]\n\t" +
- "[-touchz <path>] [-test -[ezd] <path>]";
+ "[-test -[ezd] <path>]";
String conf ="-conf <configuration file>: Specify an application
configuration file.";
@@ -836,10 +815,6 @@ public class FsShell extends Configured
String moveToLocal = "-moveToLocal <src> <localdst>: Not implemented yet
\n";
- String touchz = "-touchz <path>: Creates a file of zero length\n"
- + "\t\t at <path> with current time as the timestamp of that <path>.\n"
- + "\t\t An error is returned if the file exists with non-zero length\n";
-
String test = "-test -[ezd] <path>: If file { exists, has zero length, is
a directory\n" +
"\t\tthen return 0, else return 1.\n";
@@ -887,8 +862,6 @@ public class FsShell extends Configured
System.out.println(moveToLocal);
} else if ("get".equals(cmd)) {
System.out.println(get);
- } else if ("touchz".equals(cmd)) {
- System.out.println(touchz);
} else if ("test".equals(cmd)) {
System.out.println(test);
} else if ("help".equals(cmd)) {
@@ -915,7 +888,6 @@ public class FsShell extends Configured
System.out.println(get);
System.out.println(copyToLocal);
System.out.println(moveToLocal);
- System.out.println(touchz);
System.out.println(test);
for (String thisCmdName : commandFactory.getNames()) {
@@ -972,8 +944,6 @@ public class FsShell extends Configured
delete(argv[i], true, rmSkipTrash);
} else if ("-df".equals(cmd)) {
df(argv[i]);
- } else if ("-touchz".equals(cmd)) {
- touchz(argv[i]);
}
} catch (IOException e) {
LOG.debug("Error", e);
@@ -1003,8 +973,7 @@ public class FsShell extends Configured
} else if ("-D".equals(cmd)) {
System.err.println("Usage: java FsShell" +
" [-D <[property=value>]");
- } else if ("-du".equals(cmd) || "-dus".equals(cmd) ||
- "-touchz".equals(cmd)) {
+ } else if ("-du".equals(cmd) || "-dus".equals(cmd)) {
System.err.println("Usage: java FsShell" +
" [" + cmd + " <path>]");
} else if ("-df".equals(cmd) ) {
@@ -1046,7 +1015,6 @@ public class FsShell extends Configured
System.err.println(" [" + GET_SHORT_USAGE + "]");
System.err.println(" [" + COPYTOLOCAL_SHORT_USAGE + "]");
System.err.println(" [-moveToLocal [-crc] <src> <localdst>]");
- System.err.println(" [-touchz <path>]");
System.err.println(" [-test -[ezd] <path>]");
for (String name : commandFactory.getNames()) {
instance = commandFactory.getInstance(name);
@@ -1096,8 +1064,7 @@ public class FsShell extends Configured
printUsage(cmd);
return exitCode;
}
- } else if ("-rm".equals(cmd) || "-rmr".equals(cmd) ||
- "-touchz".equals(cmd)) {
+ } else if ("-rm".equals(cmd) || "-rmr".equals(cmd)) {
if (argv.length < 2) {
printUsage(cmd);
return exitCode;
@@ -1166,8 +1133,6 @@ public class FsShell extends Configured
du(argv, i);
} else if ("-dus".equals(cmd)) {
dus(argv, i);
- } else if ("-touchz".equals(cmd)) {
- exitCode = doall(cmd, argv, i);
} else if ("-test".equals(cmd)) {
exitCode = test(argv, i);
} else if ("-help".equals(cmd)) {
Modified:
hadoop/common/branches/yahoo-merge/src/java/org/apache/hadoop/fs/shell/FsCommand.java
URL:
http://svn.apache.org/viewvc/hadoop/common/branches/yahoo-merge/src/java/org/apache/hadoop/fs/shell/FsCommand.java?rev=1127287&r1=1127286&r2=1127287&view=diff
==============================================================================
---
hadoop/common/branches/yahoo-merge/src/java/org/apache/hadoop/fs/shell/FsCommand.java
(original)
+++
hadoop/common/branches/yahoo-merge/src/java/org/apache/hadoop/fs/shell/FsCommand.java
Tue May 24 21:00:33 2011
@@ -52,6 +52,7 @@ abstract public class FsCommand extends
factory.registerCommands(SetReplication.class);
factory.registerCommands(Stat.class);
factory.registerCommands(Tail.class);
+ factory.registerCommands(Touch.class);
}
protected FsCommand() {}
Propchange: hadoop/common/branches/yahoo-merge/src/test/core/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May 24 21:00:33 2011
@@ -1,3 +1,3 @@
-/hadoop/common/trunk/src/test/core:1043117,1076296,1078148,1080396,1081598,1082329,1082787-1082788,1084415,1084769,1085043,1085122,1086309,1087159,1087844,1090039,1090485,1091618,1091902,1091970,1092519,1092565,1094750,1095121,1095761,1096522,1096988,1099612,1099633,1100026,1100356,1100369,1100400,1101132,1101199,1101653,1102012
+/hadoop/common/trunk/src/test/core:1043117,1076296,1078148,1080396,1081598,1082329,1082787-1082788,1084415,1084769,1085043,1085122,1086309,1087159,1087844,1090039,1090485,1091618,1091902,1091970,1092519,1092565,1094750,1095121,1095761,1096522,1096988,1099612,1099633,1100026,1100356,1100369,1100400,1101132,1101199,1101653,1102012,1102068
/hadoop/core/branches/branch-0.19/core/src/test/core:713112
/hadoop/core/trunk/src/test/core:776175-785643,785929-786278
Modified:
hadoop/common/branches/yahoo-merge/src/test/core/org/apache/hadoop/cli/testConf.xml
URL:
http://svn.apache.org/viewvc/hadoop/common/branches/yahoo-merge/src/test/core/org/apache/hadoop/cli/testConf.xml?rev=1127287&r1=1127286&r2=1127287&view=diff
==============================================================================
---
hadoop/common/branches/yahoo-merge/src/test/core/org/apache/hadoop/cli/testConf.xml
(original)
+++
hadoop/common/branches/yahoo-merge/src/test/core/org/apache/hadoop/cli/testConf.xml
Tue May 24 21:00:33 2011
@@ -541,7 +541,7 @@
<comparators>
<comparator>
<type>RegexpComparator</type>
- <expected-output>^-touchz <path>: Creates a file of zero
length( )*</expected-output>
+ <expected-output>^-touchz <path> \.\.\.:( |\t)*Creates a file
of zero length( )*</expected-output>
</comparator>
<comparator>
<type>RegexpComparator</type>
@@ -549,7 +549,7 @@
</comparator>
<comparator>
<type>RegexpComparator</type>
- <expected-output>^( |\t)* An error is returned if the file exists
with non-zero length( )*</expected-output>
+ <expected-output>^( |\t)*An error is returned if the file exists
with non-zero length( )*</expected-output>
</comparator>
</comparators>
</test>