diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index bbfc8f4f9b5..ed6e52a7171 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -215,6 +215,8 @@ Release 2.5.0 - UNRELEASED HDFS-6562. Refactor rename() in FSDirectory. (wheat9) + HDFS-6486. Add user doc for XAttrs via WebHDFS. (Yi Liu via umamahesh) + OPTIMIZATIONS HDFS-6214. Webhdfs has poor throughput for files >2GB (daryn) 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 94d5d0ba757..aad95eb44be 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 @@ -70,6 +70,18 @@ WebHDFS REST API * {{{Get Delegation Tokens}<<>>}} (see {{{../../api/org/apache/hadoop/fs/FileSystem.html}FileSystem}}.getDelegationTokens) + * {{{Get an XAttr}<<>>}} + (see {{{../../api/org/apache/hadoop/fs/FileSystem.html}FileSystem}}.getXAttr) + + * {{{Get multiple XAttrs}<<>>}} + (see {{{../../api/org/apache/hadoop/fs/FileSystem.html}FileSystem}}.getXAttrs) + + * {{{Get all XAttrs}<<>>}} + (see {{{../../api/org/apache/hadoop/fs/FileSystem.html}FileSystem}}.getXAttrs) + + * {{{List all XAttrs}<<>>}} + (see {{{../../api/org/apache/hadoop/fs/FileSystem.html}FileSystem}}.listXAttrs) + * HTTP PUT * {{{Create and Write to a File}<<>>}} @@ -108,6 +120,12 @@ WebHDFS REST API * {{{Rename Snapshot}<<>>}} (see {{{../../api/org/apache/hadoop/fs/FileSystem.html}FileSystem}}.renameSnapshot) + * {{{Set XAttr}<<>>}} + (see {{{../../api/org/apache/hadoop/fs/FileSystem.html}FileSystem}}.setXAttr) + + * {{{Remove XAttr}<<>>}} + (see {{{../../api/org/apache/hadoop/fs/FileSystem.html}FileSystem}}.removeXAttr) + * HTTP POST * {{{Append to a File}<<>>}} @@ -909,6 +927,188 @@ Transfer-Encoding: chunked {{{../../api/org/apache/hadoop/fs/FileSystem.html}FileSystem}}.getAclStatus +* {Extended Attributes(XAttrs) Operations} + +** {Set XAttr} + + * Submit a HTTP PUT request. + ++--------------------------------- +curl -i -X PUT "http://:/webhdfs/v1/?op=op=SETXATTR + &xattr.name=&xattr.value= + &flag=" ++--------------------------------- + + The client receives a response with zero content length: + ++--------------------------------- +HTTP/1.1 200 OK +Content-Length: 0 ++--------------------------------- + + [] + + See also: + {{{../../api/org/apache/hadoop/fs/FileSystem.html}FileSystem}}.setXAttr + + +** {Remove XAttr} + + * Submit a HTTP PUT request. + ++--------------------------------- +curl -i -X PUT "http://:/webhdfs/v1/?op=REMOVEXATTR + &xattr.name=" ++--------------------------------- + + The client receives a response with zero content length: + ++--------------------------------- +HTTP/1.1 200 OK +Content-Length: 0 ++--------------------------------- + + [] + + See also: + {{{../../api/org/apache/hadoop/fs/FileSystem.html}FileSystem}}.removeXAttr + + +** {Get an XAttr} + + * Submit a HTTP GET request. + ++--------------------------------- +curl -i -X PUT "http://:/webhdfs/v1/?op=GETXATTRS + &xattr.name=&encoding=" ++--------------------------------- + + The client receives a response with a {{{XAttrs JSON Schema}<<>> JSON object}}: + ++--------------------------------- +HTTP/1.1 200 OK +Content-Type: application/json +Transfer-Encoding: chunked + +{ + "XAttrs": [ + { + "name":"XATTRNAME", + "value":"XATTRVALUE" + } + ] +} ++--------------------------------- + + [] + + See also: + {{{../../api/org/apache/hadoop/fs/FileSystem.html}FileSystem}}.getXAttr + + +** {Get multiple XAttrs} + + * Submit a HTTP GET request. + ++--------------------------------- +curl -i -X PUT "http://:/webhdfs/v1/?op=GETXATTRS + &xattr.name=&xattr.name= + &encoding=" ++--------------------------------- + + The client receives a response with a {{{XAttrs JSON Schema}<<>> JSON object}}: + ++--------------------------------- +HTTP/1.1 200 OK +Content-Type: application/json +Transfer-Encoding: chunked + +{ + "XAttrs": [ + { + "name":"XATTRNAME1", + "value":"XATTRVALUE1" + }, + { + "name":"XATTRNAME2", + "value":"XATTRVALUE2" + } + ] +} ++--------------------------------- + + [] + + See also: + {{{../../api/org/apache/hadoop/fs/FileSystem.html}FileSystem}}.getXAttrs + + +** {Get all XAttrs} + + * Submit a HTTP GET request. + ++--------------------------------- +curl -i -X PUT "http://:/webhdfs/v1/?op=GETXATTRS + &encoding=" ++--------------------------------- + + The client receives a response with a {{{XAttrs JSON Schema}<<>> JSON object}}: + ++--------------------------------- +HTTP/1.1 200 OK +Content-Type: application/json +Transfer-Encoding: chunked + +{ + "XAttrs": [ + { + "name":"XATTRNAME1", + "value":"XATTRVALUE1" + }, + { + "name":"XATTRNAME2", + "value":"XATTRVALUE2" + }, + { + "name":"XATTRNAME3", + "value":"XATTRVALUE3" + } + ] +} ++--------------------------------- + + [] + + See also: + {{{../../api/org/apache/hadoop/fs/FileSystem.html}FileSystem}}.getXAttrs + + +** {List all XAttrs} + + * Submit a HTTP GET request. + ++--------------------------------- +curl -i -X PUT "http://:/webhdfs/v1/?op=LISTXATTRS" ++--------------------------------- + + The client receives a response with a {{{XAttrNames JSON Schema}<<>> JSON object}}: + ++--------------------------------- +HTTP/1.1 200 OK +Content-Type: application/json +Transfer-Encoding: chunked + +{ + "XAttrNames":"[\"XATTRNAME1\",\"XATTRNAME2\",\"XATTRNAME3\"]" +} ++--------------------------------- + + [] + + See also: + {{{../../api/org/apache/hadoop/fs/FileSystem.html}FileSystem}}.listXAttrs + + * {Snapshot Operations} ** {Create Snapshot} @@ -1252,6 +1452,58 @@ Transfer-Encoding: chunked +--------------------------------- +** {XAttrs JSON Schema} + ++--------------------------------- +{ + "name" : "XAttrs", + "properties": + { + "XAttrs": + { + "type" : "array", + "items": + { + "type" " "object", + "properties": + { + "name": + { + "description": "XAttr name.", + "type" : "string", + "required" : true + }, + "value": + { + "description": "XAttr value.", + "type" : "string" + } + } + } + } + } +} ++--------------------------------- + + +** {XAttrNames JSON Schema} + ++--------------------------------- +{ + "name" : "XAttrNames", + "properties": + { + "XAttrNames": + { + "description": "XAttr names.", + "type" : "string" + "required" : true + } + } +} ++--------------------------------- + + ** {Boolean JSON Schema} +--------------------------------- @@ -1688,6 +1940,83 @@ var tokenProperties = *----------------+-------------------------------------------------------------------+ +** {XAttr Name} + +*----------------+-------------------------------------------------------------------+ +|| Name | <<>> | +*----------------+-------------------------------------------------------------------+ +|| Description | The XAttr name of a file/directory. | +*----------------+-------------------------------------------------------------------+ +|| Type | String | +*----------------+-------------------------------------------------------------------+ +|| Default Value | \ | +*----------------+-------------------------------------------------------------------+ +|| Valid Values | Any string prefixed with user./trusted./system./security.. | +*----------------+-------------------------------------------------------------------+ +|| Syntax | Any string prefixed with user./trusted./system./security.. | +*----------------+-------------------------------------------------------------------+ + + +** {XAttr Value} + +*----------------+-------------------------------------------------------------------+ +|| Name | <<>> | +*----------------+-------------------------------------------------------------------+ +|| Description | The XAttr value of a file/directory. | +*----------------+-------------------------------------------------------------------+ +|| Type | String | +*----------------+-------------------------------------------------------------------+ +|| Default Value | \ | +*----------------+-------------------------------------------------------------------+ +|| Valid Values | An encoded value. | +*----------------+-------------------------------------------------------------------+ +|| Syntax | Enclosed in double quotes or prefixed with 0x or 0s. | +*----------------+-------------------------------------------------------------------+ + + See also: + {{{./ExtendedAttributes.html}Extended Attributes}} + + +** {XAttr set flag} + +*----------------+-------------------------------------------------------------------+ +|| Name | <<>> | +*----------------+-------------------------------------------------------------------+ +|| Description | The XAttr set flag. | +*----------------+-------------------------------------------------------------------+ +|| Type | String | +*----------------+-------------------------------------------------------------------+ +|| Default Value | \ | +*----------------+-------------------------------------------------------------------+ +|| Valid Values | CREATE,REPLACE. | +*----------------+-------------------------------------------------------------------+ +|| Syntax | CREATE,REPLACE. | +*----------------+-------------------------------------------------------------------+ + + See also: + {{{./ExtendedAttributes.html}Extended Attributes}} + + +** {XAttr value encoding} + +*----------------+-------------------------------------------------------------------+ +|| Name | <<>> | +*----------------+-------------------------------------------------------------------+ +|| Description | The XAttr value encoding. | +*----------------+-------------------------------------------------------------------+ +|| Type | String | +*----------------+-------------------------------------------------------------------+ +|| Default Value | \ | +*----------------+-------------------------------------------------------------------+ +|| Valid Values | text \| hex \| base64 | +*----------------+-------------------------------------------------------------------+ +|| Syntax | text \| hex \| base64 | +*----------------+-------------------------------------------------------------------+ + + See also: + {{{./ExtendedAttributes.html}Extended Attributes}} + + ** {Access Time} *----------------+-------------------------------------------------------------------+