accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1490338 - in /accumulo/branches/ACCUMULO-118/server/src/main/java/org/apache/accumulo/server: fs/FileSystemImpl.java util/Initialize.java
Date Thu, 06 Jun 2013 16:24:40 GMT
Author: ecn
Date: Thu Jun  6 16:24:40 2013
New Revision: 1490338

URL: http://svn.apache.org/r1490338
Log:
ACCUMULO-118 handle different uris

Modified:
    accumulo/branches/ACCUMULO-118/server/src/main/java/org/apache/accumulo/server/fs/FileSystemImpl.java
    accumulo/branches/ACCUMULO-118/server/src/main/java/org/apache/accumulo/server/util/Initialize.java

Modified: accumulo/branches/ACCUMULO-118/server/src/main/java/org/apache/accumulo/server/fs/FileSystemImpl.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-118/server/src/main/java/org/apache/accumulo/server/fs/FileSystemImpl.java?rev=1490338&r1=1490337&r2=1490338&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-118/server/src/main/java/org/apache/accumulo/server/fs/FileSystemImpl.java
(original)
+++ accumulo/branches/ACCUMULO-118/server/src/main/java/org/apache/accumulo/server/fs/FileSystemImpl.java
Thu Jun  6 16:24:40 2013
@@ -231,7 +231,7 @@ public class FileSystemImpl implements o
 
   @Override
   public FileSystem getFileSystemByPath(Path path) {
-    if (path.isAbsolute())
+    if (path.toString().contains(":"))
     {
       try {
         return path.getFileSystem(CachedConfiguration.getInstance());
@@ -297,6 +297,10 @@ public class FileSystemImpl implements o
 
   public static org.apache.accumulo.server.fs.FileSystem get() throws IOException {
     AccumuloConfiguration conf = ServerConfiguration.getSystemConfiguration(HdfsZooInstance.getInstance());
+    return get(conf);
+  }
+
+  public static org.apache.accumulo.server.fs.FileSystem get(AccumuloConfiguration conf)
throws IOException {
     return new FileSystemImpl(Collections.singletonMap("", FileSystem.get(CachedConfiguration.getInstance())),
"", conf);
   }
 

Modified: accumulo/branches/ACCUMULO-118/server/src/main/java/org/apache/accumulo/server/util/Initialize.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-118/server/src/main/java/org/apache/accumulo/server/util/Initialize.java?rev=1490338&r1=1490337&r2=1490338&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-118/server/src/main/java/org/apache/accumulo/server/util/Initialize.java
(original)
+++ accumulo/branches/ACCUMULO-118/server/src/main/java/org/apache/accumulo/server/util/Initialize.java
Thu Jun  6 16:24:40 2013
@@ -34,12 +34,12 @@ import org.apache.accumulo.core.client.A
 import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException;
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.core.conf.SiteConfiguration;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.KeyExtent;
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.file.FileOperations;
 import org.apache.accumulo.core.file.FileSKVWriter;
-import org.apache.accumulo.core.file.FileUtil;
 import org.apache.accumulo.core.iterators.user.VersioningIterator;
 import org.apache.accumulo.core.master.state.tables.TableState;
 import org.apache.accumulo.core.master.thrift.MasterGoalState;
@@ -53,6 +53,8 @@ import org.apache.accumulo.server.Server
 import org.apache.accumulo.server.client.HdfsZooInstance;
 import org.apache.accumulo.server.conf.ServerConfiguration;
 import org.apache.accumulo.server.constraints.MetadataConstraints;
+import org.apache.accumulo.server.fs.FileSystem;
+import org.apache.accumulo.server.fs.FileSystemImpl;
 import org.apache.accumulo.server.iterators.MetadataBulkLoadFilter;
 import org.apache.accumulo.server.master.state.tables.TableManager;
 import org.apache.accumulo.server.security.AuditedSecurityOperation;
@@ -61,7 +63,6 @@ import org.apache.accumulo.server.tablet
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileStatus;
-import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.io.Text;
 import org.apache.log4j.Logger;
@@ -117,7 +118,7 @@ public class Initialize {
     if (!ServerConfiguration.getSiteConfiguration().get(Property.INSTANCE_DFS_URI).equals(""))
       log.info("Hadoop Filesystem is " + ServerConfiguration.getSiteConfiguration().get(Property.INSTANCE_DFS_URI));
     else
-      log.info("Hadoop Filesystem is " + FileSystem.getDefaultUri(conf));
+      log.info("Hadoop Filesystem is " + org.apache.hadoop.fs.FileSystem.getDefaultUri(conf));
     
     log.info("Accumulo data dirs are " + Arrays.asList(ServerConstants.getBaseDirs()));
     log.info("Zookeeper server is " + ServerConfiguration.getSiteConfiguration().get(Property.INSTANCE_ZK_HOST));
@@ -172,7 +173,7 @@ public class Initialize {
     }
     
     try {
-      initFileSystem(opts, fs, fs.getConf(), uuid);
+      initFileSystem(opts, fs, uuid);
     } catch (Exception e) {
       log.fatal("Failed to initialize filesystem", e);
       return false;
@@ -219,7 +220,7 @@ public class Initialize {
     return result.toArray(a);
   }
   
-  private static void initFileSystem(Opts opts, FileSystem fs, Configuration conf, UUID uuid)
throws IOException {
+  private static void initFileSystem(Opts opts, FileSystem fs, UUID uuid) throws IOException
{
     FileStatus fstat;
     
     // the actual disk location of the root tablet
@@ -274,7 +275,8 @@ public class Initialize {
     // metadata tablets
     String initRootTabFile = rootTablet + "/00000_00000."
         + FileOperations.getNewFileExtension(AccumuloConfiguration.getDefaultConfiguration());
-    FileSKVWriter mfw = FileOperations.getInstance().openWriter(initRootTabFile, fs, conf,
AccumuloConfiguration.getDefaultConfiguration());
+    org.apache.hadoop.fs.FileSystem ns = fs.getFileSystemByPath(new Path(initRootTabFile));
+    FileSKVWriter mfw = FileOperations.getInstance().openWriter(initRootTabFile, ns, ns.getConf(),
AccumuloConfiguration.getDefaultConfiguration());
     mfw.startDefaultLocalityGroup();
     
     // -----------] root tablet info
@@ -501,7 +503,7 @@ public class Initialize {
       SecurityUtil.serverLogin();
       Configuration conf = CachedConfiguration.getInstance();
       
-      FileSystem fs = FileUtil.getFileSystem(conf, ServerConfiguration.getSiteConfiguration());
+      FileSystem fs = FileSystemImpl.get(SiteConfiguration.getSiteConfiguration());
       
       if (opts.resetSecurity) {
         if (isInitialized(fs)) {



Mime
View raw message