HDFS-13239. Fix non-empty dir warning message when setting default EC policy. Contributed by Bharat Viswanadham.
(cherry picked from commit d6931c30c5
)
This commit is contained in:
parent
752e116f41
commit
8f4bfb3ed5
|
@ -358,17 +358,15 @@ public class ECAdmin extends Configured implements Tool {
|
|||
try {
|
||||
dfs.setErasureCodingPolicy(p, ecPolicyName);
|
||||
if (ecPolicyName == null){
|
||||
System.out.println("Set default erasure coding policy" +
|
||||
" on " + path);
|
||||
} else {
|
||||
System.out.println("Set erasure coding policy " + ecPolicyName +
|
||||
" on " + path);
|
||||
ecPolicyName = "default";
|
||||
}
|
||||
System.out.println("Set " + ecPolicyName + " erasure coding policy on" +
|
||||
" " + path);
|
||||
RemoteIterator<FileStatus> dirIt = dfs.listStatusIterator(p);
|
||||
if (dirIt.hasNext()) {
|
||||
System.out.println("Warning: setting erasure coding policy on a " +
|
||||
"non-empty directory will not automatically convert existing" +
|
||||
" files to " + ecPolicyName);
|
||||
"non-empty directory will not automatically convert existing " +
|
||||
"files to " + ecPolicyName + " erasure coding policy");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.err.println(AdminHelper.prettifyException(e));
|
||||
|
|
|
@ -214,7 +214,7 @@
|
|||
<comparators>
|
||||
<comparator>
|
||||
<type>SubstringComparator</type>
|
||||
<expected-output>Set erasure coding policy RS-6-3-1024k on /ecdir</expected-output>
|
||||
<expected-output>Set RS-6-3-1024k erasure coding policy on /ecdir</expected-output>
|
||||
</comparator>
|
||||
</comparators>
|
||||
</test>
|
||||
|
@ -232,7 +232,7 @@
|
|||
<comparators>
|
||||
<comparator>
|
||||
<type>SubstringComparator</type>
|
||||
<expected-output>Set erasure coding policy RS-6-3-1024k on /ecdir</expected-output>
|
||||
<expected-output>Set RS-6-3-1024k erasure coding policy on /ecdir</expected-output>
|
||||
</comparator>
|
||||
</comparators>
|
||||
</test>
|
||||
|
@ -311,7 +311,7 @@
|
|||
<comparators>
|
||||
<comparator>
|
||||
<type>SubstringComparator</type>
|
||||
<expected-output>Warning: setting erasure coding policy on a non-empty directory will not automatically convert existing files to RS-6-3-1024</expected-output>
|
||||
<expected-output>Warning: setting erasure coding policy on a non-empty directory will not automatically convert existing files to RS-6-3-1024k erasure coding policy</expected-output>
|
||||
</comparator>
|
||||
</comparators>
|
||||
</test>
|
||||
|
@ -695,6 +695,28 @@
|
|||
</comparators>
|
||||
</test>
|
||||
|
||||
<test>
|
||||
<description>setPolicy : set erasure coding policy without given a specific policy name on a non empty directory</description>
|
||||
<test-commands>
|
||||
<command>-fs NAMENODE -mkdir /ecdir</command>
|
||||
<command>-fs NAMENODE -mkdir /ecdir/ecsubdir</command>
|
||||
<ec-admin-command>-fs NAMENODE -setPolicy -path /ecdir</ec-admin-command>
|
||||
</test-commands>
|
||||
<cleanup-commands>
|
||||
<command>-fs NAMENODE -rm -R /ecdir</command>
|
||||
</cleanup-commands>
|
||||
<comparators>
|
||||
<comparator>
|
||||
<type>SubstringComparator</type>
|
||||
<expected-output>Set default erasure coding policy on /ecdir</expected-output>
|
||||
</comparator>
|
||||
<comparator>
|
||||
<type>SubstringComparator</type>
|
||||
<expected-output>Warning: setting erasure coding policy on a non-empty directory will not automatically convert existing files to default erasure coding policy</expected-output>
|
||||
</comparator>
|
||||
</comparators>
|
||||
</test>
|
||||
|
||||
<test>
|
||||
<description>getPolicy: get the default policy after setPolicy without given a specific policy name</description>
|
||||
<test-commands>
|
||||
|
|
Loading…
Reference in New Issue