accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktur...@apache.org
Subject git commit: ACCUMULO-1747 expanded use of default uri and changed how relative paths are handled in code
Date Fri, 11 Oct 2013 20:09:44 GMT
Updated Branches:
  refs/heads/master 57afd7e28 -> cb45e89b0


ACCUMULO-1747 expanded use of default uri and changed how relative paths are handled in code


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/cb45e89b
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/cb45e89b
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/cb45e89b

Branch: refs/heads/master
Commit: cb45e89b0f78d170cb0f5383ab08dea780c9386e
Parents: 57afd7e
Author: Keith Turner <kturner@apache.org>
Authored: Fri Oct 11 15:41:43 2013 -0400
Committer: Keith Turner <kturner@apache.org>
Committed: Fri Oct 11 15:52:07 2013 -0400

----------------------------------------------------------------------
 .../apache/accumulo/server/ServerConstants.java | 62 ++++++++++++++-----
 .../accumulo/server/fs/VolumeManager.java       | 22 ++++++-
 .../accumulo/server/fs/VolumeManagerImpl.java   | 65 +++++++++-----------
 .../server/gc/GarbageCollectWriteAheadLogs.java |  5 +-
 .../server/gc/SimpleGarbageCollector.java       |  9 +--
 .../server/master/TabletGroupWatcher.java       |  7 ++-
 .../server/master/tableOps/CreateTable.java     |  3 +-
 .../server/tabletserver/FileManager.java        |  5 +-
 .../accumulo/server/tabletserver/Tablet.java    |  9 +--
 .../server/tabletserver/TabletServer.java       |  5 +-
 .../apache/accumulo/server/util/Initialize.java | 12 ++--
 .../accumulo/server/util/MetadataTableUtil.java |  3 +-
 .../org/apache/accumulo/test/VolumeTest.java    |  1 +
 13 files changed, 130 insertions(+), 78 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/cb45e89b/server/src/main/java/org/apache/accumulo/server/ServerConstants.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/ServerConstants.java b/server/src/main/java/org/apache/accumulo/server/ServerConstants.java
index 7e3e2b7..55b8114 100644
--- a/server/src/main/java/org/apache/accumulo/server/ServerConstants.java
+++ b/server/src/main/java/org/apache/accumulo/server/ServerConstants.java
@@ -16,12 +16,15 @@
  */
 package org.apache.accumulo.server;
 
