You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ta...@apache.org on 2019/01/23 01:06:52 UTC
[hadoop] branch branch-3.0 updated: HDFS-14218. EC: Ls -e throw NPE
when directory ec policy is disabled. Contributed by Ayush Saxena.
This is an automated email from the ASF dual-hosted git repository.
tasanuma pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/branch-3.0 by this push:
new 5b8a99b HDFS-14218. EC: Ls -e throw NPE when directory ec policy is disabled. Contributed by Ayush Saxena.
5b8a99b is described below
commit 5b8a99bf49696abb146590c32422b0e10f68e77f
Author: Takanobu Asanuma <ta...@apache.org>
AuthorDate: Wed Jan 23 10:03:06 2019 +0900
HDFS-14218. EC: Ls -e throw NPE when directory ec policy is disabled. Contributed by Ayush Saxena.
(cherry picked from commit 7d6792e5d2001e1a83ae75a4777324a3b01c557a)
---
.../namenode/ContentSummaryComputationContext.java | 2 +-
.../src/test/resources/testErasureCodingConf.xml | 21 +++++++++++++++++++++
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ContentSummaryComputationContext.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ContentSummaryComputationContext.java
index 95f3fee..d816cb2 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ContentSummaryComputationContext.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ContentSummaryComputationContext.java
@@ -188,7 +188,7 @@ public class ContentSummaryComputationContext {
String ecPolicyName = WritableUtils.readString(din);
return dir.getFSNamesystem()
.getErasureCodingPolicyManager()
- .getEnabledPolicyByName(ecPolicyName)
+ .getByName(ecPolicyName)
.getName();
}
} else if (inode.getParent() != null) {
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testErasureCodingConf.xml b/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testErasureCodingConf.xml
index 35a4048..ac48898 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testErasureCodingConf.xml
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testErasureCodingConf.xml
@@ -990,5 +990,26 @@
</comparators>
</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>
</configuration>
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org