etseidl commented on a change in pull request #1445: WIP add erasure coding and 
storage policy to table/namespace settings
URL: https://github.com/apache/accumulo/pull/1445#discussion_r354449835
 
 

 ##########
 File path: 
server/base/src/main/java/org/apache/accumulo/server/fs/VolumeManagerImpl.java
 ##########
 @@ -306,6 +312,111 @@ public boolean mkdirs(Path path, FsPermission 
permission) throws IOException {
     return getVolumeByPath(path).getFileSystem().mkdirs(path, permission);
   }
 
+  @Override
+  public boolean mkdirs(Path path, String storagePolicy, String encoding) 
throws IOException {
+    boolean ret = mkdirs(path);
+    try {
+      checkDirPolicies(path, storagePolicy, encoding);
+    } catch (IOException e) {
+      // non-fatal error, just print warning and continue
+      // directory will just have wrong policy.
+      log.warn("error checking policy for " + path, e);
+    }
+    return ret;
+  }
+
+  @Override
+  public void checkDirPolicies(Path path, String storagePolicy, String 
encoding)
+      throws IOException {
+    FileSystem fs = getVolumeByPath(path).getFileSystem();
+    // check that path exists...it may not yet, which is ok. just return
+    if (!fs.exists(path)) {
+      log.debug("check {}: path does not exist", path);
+      return;
+    }
+    if (fs instanceof DistributedFileSystem) {
+      DistributedFileSystem dfs = (DistributedFileSystem) fs;
+      BlockStoragePolicySpi currPolicy = dfs.getStoragePolicy(path);
 
 Review comment:
   will look into it, but I'm hoping this isn't called all that often.  should 
be just at tablet creation time, or when doing a bulk import.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to