|
@@ -19,7 +19,9 @@ package org.apache.hadoop.hdfs.tools;
|
|
|
import org.apache.hadoop.classification.InterfaceAudience;
|
|
|
import org.apache.hadoop.conf.Configuration;
|
|
|
import org.apache.hadoop.conf.Configured;
|
|
|
+import org.apache.hadoop.fs.FileStatus;
|
|
|
import org.apache.hadoop.fs.Path;
|
|
|
+import org.apache.hadoop.fs.RemoteIterator;
|
|
|
import org.apache.hadoop.hdfs.DistributedFileSystem;
|
|
|
import org.apache.hadoop.hdfs.protocol.AddErasureCodingPolicyResponse;
|
|
|
import org.apache.hadoop.hdfs.protocol.ErasureCodingPolicy;
|
|
@@ -362,6 +364,12 @@ public class ECAdmin extends Configured implements Tool {
|
|
|
System.out.println("Set erasure coding policy " + ecPolicyName +
|
|
|
" 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);
|
|
|
+ }
|
|
|
} catch (Exception e) {
|
|
|
System.err.println(AdminHelper.prettifyException(e));
|
|
|
return 3;
|
|
@@ -412,6 +420,12 @@ public class ECAdmin extends Configured implements Tool {
|
|
|
try {
|
|
|
dfs.unsetErasureCodingPolicy(p);
|
|
|
System.out.println("Unset erasure coding policy from " + path);
|
|
|
+ RemoteIterator<FileStatus> dirIt = dfs.listStatusIterator(p);
|
|
|
+ if (dirIt.hasNext()) {
|
|
|
+ System.out.println("Warning: unsetting erasure coding policy on a " +
|
|
|
+ "non-empty directory will not automatically convert existing" +
|
|
|
+ " files to replicated data.");
|
|
|
+ }
|
|
|
} catch (Exception e) {
|
|
|
System.err.println(AdminHelper.prettifyException(e));
|
|
|
return 2;
|