You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by zh...@apache.org on 2015/01/20 18:44:24 UTC
[15/44] hadoop git commit: HADOOP-11318. Update the document for
hadoop fs -stat
HADOOP-11318. Update the document for hadoop fs -stat
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/51df20c9
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/51df20c9
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/51df20c9
Branch: refs/heads/HDFS-EC
Commit: 51df20c969716c398f5c9e3e048d99ebabefb36d
Parents: 51ac0b2
Author: Akira Ajisaka <aa...@apache.org>
Authored: Fri Jan 16 00:55:20 2015 +0900
Committer: Zhe Zhang <zh...@apache.org>
Committed: Tue Jan 20 09:43:09 2015 -0800
----------------------------------------------------------------------
hadoop-common-project/hadoop-common/CHANGES.txt | 2 ++
.../java/org/apache/hadoop/fs/shell/Stat.java | 33 +++++++++++++-------
.../src/site/apt/FileSystemShell.apt.vm | 11 +++++--
.../src/test/resources/testConf.xml | 24 +++++++++++---
4 files changed, 51 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/51df20c9/hadoop-common-project/hadoop-common/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt
index 3f916a2..f80eeab 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -499,6 +499,8 @@ Release 2.7.0 - UNRELEASED
BUG FIXES
+ HADOOP-11318. Update the document for hadoop fs -stat (aajisaka)
+
HADOOP 11400. GraphiteSink does not reconnect to Graphite after 'broken pipe'
(Kamil Gorlo via raviprak)
http://git-wip-us.apache.org/repos/asf/hadoop/blob/51df20c9/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Stat.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Stat.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Stat.java
index 6365294..458d3ee 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Stat.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Stat.java
@@ -30,15 +30,17 @@ import org.apache.hadoop.fs.FileStatus;
/**
* Print statistics about path in specified format.
- * Format sequences:
- * %b: Size of file in blocks
- * %g: Group name of owner
- * %n: Filename
- * %o: Block size
- * %r: replication
- * %u: User name of owner
- * %y: UTC date as "yyyy-MM-dd HH:mm:ss"
- * %Y: Milliseconds since January 1, 1970 UTC
+ * Format sequences:<br>
+ * %b: Size of file in blocks<br>
+ * %F: Type<br>
+ * %g: Group name of owner<br>
+ * %n: Filename<br>
+ * %o: Block size<br>
+ * %r: replication<br>
+ * %u: User name of owner<br>
+ * %y: UTC date as "yyyy-MM-dd HH:mm:ss"<br>
+ * %Y: Milliseconds since January 1, 1970 UTC<br>
+ * If the format is not specified, %y is used by default.
*/
@InterfaceAudience.Private
@InterfaceStability.Unstable
@@ -48,12 +50,19 @@ class Stat extends FsCommand {
factory.addClass(Stat.class, "-stat");
}
+ private static final String NEWLINE = System.getProperty("line.separator");
+
public static final String NAME = "stat";
public static final String USAGE = "[format] <path> ...";
public static final String DESCRIPTION =
- "Print statistics about the file/directory at <path> " +
- "in the specified format. Format accepts filesize in blocks (%b), group name of owner(%g), " +
- "filename (%n), block size (%o), replication (%r), user name of owner(%u), modification date (%y, %Y)\n";
+ "Print statistics about the file/directory at <path>" + NEWLINE +
+ "in the specified format. Format accepts filesize in" + NEWLINE +
+ "blocks (%b), type (%F), group name of owner (%g)," + NEWLINE +
+ "name (%n), block size (%o), replication (%r), user name" + NEWLINE +
+ "of owner (%u), modification date (%y, %Y)." + NEWLINE +
+ "%y shows UTC date as \"yyyy-MM-dd HH:mm:ss\" and" + NEWLINE +
+ "%Y shows milliseconds since January 1, 1970 UTC." + NEWLINE +
+ "If the format is not specified, %y is used by default." + NEWLINE;
protected final SimpleDateFormat timeFmt;
{
http://git-wip-us.apache.org/repos/asf/hadoop/blob/51df20c9/hadoop-common-project/hadoop-common/src/site/apt/FileSystemShell.apt.vm
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/site/apt/FileSystemShell.apt.vm b/hadoop-common-project/hadoop-common/src/site/apt/FileSystemShell.apt.vm
index 757a0ba..5dfbd20 100644
--- a/hadoop-common-project/hadoop-common/src/site/apt/FileSystemShell.apt.vm
+++ b/hadoop-common-project/hadoop-common/src/site/apt/FileSystemShell.apt.vm
@@ -665,13 +665,18 @@ permissions userid groupid modification_date modification_time dirname
* stat
- Usage: <<<hadoop fs -stat URI [URI ...]>>>
+ Usage: <<<hadoop fs -stat [format] \<path\> ...>>>
- Returns the stat information on the path.
+ Print statistics about the file/directory at \<path\> in the specified
+ format. Format accepts filesize in blocks (%b), type (%F), group name of
+ owner (%g), name (%n), block size (%o), replication (%r), user name of
+ owner(%u), and modification date (%y, %Y). %y shows UTC date as
+ "yyyy-MM-dd HH:mm:ss" and %Y shows milliseconds since January 1, 1970 UTC.
+ If the format is not specified, %y is used by default.
Example:
- * <<<hadoop fs -stat path>>>
+ * <<<hadoop fs -stat "%F %u:%g %b %y %n" /file>>>
Exit Code:
Returns 0 on success and -1 on error.
http://git-wip-us.apache.org/repos/asf/hadoop/blob/51df20c9/hadoop-common-project/hadoop-common/src/test/resources/testConf.xml
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/test/resources/testConf.xml b/hadoop-common-project/hadoop-common/src/test/resources/testConf.xml
index 5196641..5c667e1 100644
--- a/hadoop-common-project/hadoop-common/src/test/resources/testConf.xml
+++ b/hadoop-common-project/hadoop-common/src/test/resources/testConf.xml
@@ -786,19 +786,35 @@
</comparator>
<comparator>
<type>RegexpComparator</type>
- <expected-output>^( |\t)*Print statistics about the file/directory at <path> in the specified format.( )*</expected-output>
+ <expected-output>^( |\t)*Print statistics about the file/directory at <path>( )*</expected-output>
</comparator>
<comparator>
<type>RegexpComparator</type>
- <expected-output>^( |\t)*Format accepts filesize in blocks \(%b\), group name of owner\(%g\), filename \(%n\),( )*</expected-output>
+ <expected-output>^( |\t)*in the specified format. Format accepts filesize in( )*</expected-output>
</comparator>
<comparator>
<type>RegexpComparator</type>
- <expected-output>^( |\t)*block size \(%o\), replication \(%r\), user name of owner\(%u\), modification date( )*</expected-output>
+ <expected-output>^( |\t)*blocks \(%b\), type \(%F\), group name of owner \(%g\),( )*</expected-output>
</comparator>
<comparator>
<type>RegexpComparator</type>
- <expected-output>^( |\t)*\(%y, %Y\)( )*</expected-output>
+ <expected-output>^( |\t)*name \(%n\), block size \(%o\), replication \(%r\), user name( )*</expected-output>
+ </comparator>
+ <comparator>
+ <type>RegexpComparator</type>
+ <expected-output>^( |\t)*of owner \(%u\), modification date \(%y, %Y\).( )*</expected-output>
+ </comparator>
+ <comparator>
+ <type>RegexpComparator</type>
+ <expected-output>^( |\t)*%y shows UTC date as "yyyy-MM-dd HH:mm:ss" and( )*</expected-output>
+ </comparator>
+ <comparator>
+ <type>RegexpComparator</type>
+ <expected-output>^( |\t)*%Y shows milliseconds since January 1, 1970 UTC.( )*</expected-output>
+ </comparator>
+ <comparator>
+ <type>RegexpComparator</type>
+ <expected-output>^( |\t)*If the format is not specified, %y is used by default.( )*</expected-output>
</comparator>
</comparators>
</test>