You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ec...@apache.org on 2013/10/29 21:01:44 UTC

git commit: ACCUMULO-1761 fix disk usage to use VolumeManager

Updated Branches:
  refs/heads/master 98359086e -> 60de4b17b


ACCUMULO-1761 fix disk usage to use VolumeManager


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

Branch: refs/heads/master
Commit: 60de4b17b80d206855a4f007c55c5b0b8cd70e0f
Parents: 9835908
Author: Eric Newton <er...@gmail.com>
Authored: Tue Oct 29 16:01:44 2013 -0400
Committer: Eric Newton <er...@gmail.com>
Committed: Tue Oct 29 16:02:04 2013 -0400

----------------------------------------------------------------------
 .../accumulo/minicluster/MiniAccumuloClusterGCTest.java |  1 -
 .../accumulo/server/client/ClientServiceHandler.java    | 11 ++++-------
 .../accumulo/server/tabletserver/TabletServer.java      |  2 +-
 .../org/apache/accumulo/server/util/TableDiskUsage.java | 12 ++++++------
 .../accumulo/test/performance/thrift/NullTserver.java   |  2 +-
 5 files changed, 12 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/60de4b17/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterGCTest.java
----------------------------------------------------------------------
diff --git a/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterGCTest.java b/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterGCTest.java
index cac9032..6470ce1 100644
--- a/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterGCTest.java
+++ b/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterGCTest.java
@@ -28,7 +28,6 @@ import org.apache.accumulo.core.client.ZooKeeperInstance;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.data.Mutation;
-import org.apache.accumulo.core.metadata.MetadataTable;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.filefilter.SuffixFileFilter;
 import org.apache.commons.io.filefilter.TrueFileFilter;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/60de4b17/server/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java b/server/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java
index 1a3a379..3f1aaa2 100644
--- a/server/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java
+++ b/server/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java
@@ -47,21 +47,19 @@ import org.apache.accumulo.core.client.security.tokens.AuthenticationToken.Authe
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.core.conf.Property;
-import org.apache.accumulo.core.file.FileUtil;
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.core.security.Credentials;
 import org.apache.accumulo.core.security.SystemPermission;
 import org.apache.accumulo.core.security.TablePermission;
 import org.apache.accumulo.core.security.thrift.TCredentials;
-import org.apache.accumulo.core.util.CachedConfiguration;
 import org.apache.accumulo.server.conf.ServerConfiguration;
+import org.apache.accumulo.server.fs.VolumeManager;
 import org.apache.accumulo.server.security.AuditedSecurityOperation;
 import org.apache.accumulo.server.security.SecurityOperation;
 import org.apache.accumulo.server.util.TableDiskUsage;
 import org.apache.accumulo.server.zookeeper.TransactionWatcher;
 import org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader;
 import org.apache.accumulo.trace.thrift.TInfo;
-import org.apache.hadoop.fs.FileSystem;
 import org.apache.log4j.Logger;
 import org.apache.thrift.TException;
 
