Skip to content

Commit 17e8cf5

Browse files
smengcljojochuang
authored andcommitted
HDFS-14686. HttpFS: HttpFSFileSystem#getErasureCodingPolicy always returns null (#1192) Contributed by Siyao Meng.
1 parent 99bf1dc commit 17e8cf5

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/JsonUtilClient.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,10 +432,12 @@ static ContentSummary toContentSummary(final Map<?, ?> json) {
432432
final long length = ((Number) m.get("length")).longValue();
433433
final long fileCount = ((Number) m.get("fileCount")).longValue();
434434
final long directoryCount = ((Number) m.get("directoryCount")).longValue();
435+
final String ecPolicy = ((String) m.get("ecPolicy"));
435436
ContentSummary.Builder builder = new ContentSummary.Builder()
436437
.length(length)
437438
.fileCount(fileCount)
438-
.directoryCount(directoryCount);
439+
.directoryCount(directoryCount)
440+
.erasureCodingPolicy(ecPolicy);
439441
builder = buildQuotaUsage(builder, m, ContentSummary.Builder.class);
440442
return builder.build();
441443
}

hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/client/HttpFSFileSystem.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ public static FILE_TYPE getType(FileStatus fileStatus) {
190190

191191
public static final String CONTENT_SUMMARY_JSON = "ContentSummary";
192192
public static final String CONTENT_SUMMARY_DIRECTORY_COUNT_JSON = "directoryCount";
193+
public static final String CONTENT_SUMMARY_ECPOLICY_JSON = "ecPolicy";
193194
public static final String CONTENT_SUMMARY_FILE_COUNT_JSON = "fileCount";
194195
public static final String CONTENT_SUMMARY_LENGTH_JSON = "length";
195196

@@ -1137,7 +1138,8 @@ public ContentSummary getContentSummary(Path f) throws IOException {
11371138
ContentSummary.Builder builder = new ContentSummary.Builder()
11381139
.length((Long) json.get(CONTENT_SUMMARY_LENGTH_JSON))
11391140
.fileCount((Long) json.get(CONTENT_SUMMARY_FILE_COUNT_JSON))
1140-
.directoryCount((Long) json.get(CONTENT_SUMMARY_DIRECTORY_COUNT_JSON));
1141+
.directoryCount((Long) json.get(CONTENT_SUMMARY_DIRECTORY_COUNT_JSON))
1142+
.erasureCodingPolicy((String) json.get(CONTENT_SUMMARY_ECPOLICY_JSON));
11411143
builder = buildQuotaUsage(builder, json, ContentSummary.Builder.class);
11421144
return builder.build();
11431145
}

hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/server/FSOperations.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,8 @@ private static Map contentSummaryToJSON(ContentSummary contentSummary) {
254254
Map json = new LinkedHashMap();
255255
json.put(HttpFSFileSystem.CONTENT_SUMMARY_DIRECTORY_COUNT_JSON,
256256
contentSummary.getDirectoryCount());
257+
json.put(HttpFSFileSystem.CONTENT_SUMMARY_ECPOLICY_JSON,
258+
contentSummary.getErasureCodingPolicy());
257259
json.put(HttpFSFileSystem.CONTENT_SUMMARY_FILE_COUNT_JSON,
258260
contentSummary.getFileCount());
259261
json.put(HttpFSFileSystem.CONTENT_SUMMARY_LENGTH_JSON,

hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/fs/http/client/BaseTestHttpFSWith.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,8 @@ private void testContentSummary() throws Exception {
678678
fs.close();
679679
assertEquals(hdfsContentSummary.getDirectoryCount(),
680680
httpContentSummary.getDirectoryCount());
681+
assertEquals(hdfsContentSummary.getErasureCodingPolicy(),
682+
httpContentSummary.getErasureCodingPolicy());
681683
assertEquals(hdfsContentSummary.getFileCount(),
682684
httpContentSummary.getFileCount());
683685
assertEquals(hdfsContentSummary.getLength(),

0 commit comments

Comments
 (0)