|
@@ -7744,6 +7744,7 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
|
|
|
private void setXAttrInt(String src, XAttr xAttr, EnumSet<XAttrSetFlag> flag,
|
|
|
boolean logRetryCache) throws IOException {
|
|
|
nnConf.checkXAttrsConfigFlag();
|
|
|
+ checkXAttrSize(xAttr);
|
|
|
HdfsFileStatus resultingStat = null;
|
|
|
FSPermissionChecker pc = getPermissionChecker();
|
|
|
XAttrPermissionFilter.checkPermissionForApi(pc, xAttr);
|
|
@@ -7766,6 +7767,22 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
|
|
|
logAuditEvent(true, "setXAttr", src, null, resultingStat);
|
|
|
}
|
|
|
|
|
|
+ private void checkXAttrSize(XAttr xAttr) {
|
|
|
+ if (xAttr.getName().length() > nnConf.xattrNameMaxLength) {
|
|
|
+ throw new HadoopIllegalArgumentException(
|
|
|
+ "XAttr name is too long, maximum length = "
|
|
|
+ + nnConf.xattrNameMaxLength + ", but now the length = "
|
|
|
+ + xAttr.getName().length());
|
|
|
+ }
|
|
|
+ if (xAttr.getValue() != null
|
|
|
+ && xAttr.getValue().length > nnConf.xattrValueMaxLength) {
|
|
|
+ throw new HadoopIllegalArgumentException(
|
|
|
+ "XAttr value is too long, maximum length = "
|
|
|
+ + nnConf.xattrValueMaxLength + ", but now the length = "
|
|
|
+ + xAttr.getValue().length);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
List<XAttr> getXAttrs(String src, List<XAttr> xAttrs) throws IOException {
|
|
|
nnConf.checkXAttrsConfigFlag();
|
|
|
FSPermissionChecker pc = getPermissionChecker();
|