HDFS-11794. Add ec sub command -listCodec to show currently supported ec codecs. Contributed by SammiChen.
This commit is contained in:
parent
d18909d338
commit
665f7c8b69
@ -179,4 +179,13 @@ public RawErasureCoderFactory getCoderByName(
|
||||
public Map<String, String> getCodec2CoderCompactMap() {
|
||||
return coderNameCompactMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all codec names and their corresponding coder list.
|
||||
* @return a map of all codec names, and their corresponding code list
|
||||
* separated by ','.
|
||||
*/
|
||||
public HashMap<String, String> getCodec2CoderCompactMap() {
|
||||
return coderNameCompactMap;
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
@ -1761,6 +1762,25 @@ public GetErasureCodingCodecsResponseProto getErasureCodingCodecs(
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public GetErasureCodingCodecsResponseProto getErasureCodingCodecs(
|
||||
RpcController controller, GetErasureCodingCodecsRequestProto request)
|
||||
throws ServiceException {
|
||||
try {
|
||||
HashMap<String, String> codecs = server.getErasureCodingCodecs();
|
||||
GetErasureCodingCodecsResponseProto.Builder resBuilder =
|
||||
GetErasureCodingCodecsResponseProto.newBuilder();
|
||||
for (Map.Entry<String, String> codec : codecs.entrySet()) {
|
||||
resBuilder.addCodec(
|
||||
PBHelperClient.convertErasureCodingCodec(
|
||||
codec.getKey(), codec.getValue()));
|
||||
}
|
||||
return resBuilder.build();
|
||||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AddErasureCodingPoliciesResponseProto addErasureCodingPolicies(
|
||||
RpcController controller, AddErasureCodingPoliciesRequestProto request)
|
||||
|
@ -7655,6 +7655,20 @@ Map<String, String> getErasureCodingCodecs() throws IOException {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get available erasure coding codecs and corresponding coders.
|
||||
*/
|
||||
HashMap<String, String> getErasureCodingCodecs() throws IOException {
|
||||
checkOperation(OperationCategory.READ);
|
||||
readLock();
|
||||
try {
|
||||
checkOperation(OperationCategory.READ);
|
||||
return FSDirErasureCodingOp.getErasureCodingCodecs(this);
|
||||
} finally {
|
||||
readUnlock("getErasureCodingCodecs");
|
||||
}
|
||||
}
|
||||
|
||||
void setXAttr(String src, XAttr xAttr, EnumSet<XAttrSetFlag> flag,
|
||||
boolean logRetryCache)
|
||||
throws IOException {
|
||||
|
Loading…
Reference in New Issue
Block a user