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 sh...@apache.org on 2015/02/11 19:07:56 UTC
[2/2] hadoop git commit: HDFS-7760. Document truncate for WebHDFS.
Contributed by Konstantin Shvachko.
HDFS-7760. Document truncate for WebHDFS. Contributed by Konstantin Shvachko.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/e42fc1a2
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/e42fc1a2
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/e42fc1a2
Branch: refs/heads/trunk
Commit: e42fc1a251e91d25dbc4b3728b3cf4554ca7bee1
Parents: 6f6737b
Author: Konstantin V Shvachko <sh...@apache.org>
Authored: Wed Feb 11 09:53:50 2015 -0800
Committer: Konstantin V Shvachko <sh...@apache.org>
Committed: Wed Feb 11 09:53:50 2015 -0800
----------------------------------------------------------------------
hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 2 +
.../hadoop-hdfs/src/site/apt/WebHDFS.apt.vm | 46 ++++++++++++++++++++
2 files changed, 48 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/e42fc1a2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
index ed5db9b..758bcb1 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
@@ -611,6 +611,8 @@ Release 2.7.0 - UNRELEASED
HDFS-7058. Tests for truncate CLI. (Dasha Boudnik via shv)
+ HDFS-7760. Document truncate for WebHDFS. (shv)
+
OPTIMIZATIONS
HDFS-7454. Reduce memory footprint for AclEntries in NameNode.
http://git-wip-us.apache.org/repos/asf/hadoop/blob/e42fc1a2/hadoop-hdfs-project/hadoop-hdfs/src/site/apt/WebHDFS.apt.vm
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/site/apt/WebHDFS.apt.vm b/hadoop-hdfs-project/hadoop-hdfs/src/site/apt/WebHDFS.apt.vm
index 662f8b8..3668286 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/site/apt/WebHDFS.apt.vm
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/site/apt/WebHDFS.apt.vm
@@ -137,6 +137,9 @@ WebHDFS REST API
* {{{Concat File(s)}<<<CONCAT>>>}}
(see {{{../../api/org/apache/hadoop/fs/FileSystem.html}FileSystem}}.concat)
+ * {{{Truncate a File}<<<TRUNCATE>>>}}
+ (see {{{../../api/org/apache/hadoop/fs/FileSystem.html}FileSystem}}.truncate)
+
* HTTP DELETE
* {{{Delete a File/Directory}<<<DELETE>>>}}
@@ -492,6 +495,31 @@ Transfer-Encoding: chunked
{{{../../api/org/apache/hadoop/fs/FileSystem.html}FileSystem}}.delete
+** {Truncate a File}
+
+ * Submit a HTTP POST request.
+
++---------------------------------
+curl -i -X POST "http://<HOST>:<PORT>/webhdfs/v1/<PATH>?op=TRUNCATE&newlength=<LONG>"
++---------------------------------
+
+ The client receives a response with a {{{Boolean JSON Schema}<<<boolean>>> JSON object}}:
+
++---------------------------------
+HTTP/1.1 200 OK
+Content-Type: application/json
+Transfer-Encoding: chunked
+
+{"boolean": true}
++---------------------------------
+
+ []
+
+ See also:
+ {{{New Length}<<<newlength>>>}},
+ {{{../../api/org/apache/hadoop/fs/FileSystem.html}FileSystem}}.truncate
+
+
** {Status of a File/Directory}
* Submit a HTTP GET request.
@@ -2274,6 +2302,24 @@ var tokenProperties =
{{{Set Access or Modification Time}<<<SETTIMES>>>}}
+** {New Length}
+
+*----------------+-------------------------------------------------------------------+
+|| Name | <<<newlength>>> |
+*----------------+-------------------------------------------------------------------+
+|| Description | The size the file is to be truncated to. |
+*----------------+-------------------------------------------------------------------+
+|| Type | long |
+*----------------+-------------------------------------------------------------------+
+|| Valid Values | \>= 0 |
+*----------------+-------------------------------------------------------------------+
+|| Syntax | Any long. |
+*----------------+-------------------------------------------------------------------+
+
+ See also:
+ {{{Truncate a File}<<<TRUNCATE>>>}}
+
+
** {Offset}
*----------------+-------------------------------------------------------------------+