HDFS-14686. HttpFS: HttpFSFileSystem#getErasureCodingPolicy always returns null (#1192) Contributed by Siyao Meng.

This commit is contained in:
Siyao Meng 2019-08-01 17:15:22 -07:00 committed by Wei-Chiu Chuang
parent 99bf1dc9eb
commit 17e8cf501b
4 changed files with 10 additions and 2 deletions

View File

@ -432,10 +432,12 @@ public class JsonUtilClient {
final long length = ((Number) m.get("length")).longValue(); final long length = ((Number) m.get("length")).longValue();
final long fileCount = ((Number) m.get("fileCount")).longValue(); final long fileCount = ((Number) m.get("fileCount")).longValue();
final long directoryCount = ((Number) m.get("directoryCount")).longValue(); final long directoryCount = ((Number) m.get("directoryCount")).longValue();
final String ecPolicy = ((String) m.get("ecPolicy"));
ContentSummary.Builder builder = new ContentSummary.Builder() ContentSummary.Builder builder = new ContentSummary.Builder()
.length(length) .length(length)
.fileCount(fileCount) .fileCount(fileCount)
.directoryCount(directoryCount); .directoryCount(directoryCount)
.erasureCodingPolicy(ecPolicy);
builder = buildQuotaUsage(builder, m, ContentSummary.Builder.class); builder = buildQuotaUsage(builder, m, ContentSummary.Builder.class);
return builder.build(); return builder.build();
} }

View File

@ -190,6 +190,7 @@ public class HttpFSFileSystem extends FileSystem
public static final String CONTENT_SUMMARY_JSON = "ContentSummary"; public static final String CONTENT_SUMMARY_JSON = "ContentSummary";
public static final String CONTENT_SUMMARY_DIRECTORY_COUNT_JSON = "directoryCount"; public static final String CONTENT_SUMMARY_DIRECTORY_COUNT_JSON = "directoryCount";
public static final String CONTENT_SUMMARY_ECPOLICY_JSON = "ecPolicy";
public static final String CONTENT_SUMMARY_FILE_COUNT_JSON = "fileCount"; public static final String CONTENT_SUMMARY_FILE_COUNT_JSON = "fileCount";
public static final String CONTENT_SUMMARY_LENGTH_JSON = "length"; public static final String CONTENT_SUMMARY_LENGTH_JSON = "length";
@ -1137,7 +1138,8 @@ public class HttpFSFileSystem extends FileSystem
ContentSummary.Builder builder = new ContentSummary.Builder() ContentSummary.Builder builder = new ContentSummary.Builder()
.length((Long) json.get(CONTENT_SUMMARY_LENGTH_JSON)) .length((Long) json.get(CONTENT_SUMMARY_LENGTH_JSON))
.fileCount((Long) json.get(CONTENT_SUMMARY_FILE_COUNT_JSON)) .fileCount((Long) json.get(CONTENT_SUMMARY_FILE_COUNT_JSON))
.directoryCount((Long) json.get(CONTENT_SUMMARY_DIRECTORY_COUNT_JSON)); .directoryCount((Long) json.get(CONTENT_SUMMARY_DIRECTORY_COUNT_JSON))
.erasureCodingPolicy((String) json.get(CONTENT_SUMMARY_ECPOLICY_JSON));
builder = buildQuotaUsage(builder, json, ContentSummary.Builder.class); builder = buildQuotaUsage(builder, json, ContentSummary.Builder.class);
return builder.build(); return builder.build();
} }

View File

@ -254,6 +254,8 @@ public class FSOperations {
Map json = new LinkedHashMap(); Map json = new LinkedHashMap();
json.put(HttpFSFileSystem.CONTENT_SUMMARY_DIRECTORY_COUNT_JSON, json.put(HttpFSFileSystem.CONTENT_SUMMARY_DIRECTORY_COUNT_JSON,
contentSummary.getDirectoryCount()); contentSummary.getDirectoryCount());
json.put(HttpFSFileSystem.CONTENT_SUMMARY_ECPOLICY_JSON,
contentSummary.getErasureCodingPolicy());
json.put(HttpFSFileSystem.CONTENT_SUMMARY_FILE_COUNT_JSON, json.put(HttpFSFileSystem.CONTENT_SUMMARY_FILE_COUNT_JSON,
contentSummary.getFileCount()); contentSummary.getFileCount());
json.put(HttpFSFileSystem.CONTENT_SUMMARY_LENGTH_JSON, json.put(HttpFSFileSystem.CONTENT_SUMMARY_LENGTH_JSON,

View File

@ -678,6 +678,8 @@ public abstract class BaseTestHttpFSWith extends HFSTestCase {
fs.close(); fs.close();
assertEquals(hdfsContentSummary.getDirectoryCount(), assertEquals(hdfsContentSummary.getDirectoryCount(),
httpContentSummary.getDirectoryCount()); httpContentSummary.getDirectoryCount());
assertEquals(hdfsContentSummary.getErasureCodingPolicy(),
httpContentSummary.getErasureCodingPolicy());
assertEquals(hdfsContentSummary.getFileCount(), assertEquals(hdfsContentSummary.getFileCount(),
httpContentSummary.getFileCount()); httpContentSummary.getFileCount());
assertEquals(hdfsContentSummary.getLength(), assertEquals(hdfsContentSummary.getLength(),