HDFS-14683. WebHDFS: Add erasureCodingPolicy field to GETCONTENTSUMMARY response (#1189) Contributed by Siyao Meng.
This commit is contained in:
parent
d086d058d8
commit
99bf1dc9eb
@ -354,6 +354,7 @@ public static String toJsonString(final ContentSummary contentsummary) {
|
|||||||
m.put("length", contentsummary.getLength());
|
m.put("length", contentsummary.getLength());
|
||||||
m.put("fileCount", contentsummary.getFileCount());
|
m.put("fileCount", contentsummary.getFileCount());
|
||||||
m.put("directoryCount", contentsummary.getDirectoryCount());
|
m.put("directoryCount", contentsummary.getDirectoryCount());
|
||||||
|
m.put("ecPolicy", contentsummary.getErasureCodingPolicy());
|
||||||
// For ContentSummary we don't need this since we already have
|
// For ContentSummary we don't need this since we already have
|
||||||
// separate count for file and directory.
|
// separate count for file and directory.
|
||||||
m.putAll(toJsonMap(contentsummary, false));
|
m.putAll(toJsonMap(contentsummary, false));
|
||||||
|
@ -761,6 +761,7 @@ Other File System Operations
|
|||||||
"ContentSummary":
|
"ContentSummary":
|
||||||
{
|
{
|
||||||
"directoryCount": 2,
|
"directoryCount": 2,
|
||||||
|
"ecPolicy" : "RS-6-3-1024k",
|
||||||
"fileCount" : 1,
|
"fileCount" : 1,
|
||||||
"length" : 24930,
|
"length" : 24930,
|
||||||
"quota" : -1,
|
"quota" : -1,
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
import org.apache.hadoop.fs.Path;
|
import org.apache.hadoop.fs.Path;
|
||||||
import org.apache.hadoop.fs.XAttr;
|
import org.apache.hadoop.fs.XAttr;
|
||||||
import org.apache.hadoop.fs.XAttrCodec;
|
import org.apache.hadoop.fs.XAttrCodec;
|
||||||
|
import org.apache.hadoop.fs.ContentSummary;
|
||||||
import org.apache.hadoop.fs.permission.AclEntry;
|
import org.apache.hadoop.fs.permission.AclEntry;
|
||||||
import org.apache.hadoop.fs.permission.AclStatus;
|
import org.apache.hadoop.fs.permission.AclStatus;
|
||||||
import org.apache.hadoop.fs.permission.FsPermission;
|
import org.apache.hadoop.fs.permission.FsPermission;
|
||||||
@ -257,6 +258,26 @@ public void testToJsonFromAclStatus() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testToJsonFromContentSummary() {
|
||||||
|
String jsonString =
|
||||||
|
"{\"ContentSummary\":{\"directoryCount\":33333,\"ecPolicy\":\"RS-6-3-1024k\",\"fileCount\":22222,\"length\":11111,\"quota\":44444,\"spaceConsumed\":55555,\"spaceQuota\":66666,\"typeQuota\":{}}}";
|
||||||
|
long length = 11111;
|
||||||
|
long fileCount = 22222;
|
||||||
|
long directoryCount = 33333;
|
||||||
|
long quota = 44444;
|
||||||
|
long spaceConsumed = 55555;
|
||||||
|
long spaceQuota = 66666;
|
||||||
|
String ecPolicy = "RS-6-3-1024k";
|
||||||
|
|
||||||
|
ContentSummary contentSummary = new ContentSummary.Builder().length(length).
|
||||||
|
fileCount(fileCount).directoryCount(directoryCount).quota(quota).
|
||||||
|
spaceConsumed(spaceConsumed).spaceQuota(spaceQuota).
|
||||||
|
erasureCodingPolicy(ecPolicy).build();
|
||||||
|
|
||||||
|
Assert.assertEquals(jsonString, JsonUtil.toJsonString(contentSummary));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testToJsonFromXAttrs() throws IOException {
|
public void testToJsonFromXAttrs() throws IOException {
|
||||||
String jsonString =
|
String jsonString =
|
||||||
|
Loading…
Reference in New Issue
Block a user