+import java.io.IOException;
+
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.metadata.MetadataTable;
 import org.apache.accumulo.core.metadata.RootTable;
 import org.apache.accumulo.core.util.CachedConfiguration;
 import org.apache.accumulo.server.conf.ServerConfiguration;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 
 public class ServerConstants {
@@ -35,25 +38,48 @@ public class ServerConstants {
   public static final int DATA_VERSION = 6;
   public static final int PREV_DATA_VERSION = 5;
   
-  // these are functions to delay loading the Accumulo configuration unless we must
-  public static String[] getBaseDirs() {
-    String singleNamespace = ServerConfiguration.getSiteConfiguration().get(Property.INSTANCE_DFS_DIR);
-    String ns = ServerConfiguration.getSiteConfiguration().get(Property.INSTANCE_VOLUMES);
-    String dfsUri = ServerConfiguration.getSiteConfiguration().get(Property.INSTANCE_DFS_URI);
+  private static String[] baseDirs = null;
+  private static String defaultBaseDir = null;
 
-    if (ns == null || ns.isEmpty()) {
+  public static synchronized String getDefaultBaseDir() {
+    if (defaultBaseDir == null) {
+      String singleNamespace = ServerConfiguration.getSiteConfiguration().get(Property.INSTANCE_DFS_DIR);
+      String dfsUri = ServerConfiguration.getSiteConfiguration().get(Property.INSTANCE_DFS_URI);
+      String baseDir;
+      
       if (dfsUri == null || dfsUri.isEmpty()) {
         Configuration hadoopConfig = CachedConfiguration.getInstance();
-        String fullPath = hadoopConfig.get("fs.default.name") + singleNamespace;
-        return new String[] {fullPath};
+        try {
+          baseDir = FileSystem.get(hadoopConfig).getUri().toString() + singleNamespace;
+        } catch (IOException e) {
+          throw new RuntimeException(e);
+        }
       } else {
-        String fullPath = dfsUri + singleNamespace;
-        return new String[] {fullPath};
+        baseDir = dfsUri + singleNamespace;
       }
+      
+      defaultBaseDir = new Path(baseDir).toString();
+      
     }
+    
+    return defaultBaseDir;
+  }
 
-    String namespaces[] = ns.split(",");
-    return prefix(namespaces, singleNamespace);
+  // these are functions to delay loading the Accumulo configuration unless we must
+  public static synchronized String[] getBaseDirs() {
+    if (baseDirs == null) {
+      String singleNamespace = ServerConfiguration.getSiteConfiguration().get(Property.INSTANCE_DFS_DIR);
+      String ns = ServerConfiguration.getSiteConfiguration().get(Property.INSTANCE_VOLUMES);
+      
+      if (ns == null || ns.isEmpty()) {
+        baseDirs = new String[] {getDefaultBaseDir()};
+      } else {
+        String namespaces[] = ns.split(",");
+        baseDirs = prefix(namespaces, singleNamespace);
+      }
+    }
+    
+    return baseDirs;
   }
   
   public static String[] prefix(String bases[], String suffix) {
@@ -66,16 +92,20 @@ public class ServerConstants {
     return result;
   }
   
+  public static final String TABLE_DIR = "tables";
+  public static final String RECOVERY_DIR = "recovery";
+  public static final String WAL_DIR = "wal";
+
   public static String[] getTablesDirs() {
-    return prefix(getBaseDirs(), "tables");
+    return prefix(getBaseDirs(), TABLE_DIR);
   }
-  
+
   public static String[] getRecoveryDirs() {
-    return prefix(getBaseDirs(), "recovery");
+    return prefix(getBaseDirs(), RECOVERY_DIR);
   }
   
   public static String[] getWalDirs() {
-    return prefix(getBaseDirs(), "wal");
+    return prefix(getBaseDirs(), WAL_DIR);
   }
   
   public static String[] getWalogArchives() {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/cb45e89b/server/src/main/java/org/apache/accumulo/server/fs/VolumeManager.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/fs/VolumeManager.java b/server/src/main/java/org/apache/accumulo/server/fs/VolumeManager.java
index 2361f26..133513f 100644
--- a/server/src/main/java/org/apache/accumulo/server/fs/VolumeManager.java
+++ b/server/src/main/java/org/apache/accumulo/server/fs/VolumeManager.java
@@ -20,6 +20,7 @@ import java.io.IOException;
 import java.util.Map;
 
 import org.apache.accumulo.core.data.Key;
+import org.apache.accumulo.server.ServerConstants;
 import org.apache.hadoop.fs.ContentSummary;
 import org.apache.hadoop.fs.FSDataInputStream;
 import org.apache.hadoop.fs.FSDataOutputStream;
@@ -33,6 +34,22 @@ import org.apache.hadoop.fs.Path;
  */
 public interface VolumeManager {
   
+  
+  
+  public static enum FileType {
+    TABLE(ServerConstants.TABLE_DIR), WAL(ServerConstants.WAL_DIR), RECOVERY(ServerConstants.RECOVERY_DIR);
+    
+    private String dir;
+    
+    FileType(String dir) {
+      this.dir = dir;
+    }
+    
+    public String getDirectory() {
+      return dir;
+    }
+  }
+  
   // close the underlying FileSystems
   void close() throws IOException;
   
@@ -111,12 +128,15 @@ public interface VolumeManager {
   // Convert a file or directory !METADATA reference into a path
   Path getFullPath(Key key);
   
+  Path getFullPath(String tableId, String path);
+
   // Given a filename, figure out the qualified path given multiple namespaces
-  Path getFullPath(String paths[], String fileName) throws IOException;
+  Path getFullPath(FileType fileType, String fileName) throws IOException;
 
   // forward to the appropriate FileSystem object
   ContentSummary getContentSummary(Path dir) throws IOException;
 
   // decide on which of the given locations to create a new file
   String choose(String[] options);
+
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/cb45e89b/server/src/main/java/org/apache/accumulo/server/fs/VolumeManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/fs/VolumeManagerImpl.java b/server/src/main/java/org/apache/accumulo/server/fs/VolumeManagerImpl.java
index ce19a40..b71822b 100644
--- a/server/src/main/java/org/apache/accumulo/server/fs/VolumeManagerImpl.java
+++ b/server/src/main/java/org/apache/accumulo/server/fs/VolumeManagerImpl.java
@@ -20,7 +20,6 @@ import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.EnumSet;
 import java.util.HashMap;
@@ -389,20 +388,10 @@ public class VolumeManagerImpl implements VolumeManager {
 
   @Override
   public Path getFullPath(Key key) {
-
+    // TODO sanity check col fam
     String relPath = key.getColumnQualifierData().toString();
-    if (relPath.contains(":"))
-      return new Path(relPath);
-
     byte[] tableId = KeyExtent.tableOfMetadataRow(key.getRow());
-
-    if (relPath.startsWith("../"))
-      relPath = relPath.substring(2);
-    else
-      relPath = "/" + new String(tableId) + relPath;
-    Path fullPath = new Path(ServerConstants.getTablesDirs()[0] + relPath);
-    FileSystem fs = getFileSystemByPath(fullPath);
-    return fs.makeQualified(fullPath);
+    return getFullPath(new String(tableId), relPath);
   }
 
   @Override
@@ -427,29 +416,33 @@ public class VolumeManagerImpl implements VolumeManager {
   }
 
   @Override
-  public Path getFullPath(String[] paths, String fileName) throws IOException {
-    if (fileName.contains(":"))
-      return new Path(fileName);
-    // TODO: ACCUMULO-118
-    // How do we want it to work? Find it somewhere? or find it in the default file system?
-    // old-style name, on one of many possible "root" paths:
-    if (fileName.startsWith("../"))
-      fileName = fileName.substring(2);
-    for (String path : paths) {
-      String fullPath;
-      if (path.endsWith("/") || fileName.startsWith("/"))
-        fullPath = path + fileName;
-      else
-        fullPath = path + "/" + fileName;
-      Path exists = new Path(fullPath);
-      FileSystem ns = getFileSystemByPath(exists);
-      if (ns.exists(exists)) {
-        Path result = ns.makeQualified(exists);
-        log.debug("Found " + exists + " on " + path + " as " + result);
-        return ns.makeQualified(exists);
-      }
-    }
-    throw new IOException("Could not find file " + fileName + " in " + Arrays.asList(paths));
+  public Path getFullPath(String tableId, String path) {
+    if (path.contains(":"))
+      return new Path(path);
+    
+    if (path.startsWith("../"))
+      path = path.substring(2);
+    else if (path.startsWith("/"))
+      path = "/" + tableId + path;
+    else
+      throw new IllegalArgumentException("Unexpected path prefix " + path);
+    
+    return getFullPath(FileType.TABLE, path);
+  }
+  
+  @Override
+  public Path getFullPath(FileType fileType, String path) {
+    if (path.contains(":"))
+      return new Path(path);
+    
+    // normalize the path
+    Path fullPath = new Path(ServerConstants.getDefaultBaseDir(), fileType.getDirectory());
+    if (path.startsWith("/"))
+      path = path.substring(1);
+    fullPath = new Path(fullPath, path);
+    
+    FileSystem fs = getFileSystemByPath(fullPath);
+    return fs.makeQualified(fullPath);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/accumulo/blob/cb45e89b/server/src/main/java/org/apache/accumulo/server/gc/GarbageCollectWriteAheadLogs.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/gc/GarbageCollectWriteAheadLogs.java
b/server/src/main/java/org/apache/accumulo/server/gc/GarbageCollectWriteAheadLogs.java
index f6f08cd..2aa5034 100644
--- a/server/src/main/java/org/apache/accumulo/server/gc/GarbageCollectWriteAheadLogs.java
+++ b/server/src/main/java/org/apache/accumulo/server/gc/GarbageCollectWriteAheadLogs.java
@@ -40,6 +40,7 @@ import org.apache.accumulo.core.util.ThriftUtil;
 import org.apache.accumulo.core.zookeeper.ZooUtil;
 import org.apache.accumulo.server.ServerConstants;
 import org.apache.accumulo.server.fs.VolumeManager;
+import org.apache.accumulo.server.fs.VolumeManager.FileType;
 import org.apache.accumulo.server.security.SystemCredentials;
 import org.apache.accumulo.server.util.MetadataTableUtil;
 import org.apache.accumulo.server.util.MetadataTableUtil.LogEntry;
@@ -222,7 +223,7 @@ public class GarbageCollectWriteAheadLogs {
     return result;
   }
   
-  private static int removeMetadataEntries(Map<Path,String> fileToServerMap, Set<Path>
sortedWALogs, GCStatus status) throws IOException, KeeperException,
+  private int removeMetadataEntries(Map<Path,String> fileToServerMap, Set<Path>
sortedWALogs, GCStatus status) throws IOException, KeeperException,
       InterruptedException {
     int count = 0;
     Iterator<LogEntry> iterator = MetadataTableUtil.getLogEntries(SystemCredentials.get());
@@ -234,7 +235,7 @@ public class GarbageCollectWriteAheadLogs {
         if (filename.contains(":"))
           path = new Path(filename);
         else
-          path = new Path(ServerConstants.getWalDirs()[0] + filename);
+          path = fs.getFullPath(FileType.WAL, filename);
         
         if (fileToServerMap.remove(path) != null)
           status.currentLog.inUse++;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/cb45e89b/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java
b/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java
index 817aa74..18829b2 100644
--- a/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java
+++ b/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java
@@ -82,6 +82,7 @@ import org.apache.accumulo.server.ServerOpts;
 import org.apache.accumulo.server.client.HdfsZooInstance;
 import org.apache.accumulo.server.conf.ServerConfiguration;
 import org.apache.accumulo.server.fs.VolumeManager;
+import org.apache.accumulo.server.fs.VolumeManager.FileType;
 import org.apache.accumulo.server.fs.VolumeManagerImpl;
 import org.apache.accumulo.server.master.state.tables.TableManager;
 import org.apache.accumulo.server.security.SystemCredentials;
@@ -667,12 +668,8 @@ public class SimpleGarbageCollector implements Iface {
           boolean removeFlag;
           
           try {
-            Path fullPath;
-            
-            if (delete.contains(":"))
-              fullPath = new Path(delete);
-            else
-              fullPath = fs.getFullPath(ServerConstants.getTablesDirs(), delete);
+            Path fullPath = fs.getFullPath(FileType.TABLE, delete);
+
             log.debug("Deleting " + fullPath);
             
             if (moveToTrash(fullPath) || fs.deleteRecursively(fullPath)) {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/cb45e89b/server/src/main/java/org/apache/accumulo/server/master/TabletGroupWatcher.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/master/TabletGroupWatcher.java
b/server/src/main/java/org/apache/accumulo/server/master/TabletGroupWatcher.java
index dbf3eca..9492bd7 100644
--- a/server/src/main/java/org/apache/accumulo/server/master/TabletGroupWatcher.java
+++ b/server/src/main/java/org/apache/accumulo/server/master/TabletGroupWatcher.java
@@ -55,7 +55,9 @@ import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.core.tabletserver.thrift.NotServingTabletException;
 import org.apache.accumulo.core.util.Daemon;
 import org.apache.accumulo.core.util.UtilWaitThread;
+import org.apache.accumulo.server.ServerConstants;
 import org.apache.accumulo.server.fs.FileRef;
+import org.apache.accumulo.server.fs.VolumeManager.FileType;
 import org.apache.accumulo.server.master.LiveTServerSet.TServerConnection;
 import org.apache.accumulo.server.master.Master.TabletGoalState;
 import org.apache.accumulo.server.master.state.Assignment;
@@ -421,7 +423,7 @@ class TabletGroupWatcher extends Daemon {
         } else if (key.compareColumnFamily(TabletsSection.CurrentLocationColumnFamily.NAME)
== 0) {
           throw new IllegalStateException("Tablet " + key.getRow() + " is assigned during
a merge!");
         } else if (TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.hasColumns(key)) {
-          datafiles.add(new FileRef(this.master.fs, key));
+          datafiles.add(new FileRef(entry.getValue().toString(), this.master.fs.getFullPath(FileType.TABLE,
entry.getValue().toString())));
           if (datafiles.size() > 1000) {
             MetadataTableUtil.addDeleteEntries(extent, datafiles, SystemCredentials.get());
             datafiles.clear();
@@ -451,7 +453,8 @@ class TabletGroupWatcher extends Daemon {
       } else {
         // Recreate the default tablet to hold the end of the table
         Master.log.debug("Recreating the last tablet to point to " + extent.getPrevEndRow());
-        MetadataTableUtil.addTablet(new KeyExtent(extent.getTableId(), null, extent.getPrevEndRow()),
Constants.DEFAULT_TABLET_LOCATION,
+        String tdir = master.getFileSystem().choose(ServerConstants.getTablesDirs()) + "/"
+ extent.getTableId() + Constants.DEFAULT_TABLET_LOCATION;
+        MetadataTableUtil.addTablet(new KeyExtent(extent.getTableId(), null, extent.getPrevEndRow()),
tdir,
             SystemCredentials.get(), timeType, this.master.masterLock);
       }
     } catch (Exception ex) {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/cb45e89b/server/src/main/java/org/apache/accumulo/server/master/tableOps/CreateTable.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/master/tableOps/CreateTable.java
b/server/src/main/java/org/apache/accumulo/server/master/tableOps/CreateTable.java
index d70ce8f..4ea43fa 100644
--- a/server/src/main/java/org/apache/accumulo/server/master/tableOps/CreateTable.java
+++ b/server/src/main/java/org/apache/accumulo/server/master/tableOps/CreateTable.java
@@ -115,7 +115,8 @@ class PopulateMetadata extends MasterRepo {
   public Repo<Master> call(long tid, Master environment) throws Exception {
     
     KeyExtent extent = new KeyExtent(new Text(tableInfo.tableId), null, null);
-    MetadataTableUtil.addTablet(extent, Constants.DEFAULT_TABLET_LOCATION, SystemCredentials.get(),
tableInfo.timeType, environment.getMasterLock());
+    String tdir = environment.getFileSystem().choose(ServerConstants.getTablesDirs()) + "/"
+ tableInfo.tableId + "" + Constants.DEFAULT_TABLET_LOCATION;
+    MetadataTableUtil.addTablet(extent, tdir, SystemCredentials.get(), tableInfo.timeType,
environment.getMasterLock());
     
     return new FinishCreateTable(tableInfo);
     

http://git-wip-us.apache.org/repos/asf/accumulo/blob/cb45e89b/server/src/main/java/org/apache/accumulo/server/tabletserver/FileManager.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/tabletserver/FileManager.java
b/server/src/main/java/org/apache/accumulo/server/tabletserver/FileManager.java
index 7349d51..b73542e 100644
--- a/server/src/main/java/org/apache/accumulo/server/tabletserver/FileManager.java
+++ b/server/src/main/java/org/apache/accumulo/server/tabletserver/FileManager.java
@@ -42,7 +42,6 @@ import org.apache.accumulo.core.iterators.system.SourceSwitchingIterator;
 import org.apache.accumulo.core.iterators.system.SourceSwitchingIterator.DataSource;
 import org.apache.accumulo.core.iterators.system.TimeSettingIterator;
 import org.apache.accumulo.core.metadata.schema.DataFileValue;
-import org.apache.accumulo.server.ServerConstants;
 import org.apache.accumulo.server.conf.ServerConfiguration;
 import org.apache.accumulo.server.fs.FileRef;
 import org.apache.accumulo.server.fs.VolumeManager;
@@ -307,7 +306,9 @@ public class FileManager {
     // open any files that need to be opened
     for (String file : filesToOpen) {
       try {
-        Path path = fs.getFullPath(ServerConstants.getTablesDirs(), file);
+        if (!file.contains(":"))
+          throw new IllegalArgumentException("Expected uri, got : " + file);
+        Path path = new Path(file);
         FileSystem ns = fs.getFileSystemByPath(path);
         //log.debug("Opening "+file + " path " + path);
         FileSKVIterator reader = FileOperations.getInstance().openReader(path.toString(),
false, ns, ns.getConf(), conf.getTableConfiguration(table.toString()),

http://git-wip-us.apache.org/repos/asf/accumulo/blob/cb45e89b/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java b/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java
index cbafeb0..90542e5 100644
--- a/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java
+++ b/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java
@@ -90,8 +90,8 @@ import org.apache.accumulo.core.security.ColumnVisibility;
 import org.apache.accumulo.core.security.Credentials;
 import org.apache.accumulo.core.util.CachedConfiguration;
 import org.apache.accumulo.core.util.LocalityGroupUtil;
-import org.apache.accumulo.core.util.MapCounter;
 import org.apache.accumulo.core.util.LocalityGroupUtil.LocalityGroupConfigurationError;
+import org.apache.accumulo.core.util.MapCounter;
 import org.apache.accumulo.core.util.Pair;
 import org.apache.accumulo.core.util.UtilWaitThread;
 import org.apache.accumulo.fate.zookeeper.IZooReaderWriter;
@@ -101,6 +101,7 @@ import org.apache.accumulo.server.conf.TableConfiguration;
 import org.apache.accumulo.server.constraints.ConstraintChecker;
 import org.apache.accumulo.server.fs.FileRef;
 import org.apache.accumulo.server.fs.VolumeManager;
+import org.apache.accumulo.server.fs.VolumeManager.FileType;
 import org.apache.accumulo.server.fs.VolumeManagerImpl;
 import org.apache.accumulo.server.master.state.TServerInstance;
 import org.apache.accumulo.server.master.tableOps.CompactRange.CompactionIterators;
@@ -1200,7 +1201,7 @@ public class Tablet {
       Key key = entry.getKey();
       if (key.getRow().equals(row) && key.getColumnFamily().equals(ScanFileColumnFamily.NAME))
{
         String meta = key.getColumnQualifier().toString();
-        Path path = fs.getFullPath(ServerConstants.getTablesDirs(), meta);
+        Path path = fs.getFullPath(extent.getTableId().toString(), meta);
         scanFiles.add(new FileRef(meta, path));
       }
     }
@@ -1256,7 +1257,7 @@ public class Tablet {
     if (location.find(":") >= 0) {
       locationPath = new Path(location.toString());
     } else {
-      locationPath = new Path(ServerConstants.getTablesDirs()[0] + "/" + extent.getTableId().toString()
+ location.toString());
+      locationPath = fs.getFullPath(FileType.TABLE, extent.getTableId().toString() + location.toString());
     }
     this.location = locationPath.makeQualified(fs.getFileSystemByPath(locationPath));
     this.lastLocation = lastLocation;
@@ -1401,7 +1402,7 @@ public class Tablet {
       for (LogEntry logEntry : logEntries) {
         for (String log : logEntry.logSet) {
           String[] parts = log.split("/", 2);
-          Path file = fs.getFullPath(ServerConstants.getWalDirs(), parts[1]);
+          Path file = fs.getFullPath(FileType.WAL, parts[1]);
           currentLogs.add(new DfsLogger(tabletServer.getServerConfig(), logEntry.server,
file));
         }
       }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/cb45e89b/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
b/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
index 56f03af..a44b194 100644
--- a/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
+++ b/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
@@ -153,6 +153,7 @@ import org.apache.accumulo.server.data.ServerConditionalMutation;
 import org.apache.accumulo.server.data.ServerMutation;
 import org.apache.accumulo.server.fs.FileRef;
 import org.apache.accumulo.server.fs.VolumeManager;
+import org.apache.accumulo.server.fs.VolumeManager.FileType;
 import org.apache.accumulo.server.fs.VolumeManagerImpl;
 import org.apache.accumulo.server.master.state.Assignment;
 import org.apache.accumulo.server.master.state.DistributedStoreException;
@@ -3627,8 +3628,8 @@ public class TabletServer extends AbstractMetricsImpl implements org.apache.accu
     for (LogEntry entry : sorted) {
       Path recovery = null;
       for (String log : entry.logSet) {
-        String[] parts = log.split("/"); // "host:port/filename"
-        Path finished = new Path(fs.getFullPath(ServerConstants.getRecoveryDirs(), parts[parts.length
- 1]), "finished");
+        String[] parts = log.split("/", 2); // "host:port/filename"
+        Path finished = new Path(fs.getFullPath(FileType.RECOVERY, parts[parts.length - 1]),
"finished");
         TabletServer.log.info("Looking for " + finished);
         if (fs.exists(finished)) {
           recovery = finished.getParent();

http://git-wip-us.apache.org/repos/asf/accumulo/blob/cb45e89b/server/src/main/java/org/apache/accumulo/server/util/Initialize.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/util/Initialize.java b/server/src/main/java/org/apache/accumulo/server/util/Initialize.java
index 73b9d9f..a952686 100644
--- a/server/src/main/java/org/apache/accumulo/server/util/Initialize.java
+++ b/server/src/main/java/org/apache/accumulo/server/util/Initialize.java
@@ -233,9 +233,10 @@ public class Initialize {
     
     // the actual disk locations of the metadata table and tablets
     final Path[] metadataTableDirs = paths(ServerConstants.getMetadataTableDirs());
-    final Path[] tableMetadataTabletDirs = paths(ServerConstants.prefix(ServerConstants.getMetadataTableDirs(),
TABLE_TABLETS_TABLET_DIR));
-    final Path[] defaultMetadataTabletDirs = paths(ServerConstants.prefix(ServerConstants.getMetadataTableDirs(),
Constants.DEFAULT_TABLET_LOCATION));
     
+    String tableMetadataTabletDir = fs.choose(ServerConstants.prefix(ServerConstants.getMetadataTableDirs(),
TABLE_TABLETS_TABLET_DIR));
+    String defaultMetadataTabletDir = fs.choose(ServerConstants.prefix(ServerConstants.getMetadataTableDirs(),
Constants.DEFAULT_TABLET_LOCATION));
+
     fs.mkdirs(new Path(ServerConstants.getDataVersionLocation(), "" + ServerConstants.DATA_VERSION));
     
     // create an instance id
@@ -288,7 +289,7 @@ public class Initialize {
     // table tablet's directory
     Key tableDirKey = new Key(tableExtent, TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.getColumnFamily(),
         TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.getColumnQualifier(), 0);
-    mfw.append(tableDirKey, new Value(TABLE_TABLETS_TABLET_DIR.getBytes()));
+    mfw.append(tableDirKey, new Value(tableMetadataTabletDir.getBytes()));
     
     // table tablet time
     Key tableTimeKey = new Key(tableExtent, TabletsSection.ServerColumnFamily.TIME_COLUMN.getColumnFamily(),
@@ -306,7 +307,7 @@ public class Initialize {
     // default's directory
     Key defaultDirKey = new Key(defaultExtent, TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.getColumnFamily(),
         TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.getColumnQualifier(), 0);
-    mfw.append(defaultDirKey, new Value(Constants.DEFAULT_TABLET_LOCATION.getBytes()));
+    mfw.append(defaultDirKey, new Value(defaultMetadataTabletDir.getBytes()));
     
     // default's time
     Key defaultTimeKey = new Key(defaultExtent, TabletsSection.ServerColumnFamily.TIME_COLUMN.getColumnFamily(),
@@ -321,7 +322,8 @@ public class Initialize {
     mfw.close();
     
     // create table and default tablets directories
-    for (Path dir : concat(defaultMetadataTabletDirs, tableMetadataTabletDirs)) {
+    for (String s : Arrays.asList(tableMetadataTabletDir, defaultMetadataTabletDir)) {
+      Path dir = new Path(s);
       try {
         fstat = fs.getFileStatus(dir);
         if (!fstat.isDir()) {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/cb45e89b/server/src/main/java/org/apache/accumulo/server/util/MetadataTableUtil.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/util/MetadataTableUtil.java b/server/src/main/java/org/apache/accumulo/server/util/MetadataTableUtil.java
index 9c6ba60..1f3468f 100644
--- a/server/src/main/java/org/apache/accumulo/server/util/MetadataTableUtil.java
+++ b/server/src/main/java/org/apache/accumulo/server/util/MetadataTableUtil.java
@@ -78,6 +78,7 @@ import org.apache.accumulo.server.ServerConstants;
 import org.apache.accumulo.server.client.HdfsZooInstance;
 import org.apache.accumulo.server.fs.FileRef;
 import org.apache.accumulo.server.fs.VolumeManager;
+import org.apache.accumulo.server.fs.VolumeManager.FileType;
 import org.apache.accumulo.server.fs.VolumeManagerImpl;
 import org.apache.accumulo.server.master.state.TServerInstance;
 import org.apache.accumulo.server.security.SystemCredentials;
@@ -498,7 +499,7 @@ public class MetadataTableUtil {
         pathToRemove = "/" + tableId + pathToRemove;
     }
     
-    Path path = VolumeManagerImpl.get().getFullPath(ServerConstants.getTablesDirs(), pathToRemove);
+    Path path = VolumeManagerImpl.get().getFullPath(FileType.TABLE, pathToRemove);
     Mutation delFlag = new Mutation(new Text(MetadataSchema.DeletesSection.getRowPrefix()
+ path.toString()));
     delFlag.put(EMPTY_TEXT, EMPTY_TEXT, new Value(new byte[] {}));
     return delFlag;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/cb45e89b/test/src/test/java/org/apache/accumulo/test/VolumeTest.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/VolumeTest.java b/test/src/test/java/org/apache/accumulo/test/VolumeTest.java
index 8813c63..d7d226c 100644
--- a/test/src/test/java/org/apache/accumulo/test/VolumeTest.java
+++ b/test/src/test/java/org/apache/accumulo/test/VolumeTest.java
@@ -107,6 +107,7 @@ public class VolumeTest {
     scanner.setRange(new Range("1", "1<"));
     scanner.fetchColumnFamily(DataFileColumnFamily.NAME);
     int fileCount = 0;
+    
     for (Entry<Key,Value> entry : scanner) {
       boolean inV1 = entry.getKey().getColumnQualifier().toString().contains(v1.toString());
       boolean inV2 = entry.getKey().getColumnQualifier().toString().contains(v2.toString());


Mime
View raw message