HDFS-14218. EC: Ls -e throw NPE when directory ec policy is disabled. Contributed by Ayush Saxena.
This commit is contained in:
parent
0dd35e218f
commit
7d6792e5d2
|
@ -188,7 +188,7 @@ public class ContentSummaryComputationContext {
|
||||||
String ecPolicyName = WritableUtils.readString(din);
|
String ecPolicyName = WritableUtils.readString(din);
|
||||||
return dir.getFSNamesystem()
|
return dir.getFSNamesystem()
|
||||||
.getErasureCodingPolicyManager()
|
.getErasureCodingPolicyManager()
|
||||||
.getEnabledPolicyByName(ecPolicyName)
|
.getByName(ecPolicyName)
|
||||||
.getName();
|
.getName();
|
||||||
}
|
}
|
||||||
} else if (inode.getParent() != null) {
|
} else if (inode.getParent() != null) {
|
||||||
|
|
|
@ -1034,5 +1034,26 @@
|
||||||
</comparators>
|
</comparators>
|
||||||
</test>
|
</test>
|
||||||
|
|
||||||
|
<test>
|
||||||
|
<description>ls: file with disabled EC Policy</description>
|
||||||
|
<test-commands>
|
||||||
|
<command>-fs NAMENODE -mkdir -p /ecdir</command>
|
||||||
|
<ec-admin-command>-fs NAMENODE -setPolicy -path /ecdir -policy XOR-2-1-1024k</ec-admin-command>
|
||||||
|
<command>-fs NAMENODE -touchz /ecdir/file1</command>
|
||||||
|
<ec-admin-command>-fs NAMENODE -disablePolicy -policy XOR-2-1-1024k</ec-admin-command>
|
||||||
|
<command>-fs NAMENODE -ls -e /ecdir</command>
|
||||||
|
</test-commands>
|
||||||
|
<cleanup-commands>
|
||||||
|
<command>-fs NAMENODE -rmdir /ecdir</command>
|
||||||
|
<ec-admin-command>-fs NAMENODE -enablePolicy -policy XOR-2-1-1024k</ec-admin-command>
|
||||||
|
</cleanup-commands>
|
||||||
|
<comparators>
|
||||||
|
<comparator>
|
||||||
|
<type>RegexpComparator</type>
|
||||||
|
<expected-output>^-rw-r--r--( )*1( )*USERNAME( )*supergroup( )*[A-Za-z0-9-]{1,}( )*0( )*[0-9]{4,}-[0-9]{2,}-[0-9]{2,} [0-9]{2,}:[0-9]{2,}( )*/ecdir/file1</expected-output>
|
||||||
|
</comparator>
|
||||||
|
</comparators>
|
||||||
|
</test>
|
||||||
|
|
||||||
</tests>
|
</tests>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
Loading…
Reference in New Issue