@@ -70,10 +68,12 @@ public class ClientServiceHandler implements ClientService.Iface {
   private static SecurityOperation security = AuditedSecurityOperation.getInstance();
   protected final TransactionWatcher transactionWatcher;
   private final Instance instance;
+  private final VolumeManager fs;
   
-  public ClientServiceHandler(Instance instance, TransactionWatcher transactionWatcher) {
+  public ClientServiceHandler(Instance instance, TransactionWatcher transactionWatcher, VolumeManager fs) {
     this.instance = instance;
     this.transactionWatcher = transactionWatcher;
+    this.fs = fs;
   }
   
   protected String checkTableId(String tableName, TableOperation operation) throws ThriftTableOperationException {
@@ -333,9 +333,6 @@ public class ClientServiceHandler implements ClientService.Iface {
           throw new ThriftSecurityException(credentials.getPrincipal(), SecurityErrorCode.PERMISSION_DENIED);
       }
       
-      AccumuloConfiguration conf = new ServerConfiguration(instance).getConfiguration();
-      FileSystem fs = FileUtil.getFileSystem(CachedConfiguration.getInstance(), conf);
-      
       // use the same set of tableIds that were validated above to avoid race conditions
       Map<TreeSet<String>,Long> diskUsage = TableDiskUsage.getDiskUsage(new ServerConfiguration(instance).getConfiguration(), tableIds, fs, conn);
       List<TDiskUsage> retUsages = new ArrayList<TDiskUsage>();

http://git-wip-us.apache.org/repos/asf/accumulo/blob/60de4b17/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 b3e0f39..b58df33 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
@@ -935,7 +935,7 @@ public class TabletServer extends AbstractMetricsImpl implements org.apache.accu
     private RowLocks rowLocks = new RowLocks();
     
     ThriftClientHandler() {
-      super(instance, watcher);
+      super(instance, watcher, fs);
       log.debug(ThriftClientHandler.class.getName() + " created");
       sessionManager = new SessionManager(getSystemConfiguration());
       // Register the metrics MBean

http://git-wip-us.apache.org/repos/asf/accumulo/blob/60de4b17/server/src/main/java/org/apache/accumulo/server/util/TableDiskUsage.java
----------------------------------------------------------------------
diff --git a/server/src/main/java/org/apache/accumulo/server/util/TableDiskUsage.java b/server/src/main/java/org/apache/accumulo/server/util/TableDiskUsage.java
index 377542c..b7019e6 100644
--- a/server/src/main/java/org/apache/accumulo/server/util/TableDiskUsage.java
+++ b/server/src/main/java/org/apache/accumulo/server/util/TableDiskUsage.java
@@ -45,9 +45,9 @@ import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.core.util.NumUtil;
 import org.apache.accumulo.server.ServerConstants;
 import org.apache.accumulo.server.cli.ClientOpts;
-import org.apache.hadoop.conf.Configuration;
+import org.apache.accumulo.server.fs.VolumeManager;
+import org.apache.accumulo.server.fs.VolumeManagerImpl;
 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;
@@ -129,7 +129,7 @@ public class TableDiskUsage {
     void print(String line);
   }
   
-  public static void printDiskUsage(AccumuloConfiguration acuConf, Collection<String> tables, FileSystem fs, Connector conn, boolean humanReadable)
+  public static void printDiskUsage(AccumuloConfiguration acuConf, Collection<String> tables, VolumeManager fs, Connector conn, boolean humanReadable)
       throws TableNotFoundException, IOException {
     printDiskUsage(acuConf, tables, fs, conn, new Printer() {
       @Override
@@ -139,7 +139,7 @@ public class TableDiskUsage {
     }, humanReadable);
   }
   
-  public static Map<TreeSet<String>,Long> getDiskUsage(AccumuloConfiguration acuConf, Set<String> tableIds, FileSystem fs, Connector conn) throws IOException {
+  public static Map<TreeSet<String>,Long> getDiskUsage(AccumuloConfiguration acuConf, Set<String> tableIds, VolumeManager fs, Connector conn) throws IOException {
     TableDiskUsage tdu = new TableDiskUsage();
     
     for (String tableId : tableIds)
@@ -243,7 +243,7 @@ public class TableDiskUsage {
     return usage;
   }
   
-  public static void printDiskUsage(AccumuloConfiguration acuConf, Collection<String> tables, FileSystem fs, Connector conn, Printer printer,
+  public static void printDiskUsage(AccumuloConfiguration acuConf, Collection<String> tables, VolumeManager fs, Connector conn, Printer printer,
       boolean humanReadable) throws TableNotFoundException, IOException {
     
     HashSet<String> tableIds = new HashSet<String>();
@@ -274,7 +274,7 @@ public class TableDiskUsage {
    * @param args
    */
   public static void main(String[] args) throws Exception {
-    FileSystem fs = FileSystem.get(new Configuration());
+    VolumeManager fs = VolumeManagerImpl.get();
     Opts opts = new Opts();
     opts.parseArgs(TableDiskUsage.class.getName(), args);
     Connector conn = opts.getConnector();

http://git-wip-us.apache.org/repos/asf/accumulo/blob/60de4b17/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java b/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java
index f4eb234..78b2564 100644
--- a/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java
+++ b/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java
@@ -88,7 +88,7 @@ public class NullTserver {
     private long updateSession = 1;
     
     public ThriftClientHandler(Instance instance, TransactionWatcher watcher) {
-      super(instance, watcher);
+      super(instance, watcher, null);
     }
     
     @Override