accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vi...@apache.org
Subject svn commit: r1433166 [12/20] - in /accumulo/branches/ACCUMULO-259: ./ assemble/ assemble/platform/ assemble/scripts/ assemble/scripts/init.d/ bin/ conf/examples/1GB/native-standalone/ conf/examples/1GB/standalone/ conf/examples/2GB/native-standalone/ c...
Date Mon, 14 Jan 2013 22:03:34 GMT
Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java?rev=1433166&r1=1433165&r2=1433166&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java Mon Jan 14 22:03:24 2013
@@ -47,7 +47,7 @@ import org.apache.accumulo.server.conf.S
 import org.apache.accumulo.server.security.AuditedSecurityOperation;
 import org.apache.accumulo.server.security.SecurityOperation;
 import org.apache.accumulo.server.zookeeper.TransactionWatcher;
-import org.apache.accumulo.start.classloader.AccumuloClassLoader;
+import org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader;
 import org.apache.log4j.Logger;
 import org.apache.thrift.TException;
 
@@ -55,7 +55,7 @@ import org.apache.thrift.TException;
 public class ClientServiceHandler implements ClientService.Iface {
   private static final Logger log = Logger.getLogger(ClientServiceHandler.class);
   private static SecurityOperation security = AuditedSecurityOperation.getInstance();
-  private final TransactionWatcher transactionWatcher;
+  protected final TransactionWatcher transactionWatcher;
   private final Instance instance;
   
   public ClientServiceHandler(Instance instance, TransactionWatcher transactionWatcher) {
@@ -227,7 +227,7 @@ public class ClientServiceHandler implem
     Class shouldMatch;
     try {
       shouldMatch = loader.loadClass(interfaceMatch);
-      Class test = AccumuloClassLoader.loadClass(className, shouldMatch);
+      Class test = AccumuloVFSClassLoader.loadClass(className, shouldMatch);
       test.newInstance();
       return true;
     } catch (ClassCastException e) {

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/conf/ServerConfiguration.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/conf/ServerConfiguration.java?rev=1433166&r1=1433165&r2=1433166&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/conf/ServerConfiguration.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/conf/ServerConfiguration.java Mon Jan 14 22:03:24 2013
@@ -30,7 +30,7 @@ import org.apache.accumulo.core.data.Key
 
 public class ServerConfiguration {
   
-  private static Map<String,TableConfiguration> tableInstances = new HashMap<String,TableConfiguration>(1);
+  private static final Map<String,TableConfiguration> tableInstances = new HashMap<String,TableConfiguration>(1);
   private static SecurityPermission CONFIGURATION_PERMISSION = new SecurityPermission("configurationPermission");
   
   public static synchronized SiteConfiguration getSiteConfiguration() {

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/conf/ZooConfiguration.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/conf/ZooConfiguration.java?rev=1433166&r1=1433165&r2=1433166&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/conf/ZooConfiguration.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/conf/ZooConfiguration.java Mon Jan 14 22:03:24 2013
@@ -42,7 +42,7 @@ public class ZooConfiguration extends Ac
   private static ZooConfiguration instance = null;
   private static String instanceId = null;
   private static ZooCache propCache = null;
-  private Map<String,String> fixedProps = Collections.synchronizedMap(new HashMap<String,String>());
+  private final Map<String,String> fixedProps = Collections.synchronizedMap(new HashMap<String,String>());
   
   private ZooConfiguration(AccumuloConfiguration parent) {
     this.parent = parent;

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/constraints/ConstraintLoader.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/constraints/ConstraintLoader.java?rev=1433166&r1=1433165&r2=1433166&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/constraints/ConstraintLoader.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/constraints/ConstraintLoader.java Mon Jan 14 22:03:24 2013
@@ -22,7 +22,7 @@ import java.util.Map.Entry;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.constraints.Constraint;
 import org.apache.accumulo.server.conf.TableConfiguration;
-import org.apache.accumulo.start.classloader.AccumuloClassLoader;
+import org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader;
 import org.apache.log4j.Logger;
 
 public class ConstraintLoader {
@@ -35,7 +35,7 @@ public class ConstraintLoader {
       for (Entry<String,String> entry : conf) {
         if (entry.getKey().startsWith(Property.TABLE_CONSTRAINT_PREFIX.getKey())) {
           String className = entry.getValue();
-          Class<? extends Constraint> clazz = AccumuloClassLoader.loadClass(className, Constraint.class);
+          Class<? extends Constraint> clazz = AccumuloVFSClassLoader.loadClass(className, Constraint.class);
           log.debug("Loaded constraint " + clazz.getName() + " for " + conf.getTableId());
           cc.addConstraint(clazz.newInstance());
         }

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/fate/Admin.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/fate/Admin.java?rev=1433166&r1=1433165&r2=1433166&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/fate/Admin.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/fate/Admin.java Mon Jan 14 22:03:24 2013
@@ -16,7 +16,11 @@
  */
 package org.apache.accumulo.server.fate;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.accumulo.core.Constants;
+import org.apache.accumulo.core.cli.Help;
 import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.zookeeper.ZooUtil;
 import org.apache.accumulo.fate.AdminUtil;
@@ -26,31 +30,60 @@ import org.apache.accumulo.server.client
 import org.apache.accumulo.server.master.Master;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 
+import com.beust.jcommander.JCommander;
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.Parameters;
+
+
 /**
  * A utility to administer FATE operations
  */
 public class Admin {
+  
+  static class TxOpts {
+    @Parameter(description="<txid>", required=true)
+    List<String> args = new ArrayList<String>();
+  }
+  
+  @Parameters(commandDescription="Stop an existing FATE by transaction id")
+  static class FailOpts extends TxOpts {
+  }
+  
+  @Parameters(commandDescription="Delete an existing FATE by transaction id")
+  static class DeleteOpts extends TxOpts {
+  }
+  
+  @Parameters(commandDescription="List the existing FATE transactions")
+  static class PrintOpts {
+  }
+  
   public static void main(String[] args) throws Exception {
-    AdminUtil<Master> admin = new AdminUtil<Master>();
-    boolean valid = (args.length == 2 && args[0].matches("fail|delete")) || (args.length == 1 && args[0].equals("print"));
-    
-    if (!valid) {
-      System.err.println("Usage : " + Admin.class.getSimpleName() + " fail <txid> | delete <txid> | print");
+    Help opts = new Help();
+    JCommander jc = new JCommander(opts);
+    jc.setProgramName(Admin.class.getName());
+    jc.addCommand("fail", new FailOpts());
+    jc.addCommand("delete", new DeleteOpts());
+    jc.addCommand("print", new PrintOpts());
+    jc.parse(args);
+    if (opts.help || jc.getParsedCommand() == null) {
+      jc.usage();
       System.exit(-1);
     }
     
+    AdminUtil<Master> admin = new AdminUtil<Master>();
+    
     Instance instance = HdfsZooInstance.getInstance();
     String path = ZooUtil.getRoot(instance) + Constants.ZFATE;
     String masterPath = ZooUtil.getRoot(instance) + Constants.ZMASTER_LOCK;
     IZooReaderWriter zk = ZooReaderWriter.getRetryingInstance();
     ZooStore<Master> zs = new ZooStore<Master>(path, zk);
     
-    if (args[0].equals("fail")) {
-      admin.prepFail(zs, masterPath, args[1]);
-    } else if (args[0].equals("delete")) {
-      admin.prepDelete(zs, masterPath, args[1]);
+    if (jc.getParsedCommand().equals("fail")) {
+      admin.prepFail(zs, zk, masterPath, args[1]);
+    } else if (jc.getParsedCommand().equals("delete")) {
+      admin.prepDelete(zs, zk, masterPath, args[1]);
       admin.deleteLocks(zs, zk, ZooUtil.getRoot(instance) + Constants.ZTABLE_LOCKS, args[1]);
-    } else if (args[0].equals("print")) {
+    } else if (jc.getParsedCommand().equals("print")) {
       admin.print(zs, zk, ZooUtil.getRoot(instance) + Constants.ZTABLE_LOCKS);
     }
   }

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java?rev=1433166&r1=1433165&r2=1433166&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java Mon Jan 14 22:03:24 2013
@@ -16,10 +16,10 @@
  */
 package org.apache.accumulo.server.gc;
 
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.net.UnknownHostException;
-import java.nio.charset.Charset;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Locale;
@@ -39,6 +39,7 @@ import org.apache.accumulo.cloudtrace.in
 import org.apache.accumulo.cloudtrace.instrument.thrift.TraceWrap;
 import org.apache.accumulo.cloudtrace.thrift.TInfo;
 import org.apache.accumulo.core.Constants;
+import org.apache.accumulo.core.cli.Help;
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.BatchWriter;
@@ -85,34 +86,31 @@ import org.apache.accumulo.server.util.O
 import org.apache.accumulo.server.util.TServerUtils;
 import org.apache.accumulo.server.util.TabletIterator;
 import org.apache.accumulo.server.zookeeper.ZooLock;
-import org.apache.commons.cli.BasicParser;
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.Option;
-import org.apache.commons.cli.Options;
-import org.apache.commons.cli.ParseException;
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.Trash;
 import org.apache.hadoop.io.Text;
 import org.apache.log4j.Logger;
 import org.apache.zookeeper.KeeperException;
 
+import com.beust.jcommander.Parameter;
+
 public class SimpleGarbageCollector implements Iface {
   private static final Text EMPTY_TEXT = new Text();
-
-  private static final Charset utf8 = Charset.forName("UTF8");
   
-  static final Options OPTS = new Options();
-  static final Option OPT_VERBOSE_MODE = new Option("v", "verbose", false, "extra information will get printed to stdout also");
-  static final Option OPT_SAFE_MODE = new Option("s", "safemode", false, "safe mode will not delete files");
-  static final Option OPT_OFFLINE = new Option("o", "offline", false,
-      "offline mode will run once and check data files directly; this is dangerous if accumulo is running or not shut down properly");
-  static final Option OPT_ADDRESS = new Option("a", "address", true, "specify our local address");
-  static {
-    OPTS.addOption(OPT_VERBOSE_MODE);
-    OPTS.addOption(OPT_SAFE_MODE);
-    OPTS.addOption(OPT_OFFLINE);
-    OPTS.addOption(OPT_ADDRESS);
+  static class Opts extends Help {
+    @Parameter(names={"-v", "--verbose"}, description="extra information will get printed to stdout also")
+    boolean verbose = false;
+    @Parameter(names={"-s", "--safemode"}, description="safe mode will not delete files")
+    boolean safeMode = false;
+    @Parameter(names={"-o", "--offline"}, description=
+      "offline mode will run once and check data files directly; this is dangerous if accumulo is running or not shut down properly")
+    boolean offline = false;
+    @Parameter(names={"-a", "--address"}, description="specify our local address")
+    String address = null;
+    @Parameter(names={"--no-trash"}, description="do not use the Trash, even if it is configured")
+    boolean noTrash = false;
   }
 
   // how much of the JVM's available memory should it use gathering candidates
@@ -120,11 +118,12 @@ public class SimpleGarbageCollector impl
   private boolean candidateMemExceeded;
   
   private static final Logger log = Logger.getLogger(SimpleGarbageCollector.class);
-  
+    
   private AuthInfo credentials;
   private long gcStartDelay;
   private boolean checkForBulkProcessingFiles;
   private FileSystem fs;
+  private Trash trash = null;
   private boolean safemode = false, offline = false, verbose = false;
   private String address = "localhost";
   private ZooLock lock;
@@ -145,27 +144,19 @@ public class SimpleGarbageCollector impl
     Accumulo.init(fs, serverConf, "gc");
     String address = "localhost";
     SimpleGarbageCollector gc = new SimpleGarbageCollector();
-    try {
-      final CommandLine commandLine = new BasicParser().parse(OPTS, args);
-      if (commandLine.getArgs().length != 0)
-        throw new ParseException("Extraneous arguments");
-      
-      if (commandLine.hasOption(OPT_SAFE_MODE.getOpt()))
-        gc.setSafeMode();
-      if (commandLine.hasOption(OPT_OFFLINE.getOpt()))
-        gc.setOffline();
-      if (commandLine.hasOption(OPT_VERBOSE_MODE.getOpt()))
-        gc.setVerbose();
-      address = commandLine.getOptionValue(OPT_ADDRESS.getOpt());
-      if (address != null)
-        gc.useAddress(address);
-    } catch (ParseException e) {
-      String str = "Can't parse the command line options";
-      log.fatal(str, e);
-      throw new IllegalArgumentException(str, e);
-    }
+    Opts opts = new Opts();
+    opts.parseArgs(SimpleGarbageCollector.class.getName(), args);
     
-    gc.init(fs, instance, SecurityConstants.getSystemCredentials());
+    if (opts.safeMode)
+      gc.setSafeMode();
+    if (opts.offline)
+      gc.setOffline();
+    if (opts.verbose)
+      gc.setVerbose();
+    if (opts.address != null)
+      gc.useAddress(address);
+    
+    gc.init(fs, instance, SecurityConstants.getSystemCredentials(), opts.noTrash);
     Accumulo.enableTracing(address, "gc");
     gc.run();
   }
@@ -188,7 +179,7 @@ public class SimpleGarbageCollector impl
     this.address = address;
   }
 
-  public void init(FileSystem fs, Instance instance, AuthInfo credentials) {
+  public void init(FileSystem fs, Instance instance, AuthInfo credentials, boolean noTrash) throws IOException {
     this.fs = TraceFileSystem.wrap(fs);
     this.credentials = credentials;
     this.instance = instance;
@@ -203,6 +194,9 @@ public class SimpleGarbageCollector impl
     log.info("verbose: " + verbose);
     log.info("memory threshold: " + CANDIDATE_MEMORY_PERCENTAGE + " of " + Runtime.getRuntime().maxMemory() + " bytes");
     log.info("delete threads: " + numDeleteThreads);
+    if (!noTrash) {
+      this.trash = new Trash(fs, fs.getConf());
+    }
   }
   
   private void run() {
@@ -353,8 +347,15 @@ public class SimpleGarbageCollector impl
       if (tabletDirs == null)
         continue;
       
-      if (tabletDirs.length == 0)
-        fs.delete(new Path(ServerConstants.getTablesDir() + "/" + delTableId), false);
+      if (tabletDirs.length == 0) {
+        Path p = new Path(ServerConstants.getTablesDir() + "/" + delTableId);
+        try {
+          trash.moveToTrash(p);
+        } catch (FileNotFoundException ex) {
+          log.debug("Ignoring error moving a directory " + p + " to the trash", ex);
+          fs.delete(p, false);
+        }
+      }
     }
   }
   
@@ -370,7 +371,7 @@ public class SimpleGarbageCollector impl
     
     while (true) {
       lock = new ZooLock(path);
-      if (lock.tryLock(lockWatcher, new ServerServices(address, Service.GC_CLIENT).toString().getBytes(utf8))) {
+      if (lock.tryLock(lockWatcher, new ServerServices(address, Service.GC_CLIENT).toString().getBytes())) {
         break;
       }
       UtilWaitThread.sleep(1000);
@@ -380,8 +381,9 @@ public class SimpleGarbageCollector impl
   private InetSocketAddress startStatsService() throws UnknownHostException {
     Processor<Iface> processor = new Processor<Iface>(TraceWrap.service(this));
     int port = instance.getConfiguration().getPort(Property.GC_PORT);
+    long maxMessageSize = instance.getConfiguration().getMemoryInBytes(Property.GENERAL_MAX_MESSAGE_SIZE);
     try {
-      TServerUtils.startTServer(port, processor, this.getClass().getSimpleName(), "GC Monitor Service", 2, 1000);
+      TServerUtils.startTServer(port, processor, this.getClass().getSimpleName(), "GC Monitor Service", 2, 1000, maxMessageSize);
     } catch (Exception ex) {
       log.fatal(ex, ex);
       throw new RuntimeException(ex);
@@ -602,8 +604,15 @@ public class SimpleGarbageCollector impl
           try {
             
             Path p = new Path(ServerConstants.getTablesDir() + delete);
+            boolean moved = false;
+            if (trash != null)
+              try {
+                moved = trash.moveToTrash(p);
+              } catch (FileNotFoundException ex) {
+                log.debug("Ignoring exception moving " + p + " to trash");
+              }
             
-            if (fs.delete(p, true)) {
+            if (moved || fs.delete(p, true)) {
               // delete succeeded, still want to delete
               removeFlag = true;
               synchronized (SimpleGarbageCollector.this) {

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/logger/LogReader.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/logger/LogReader.java?rev=1433166&r1=1433165&r2=1433166&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/logger/LogReader.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/logger/LogReader.java Mon Jan 14 22:03:24 2013
@@ -18,11 +18,14 @@ package org.apache.accumulo.server.logge
 
 import java.io.EOFException;
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Set;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import org.apache.accumulo.core.cli.Help;
 import org.apache.accumulo.core.data.KeyExtent;
 import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.file.FileUtil;
@@ -30,10 +33,6 @@ import org.apache.accumulo.core.util.Cac
 import org.apache.accumulo.server.conf.ServerConfiguration;
 import org.apache.accumulo.server.tabletserver.log.MultiReader;
 import org.apache.accumulo.server.trace.TraceFileSystem;
-import org.apache.commons.cli.BasicParser;
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.Option;
-import org.apache.commons.cli.Options;
 import org.apache.commons.cli.ParseException;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FSDataInputStream;
@@ -41,9 +40,22 @@ import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.io.Text;
 
+import com.beust.jcommander.JCommander;
+import com.beust.jcommander.Parameter;
+
 public class LogReader {
-  public static void usage() {
-    System.err.println("Usage : " + LogReader.class.getName() + " [-r <row>] [-m <maxColumns] [-t <key extent>] [-p <row regex>] <log file>");
+  
+  static class Opts extends Help {
+    @Parameter(names="-r", description="print only mutations associated with the given row")
+    String row;
+    @Parameter(names="-m", description="limit the number of mutations printed per row")
+    int maxMutations = 5;
+    @Parameter(names="-t", description="print only mutations that fall within the given key extent")
+    String extent;
+    @Parameter(names="-p", description="search for a row that matches the given regex")
+    String regexp;
+    @Parameter(description="<logfile> { <logfile> ... }")
+    List<String> files = new ArrayList<String>();
   }
   
   /**
@@ -55,52 +67,33 @@ public class LogReader {
    * @throws ParseException
    */
   public static void main(String[] args) throws IOException {
+    Opts opts = new Opts();
+    opts.parseArgs(LogReader.class.getName(), args);
     Configuration conf = CachedConfiguration.getInstance();
     FileSystem fs = TraceFileSystem.wrap(FileUtil.getFileSystem(conf, ServerConfiguration.getSiteConfiguration()));
     FileSystem local = TraceFileSystem.wrap(FileSystem.getLocal(conf));
-    Option rowOpt = new Option("r", "row", true, "search for a specific row");
-    Option maxOpt = new Option("m", "max-mutations", true, "the maximum number of mutations to print per log entry");
-    Option tabletOpt = new Option("t", "tablet", true, "key extent");
-    Option rowPatternOpt = new Option("p", "row-pattern", true, "search for a row that matches the given regex");
-    Options options = new Options();
-    options.addOption(rowOpt);
-    options.addOption(maxOpt);
-    options.addOption(tabletOpt);
-    options.addOption(rowPatternOpt);
-    CommandLine cl;
-    try {
-      cl = new BasicParser().parse(options, args);
-    } catch (ParseException ex) {
-      usage();
-      return;
-    }
     
     Matcher rowMatcher = null;
     KeyExtent ke = null;
     Text row = null;
-    int max = 5;
-    String[] files = cl.getArgs();
-    if (files.length == 0) {
-      usage();
+    if (opts.files.isEmpty()) {
+      new JCommander(opts).usage();
       return;
     }
-    if (cl.hasOption(rowOpt.getOpt()))
-      row = new Text(cl.getOptionValue(rowOpt.getOpt()));
-    if (cl.hasOption(maxOpt.getOpt()))
-      max = Integer.parseInt(cl.getOptionValue(maxOpt.getOpt()));
-    if (cl.hasOption(tabletOpt.getOpt())) {
-      String extent = cl.getOptionValue(tabletOpt.getOpt());
-      String sa[] = extent.split(";");
+    if (opts.row != null)
+      row = new Text(opts.row);
+    if (opts.extent != null) {
+      String sa[] = opts.extent.split(";");
       ke = new KeyExtent(new Text(sa[0]), new Text(sa[1]), new Text(sa[2]));
     }
-    if (cl.hasOption(rowPatternOpt.getOpt())) {
-      Pattern pattern = Pattern.compile(cl.getOptionValue(rowPatternOpt.getOpt()));
+    if (opts.regexp != null) {
+      Pattern pattern = Pattern.compile(opts.regexp);
       rowMatcher = pattern.matcher("");
     }
     
     Set<Integer> tabletIds = new HashSet<Integer>();
 
-    for (String file : files) {
+    for (String file : opts.files) {
       
       Path path = new Path(file);
       LogFileKey key = new LogFileKey();
@@ -116,7 +109,7 @@ public class LogReader {
           } catch (EOFException ex) {
             break;
           }
-          printLogEvent(key, value, row, rowMatcher, ke, tabletIds, max);
+          printLogEvent(key, value, row, rowMatcher, ke, tabletIds, opts.maxMutations);
         }
       } else if (local.isFile(path)) {
         // read log entries from a simple file
@@ -128,13 +121,13 @@ public class LogReader {
           } catch (EOFException ex) {
             break;
           }
-          printLogEvent(key, value, row, rowMatcher, ke, tabletIds, max);
+          printLogEvent(key, value, row, rowMatcher, ke, tabletIds, opts.maxMutations);
         }
       } else {
         // read the log entries sorted in a map file
         MultiReader input = new MultiReader(fs, conf, file);
         while (input.next(key, value)) {
-          printLogEvent(key, value, row, rowMatcher, ke, tabletIds, max);
+          printLogEvent(key, value, row, rowMatcher, ke, tabletIds, opts.maxMutations);
         }
       }
     }

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java?rev=1433166&r1=1433165&r2=1433166&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java Mon Jan 14 22:03:24 2013
@@ -22,7 +22,10 @@ import java.net.InetSocketAddress;
 import java.nio.ByteBuffer;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
+import java.util.Map.Entry;
 import java.util.Set;
 import java.util.TimerTask;
 
@@ -51,8 +54,11 @@ import org.apache.hadoop.io.Text;
 import org.apache.log4j.Logger;
 import org.apache.thrift.TException;
 import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.KeeperException.NoNodeException;
+import org.apache.zookeeper.KeeperException.NotEmptyException;
 import org.apache.zookeeper.WatchedEvent;
 import org.apache.zookeeper.Watcher;
+import org.apache.zookeeper.Watcher.Event.EventType;
 import org.apache.zookeeper.data.Stat;
 
 public class LiveTServerSet implements Watcher {
@@ -203,6 +209,7 @@ public class LiveTServerSet implements W
   
   // Map from tserver master service to server information
   private Map<String,TServerInfo> current = new HashMap<String,TServerInfo>();
+  private HashMap<String,Long> serversToDelete = new HashMap<String,Long>();
 
   public LiveTServerSet(Instance instance, AccumuloConfiguration conf, Listener cback) {
     this.cback = cback;
@@ -233,60 +240,124 @@ public class LiveTServerSet implements W
       final Set<TServerInstance> doomed = new HashSet<TServerInstance>();
       
       final String path = ZooUtil.getRoot(instance) + Constants.ZTSERVERS;
+      
+      Iterator<Entry<String,Long>> serversToDelIter = serversToDelete.entrySet().iterator();
+      while (serversToDelIter.hasNext()) {
+        Entry<String,Long> entry = serversToDelIter.next();
+        if (System.currentTimeMillis() - entry.getValue() > 10000) {
+          String serverNode = path + "/" + entry.getKey();
+          serversToDelIter.remove();
+          deleteServerNode(serverNode);
+        }
+      }
+
       for (String server : getZooCache().getChildren(path)) {
-        // See if we have an async lock in place?
-        TServerInfo info = current.get(server);
-        TServerLockWatcher watcher;
-        ZooLock lock;
-        final String lockPath = path + "/" + server;
-        if (info != null) {
-          // yep: get out the lock/watcher so we can check on it
-          watcher = info.watcher;
-          lock = info.lock;
+        if (serversToDelete.containsKey(server))
+          continue;
+
+        checkServer(updates, doomed, path, server, 2);
+      }
+
+      // log.debug("Current: " + current.keySet());
+      if (!doomed.isEmpty() || !updates.isEmpty())
+        this.cback.update(this, doomed, updates);
+    } catch (Exception ex) {
+      log.error(ex, ex);
+    }
+  }
+
+  private void deleteServerNode(String serverNode) throws InterruptedException, KeeperException {
+    try {
+      ZooReaderWriter.getInstance().delete(serverNode, -1);
+    } catch (NotEmptyException ex) {
+      // race condition: tserver created the lock after our last check; we'll see it at the next check
+    } catch (NoNodeException nne) {
+      // someone else deleted it
+    }
+  }
+  
+  private synchronized void checkServer(final Set<TServerInstance> updates, final Set<TServerInstance> doomed, final String path, final String server,
+      int recurse)
+      throws TException,
+      InterruptedException, KeeperException {
+    
+    if (recurse == 0)
+      return;
+
+    // See if we have an async lock in place?
+    TServerInfo info = current.get(server);
+    TServerLockWatcher watcher;
+    ZooLock lock;
+    final String lockPath = path + "/" + server;
+    if (info != null) {
+      // yep: get out the lock/watcher so we can check on it
+      watcher = info.watcher;
+      lock = info.lock;
+    } else {
+      // nope: create a new lock and watcher
+      lock = new ZooLock(lockPath);
+      watcher = new TServerLockWatcher();
+      lock.lockAsync(watcher, "master".getBytes());
+    }
+    TServerInstance instance = null;
+    // Did we win the lock yet?
+    if (!lock.isLocked() && !watcher.gotLock && watcher.failureException == null) {
+      // Nope... there's a server out there: is this is a new server?
+      if (info == null) {
+        // Yep: hold onto the information about this server
+        Stat stat = new Stat();
+        byte[] lockData = ZooLock.getLockData(lockPath, stat);
+        String lockString = new String(lockData == null ? new byte[] {} : lockData);
+        if (lockString.length() > 0 && !lockString.equals("master")) {
+          ServerServices services = new ServerServices(new String(lockData));
+          InetSocketAddress client = services.getAddress(ServerServices.Service.TSERV_CLIENT);
+          InetSocketAddress addr = AddressUtil.parseAddress(server, Property.TSERV_CLIENTPORT);
+          TServerConnection conn = new TServerConnection(addr);
+          instance = new TServerInstance(client, stat.getEphemeralOwner());
+          info = new TServerInfo(lock, instance, conn, watcher);
+          current.put(server, info);
+          updates.add(instance);
         } else {
-          // nope: create a new lock and watcher
-          lock = new ZooLock(lockPath);
-          watcher = new TServerLockWatcher();
-          lock.lockAsync(watcher, "master".getBytes());
+          lock.tryToCancelAsyncLockOrUnlock();
         }
-        TServerInstance instance = null;
-        // Did we win the lock yet?
-        if (!lock.isLocked() && !watcher.gotLock && watcher.failureException == null) {
-          // Nope... there's a server out there: is this is a new server?
-          if (info == null) {
-            // Yep: hold onto the information about this server
-            Stat stat = new Stat();
-            byte[] lockData = ZooLock.getLockData(lockPath, stat);
-            String lockString = new String(lockData == null ? new byte[] {} : lockData);
-            if (lockString.length() > 0 && !lockString.equals("master")) {
-              ServerServices services = new ServerServices(new String(lockData));
-              InetSocketAddress client = services.getAddress(ServerServices.Service.TSERV_CLIENT);
-              InetSocketAddress addr = AddressUtil.parseAddress(server, Property.TSERV_CLIENTPORT);
-              TServerConnection conn = new TServerConnection(addr);
-              instance = new TServerInstance(client, stat.getEphemeralOwner());
-              info = new TServerInfo(lock, instance, conn, watcher);
-              current.put(server, info);
-              updates.add(instance);
-            } else {
-              lock.tryToCancelAsyncLockOrUnlock();
+      }
+    } else {
+      // Yes... there is no server here any more
+      lock.tryToCancelAsyncLockOrUnlock();
+      if (info != null) {
+        // a server existed here and went away so delete its node
+        doomed.add(info.instance);
+        current.remove(server);
+        info.cleanup();
+        deleteServerNode(lockPath);
+      } else {
+        // never knew of this server before... it could be a new server that has not created its lock node yet... watch and see if it creates the node or
+        // delete it later if it does not
+        List<String> children = ZooReaderWriter.getInstance().getChildren(lockPath, new Watcher() {
+          @Override
+          public void process(WatchedEvent arg0) {
+            if (arg0.getType() == EventType.NodeChildrenChanged) {
+              Set<TServerInstance> updates = new HashSet<TServerInstance>();
+              Set<TServerInstance> doomed = new HashSet<TServerInstance>();
+              try {
+                checkServer(updates, doomed, path, server, 2);
+              } catch (Exception ex) {
+                log.error(ex, ex);
+              }
+
+              if (!doomed.isEmpty() || !updates.isEmpty())
+                cback.update(LiveTServerSet.this, doomed, updates);
             }
           }
+        });
+        
+        if (children.size() > 0) {
+          checkServer(updates, doomed, path, server, recurse--);
         } else {
-          // Yes... there is no server here any more
-          lock.tryToCancelAsyncLockOrUnlock();
-          if (info != null) {
-            doomed.add(info.instance);
-            current.remove(server);
-            info.cleanup();
-          }
-          ZooReaderWriter.getInstance().delete(lockPath, -1);
+          if (!serversToDelete.containsKey(server))
+            serversToDelete.put(server, System.currentTimeMillis());
         }
       }
-      // log.debug("Current: " + current.keySet());
-      if (!doomed.isEmpty() || !updates.isEmpty())
-        this.cback.update(this, doomed, updates);
-    } catch (Exception ex) {
-      log.error(ex, ex);
     }
   }
   
@@ -296,19 +367,16 @@ public class LiveTServerSet implements W
   }
   
   public synchronized TServerConnection getConnection(TServerInstance server) throws TException {
-    TServerConnection result;
-    synchronized (this) {
-      if (server == null)
-        return null;
-      TServerInfo serverInfo = current.get(server.hostPort());
-      // lock was lost?
-      if (serverInfo == null)
-        return null;
-      // instance changed?
-      if (!serverInfo.instance.equals(server))
-        return null;
-      result = serverInfo.connection;
-    }
+    if (server == null)
+      return null;
+    TServerInfo serverInfo = current.get(server.hostPort());
+    // lock was lost?
+    if (serverInfo == null)
+      return null;
+    // instance changed?
+    if (!serverInfo.instance.equals(server))
+      return null;
+    TServerConnection result = serverInfo.connection;
     return result;
   }
   

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/Master.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/Master.java?rev=1433166&r1=1433165&r2=1433166&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/Master.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/Master.java Mon Jan 14 22:03:24 2013
@@ -21,7 +21,6 @@ import static java.lang.Math.min;
 import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.nio.ByteBuffer;
-import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -89,6 +88,7 @@ import org.apache.accumulo.core.util.Cac
 import org.apache.accumulo.core.util.Daemon;
 import org.apache.accumulo.core.util.UtilWaitThread;
 import org.apache.accumulo.core.zookeeper.ZooUtil;
+import org.apache.accumulo.fate.AgeOffStore;
 import org.apache.accumulo.fate.Fate;
 import org.apache.accumulo.fate.TStore.TStatus;
 import org.apache.accumulo.fate.zookeeper.IZooReaderWriter;
@@ -156,7 +156,7 @@ import org.apache.accumulo.server.util.T
 import org.apache.accumulo.server.util.time.SimpleTimer;
 import org.apache.accumulo.server.zookeeper.ZooLock;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
-import org.apache.accumulo.start.classloader.AccumuloClassLoader;
+import org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader;
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
@@ -215,13 +215,11 @@ public class Master implements LiveTServ
   private MasterState state = MasterState.INITIAL;
   
   private Fate<Master> fate;
-
-  private static final Charset utf8 = Charset.forName("UTF8");
   
   volatile private SortedMap<TServerInstance,TabletServerStatus> tserverStatus = Collections
       .unmodifiableSortedMap(new TreeMap<TServerInstance,TabletServerStatus>());
   
-  private Set<String> recoveriesInProgress = Collections.synchronizedSet(new HashSet<String>());
+  private final Set<String> recoveriesInProgress = Collections.synchronizedSet(new HashSet<String>());
 
   synchronized private MasterState getMasterState() {
     return state;
@@ -261,6 +259,7 @@ public class Master implements LiveTServ
         public void run() {
           // This frees the main thread and will cause the master to exit
           clientService.stop();
+          Master.this.nextEvent.event("stopped event loop");
         }
         
       }, 100l, 1000l);
@@ -293,8 +292,8 @@ public class Master implements LiveTServ
         String[] tablePropsToDelete = new String[] {"table.scan.cache.size", "table.scan.cache.enable"};
 
         for (String id : Tables.getIdToNameMap(instance).keySet()) {
-          zoo.putPersistentData(ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + id + Constants.ZTABLE_FLUSH_ID, "0".getBytes(utf8), NodeExistsPolicy.SKIP);
-          zoo.putPersistentData(ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + id + Constants.ZTABLE_COMPACT_ID, "0".getBytes(utf8), NodeExistsPolicy.SKIP);
+          zoo.putPersistentData(ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + id + Constants.ZTABLE_FLUSH_ID, "0".getBytes(), NodeExistsPolicy.SKIP);
+          zoo.putPersistentData(ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + id + Constants.ZTABLE_COMPACT_ID, "0".getBytes(), NodeExistsPolicy.SKIP);
           
           for (String prop : tablePropsToDelete) {
             String propPath = ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + id + Constants.ZTABLE_CONF + "/" + prop;
@@ -471,7 +470,7 @@ public class Master implements LiveTServ
       throw new ThriftTableOperationException(tableId, null, TableOperation.MERGE, TableOperationExceptionType.OFFLINE, "table is not online");
   }
   
-  Connector getConnector() throws AccumuloException, AccumuloSecurityException {
+  public Connector getConnector() throws AccumuloException, AccumuloSecurityException {
     return instance.getConnector(SecurityConstants.getSystemCredentials());
   }
   
@@ -485,7 +484,7 @@ public class Master implements LiveTServ
     T instance = null;
     
     try {
-      Class<? extends T> clazz = AccumuloClassLoader.loadClass(clazzName, base);
+      Class<? extends T> clazz = AccumuloVFSClassLoader.loadClass(clazzName, base);
       instance = clazz.newInstance();
       log.info("Loaded class : " + clazzName);
     } catch (Exception e) {
@@ -547,7 +546,7 @@ public class Master implements LiveTServ
           public byte[] mutate(byte[] currentValue) throws Exception {
             long flushID = Long.parseLong(new String(currentValue));
             flushID++;
-            return ("" + flushID).getBytes(utf8);
+            return ("" + flushID).getBytes();
           }
         });
       } catch (NoNodeException nne) {
@@ -1078,9 +1077,7 @@ public class Master implements LiveTServ
     @Override
     public void finishTableOperation(TInfo tinfo, AuthInfo credentials, long opid) throws ThriftSecurityException, TException {
       authenticate(credentials);
-      
       fate.delete(opid);
-      
     }
     
   }
@@ -1139,7 +1136,7 @@ public class Master implements LiveTServ
   
   private void setMasterGoalState(MasterGoalState state) {
     try {
-      ZooReaderWriter.getInstance().putPersistentData(ZooUtil.getRoot(instance) + Constants.ZMASTER_GOAL_STATE, state.name().getBytes(utf8),
+      ZooReaderWriter.getInstance().putPersistentData(ZooUtil.getRoot(instance) + Constants.ZMASTER_GOAL_STATE, state.name().getBytes(),
           NodeExistsPolicy.OVERWRITE);
     } catch (Exception ex) {
       log.error("Unable to set master goal state in zookeeper");
@@ -1621,8 +1618,7 @@ public class Master implements LiveTServ
           }
         }
         MetadataTable.addDeleteEntries(range, datafiles, SecurityConstants.getSystemCredentials());
-        BatchWriter bw = conn.createBatchWriter(Constants.METADATA_TABLE_NAME,
- new BatchWriterConfig());
+        BatchWriter bw = conn.createBatchWriter(Constants.METADATA_TABLE_NAME, new BatchWriterConfig());
         try {
           deleteTablets(deleteRange, bw, conn);
         } finally {
@@ -1713,7 +1709,7 @@ public class Master implements LiveTServ
         }
         
         if (maxLogicalTime != null)
-          Constants.METADATA_TIME_COLUMN.put(m, new Value(maxLogicalTime.getBytes(utf8)));
+          Constants.METADATA_TIME_COLUMN.put(m, new Value(maxLogicalTime.getBytes()));
         
         if (!m.getUpdates().isEmpty()) {
           bw.addMutation(m);
@@ -1759,7 +1755,7 @@ public class Master implements LiveTServ
       Mutation m;
       // Delete everything in the other tablets
       // group all deletes into tablet into one mutation, this makes tablets
-      // either dissapear entirely or not all.. this is important for the case
+      // either disappear entirely or not all.. this is important for the case
       // where the process terminates in the loop below...
       scanner = conn.createScanner(Constants.METADATA_TABLE_NAME, Constants.NO_AUTHS);
       log.debug("Deleting range " + scanRange);
@@ -2036,9 +2032,16 @@ public class Master implements LiveTServ
     Set<TServerInstance> currentServers = tserverSet.getCurrentServers();
     for (TServerInstance server : currentServers) {
       try {
-        TabletServerStatus status = tserverSet.getConnection(server).getTableMap();
-        result.put(server, status);
-        // TODO maybe remove from bad servers
+        Thread t = Thread.currentThread();
+        String oldName = t.getName();
+        try {
+          t.setName("Getting status from " + server);
+          TabletServerStatus status = tserverSet.getConnection(server).getTableMap();
+          // TODO maybe remove from bad servers
+          result.put(server, status);
+        } finally {
+          t.setName(oldName);
+        }
       } catch (Exception ex) {
         log.error("unable to get tablet server status " + server + " " + ex.toString());
         log.debug("unable to get tablet server status " + server, ex);
@@ -2080,8 +2083,11 @@ public class Master implements LiveTServ
         synchronized (recoveriesInProgress) {
           if (!recoveriesInProgress.contains(filename)) {
             Master.log.info("Starting recovery of " + filename + " created for " + host + ", tablet " + extent + " holds a reference");
+            AccumuloConfiguration aconf = getConfiguration().getConfiguration();
+            RecoverLease impl = createInstanceFromPropertyName(aconf, Property.MASTER_LEASE_RECOVERY_IMPLEMETATION, RecoverLease.class, new RecoverLease());
+            impl.init(host, filename);
             long tid = fate.startTransaction();
-            fate.seedTransaction(tid, new RecoverLease(host, filename), true);
+            fate.seedTransaction(tid, impl, true);
             recoveriesInProgress.add(filename);
           }
         }
@@ -2105,6 +2111,28 @@ public class Master implements LiveTServ
     
     tserverSet.startListeningForTabletServerChanges();
 
+    // TODO: add shutdown for fate object
+    try {
+      final AgeOffStore<Master> store = new AgeOffStore<Master>(new org.apache.accumulo.fate.ZooStore<Master>(ZooUtil.getRoot(instance) + Constants.ZFATE,
+          ZooReaderWriter.getRetryingInstance()), 1000 * 60 * 60 * 8);
+      
+      int threads = this.getConfiguration().getConfiguration().getCount(Property.MASTER_FATE_THREADPOOL_SIZE);
+      
+      fate = new Fate<Master>(this, store, threads);
+      
+      SimpleTimer.getInstance().schedule(new TimerTask() {
+        
+        @Override
+        public void run() {
+          store.ageOff();
+        }
+      }, 63000, 63000);
+    } catch (KeeperException e) {
+      throw new IOException(e);
+    } catch (InterruptedException e) {
+      throw new IOException(e);
+    }
+    
     ZooReaderWriter.getInstance().getChildren(zroot + Constants.ZRECOVERY, new Watcher() {
       @Override
       public void process(WatchedEvent event) {
@@ -2119,8 +2147,11 @@ public class Master implements LiveTServ
     });
     
     AuthInfo systemAuths = SecurityConstants.getSystemCredentials();
-    final TabletStateStore stores[] = {new ZooTabletStateStore(new ZooStore(zroot)), new RootTabletStateStore(instance, systemAuths, this),
-        new MetaDataStateStore(instance, systemAuths, this)};
+    final TabletStateStore stores[] = {
+        new ZooTabletStateStore(new ZooStore(zroot)), 
+        new RootTabletStateStore(instance, systemAuths, this),
+        new MetaDataStateStore(instance, systemAuths, this)
+        };
     watchers.add(new TabletGroupWatcher(stores[2], null));
     watchers.add(new TabletGroupWatcher(stores[1], watchers.get(0)));
     watchers.add(new TabletGroupWatcher(stores[0], watchers.get(1)));
@@ -2128,19 +2159,9 @@ public class Master implements LiveTServ
       watcher.start();
     }
     
-    // TODO: add shutdown for fate object
-    try {
-      fate = new Fate<Master>(this, new org.apache.accumulo.fate.ZooStore<Master>(ZooUtil.getRoot(instance) + Constants.ZFATE,
-          ZooReaderWriter.getRetryingInstance()), 4);
-    } catch (KeeperException e) {
-      throw new IOException(e);
-    } catch (InterruptedException e) {
-      throw new IOException(e);
-    }
-    
     Processor<Iface> processor = new Processor<Iface>(TraceWrap.service(new MasterClientServiceHandler()));
     clientService = TServerUtils.startServer(getSystemConfiguration(), Property.MASTER_CLIENTPORT, processor, "Master", "Master Client Service Handler", null,
-        Property.MASTER_MINTHREADS, Property.MASTER_THREADCHECK).server;
+        Property.MASTER_MINTHREADS, Property.MASTER_THREADCHECK, Property.GENERAL_MAX_MESSAGE_SIZE).server;
     
     while (!clientService.isServing()) {
       UtilWaitThread.sleep(100);
@@ -2183,7 +2204,7 @@ public class Master implements LiveTServ
     boolean locked = false;
     while (System.currentTimeMillis() - current < waitTime) {
       masterLock = new ZooLock(zMasterLoc);
-      if (masterLock.tryLock(masterLockWatcher, masterClientAddress.getBytes(utf8))) {
+      if (masterLock.tryLock(masterLockWatcher, masterClientAddress.getBytes())) {
         locked = true;
         break;
       }
@@ -2193,7 +2214,7 @@ public class Master implements LiveTServ
       log.info("Failed to get master lock, even after waiting for session timeout, becoming back-up server");
       while (true) {
         masterLock = new ZooLock(zMasterLoc);
-        if (masterLock.tryLock(masterLockWatcher, masterClientAddress.getBytes(utf8))) {
+        if (masterLock.tryLock(masterLockWatcher, masterClientAddress.getBytes())) {
           break;
         }
         UtilWaitThread.sleep(TIME_TO_WAIT_BETWEEN_LOCK_CHECKS);

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/balancer/TableLoadBalancer.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/balancer/TableLoadBalancer.java?rev=1433166&r1=1433165&r2=1433166&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/balancer/TableLoadBalancer.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/balancer/TableLoadBalancer.java Mon Jan 14 22:03:24 2013
@@ -35,7 +35,7 @@ import org.apache.accumulo.server.client
 import org.apache.accumulo.server.master.state.TServerInstance;
 import org.apache.accumulo.server.master.state.TabletMigration;
 import org.apache.accumulo.server.security.SecurityConstants;
-import org.apache.accumulo.start.classloader.AccumuloClassLoader;
+import org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader;
 import org.apache.log4j.Logger;
 
 public class TableLoadBalancer extends TabletBalancer {
@@ -45,7 +45,7 @@ public class TableLoadBalancer extends T
   Map<String,TabletBalancer> perTableBalancers = new HashMap<String,TabletBalancer>();
   
   private TabletBalancer constructNewBalancerForTable(String clazzName, String table) throws Exception {
-    Class<? extends TabletBalancer> clazz = AccumuloClassLoader.loadClass(clazzName, TabletBalancer.class);
+    Class<? extends TabletBalancer> clazz = AccumuloVFSClassLoader.loadClass(clazzName, TabletBalancer.class);
     Constructor<? extends TabletBalancer> constructor = clazz.getConstructor(String.class);
     return constructor.newInstance(table);
   }

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/recovery/RecoverLease.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/recovery/RecoverLease.java?rev=1433166&r1=1433165&r2=1433166&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/recovery/RecoverLease.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/recovery/RecoverLease.java Mon Jan 14 22:03:24 2013
@@ -33,11 +33,14 @@ public class RecoverLease extends Master
   
   private static final long serialVersionUID = 1L;
 
-  private String server;
-  private String file;
-  private long start;
+  protected String server;
+  protected String file;
+  protected long start;
 
-  public RecoverLease(String server, String file) {
+  public RecoverLease() {
+  }
+  
+  public void init(String server, String file) {
     this.server = server;
     this.file = file;
     this.start = System.currentTimeMillis();
@@ -88,12 +91,13 @@ public class RecoverLease extends Master
     try {
       fs.append(source).close();
       log.info("Recovered lease on " + source.toString() + " using append");
-
+      return new SubmitFileForRecovery(server, file);
     } catch (IOException ex) {
       log.error("error recovering lease using append", ex);
+      RecoverLease result = new RecoverLease();
+      result.init(server, file);
+      return result;
     }
-    // lets do this again
-    return new RecoverLease(server, file);
   }
   
 }

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/recovery/SubmitFileForRecovery.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/recovery/SubmitFileForRecovery.java?rev=1433166&r1=1433165&r2=1433166&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/recovery/SubmitFileForRecovery.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/recovery/SubmitFileForRecovery.java Mon Jan 14 22:03:24 2013
@@ -17,7 +17,6 @@
 package org.apache.accumulo.server.master.recovery;
 
 import java.io.IOException;
-import java.nio.charset.Charset;
 
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.zookeeper.ZooUtil;
@@ -39,8 +38,6 @@ public class SubmitFileForRecovery exten
   private static final long serialVersionUID = 1L;
   String server;
   String file;
-
-  private static final Charset utf8 = Charset.forName("UTF8");
   
   SubmitFileForRecovery(String server, String file) {
     this.server = server;
@@ -51,7 +48,7 @@ public class SubmitFileForRecovery exten
   public Repo<Master> call(long tid, final Master master) throws Exception {
     master.updateRecoveryInProgress(file);
     String source = RecoverLease.getSource(master, server, file).toString();
-    new DistributedWorkQueue(ZooUtil.getRoot(master.getInstance()) + Constants.ZRECOVERY).addWork(file, source.getBytes(utf8));
+    new DistributedWorkQueue(ZooUtil.getRoot(master.getInstance()) + Constants.ZRECOVERY).addWork(file, source.getBytes());
     
     ZooReaderWriter zoo = ZooReaderWriter.getInstance();
     final String path = ZooUtil.getRoot(master.getInstance()) + Constants.ZRECOVERY + "/" + file;

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/state/DeadServerList.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/state/DeadServerList.java?rev=1433166&r1=1433165&r2=1433166&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/state/DeadServerList.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/state/DeadServerList.java Mon Jan 14 22:03:24 2013
@@ -16,7 +16,6 @@
  */
 package org.apache.accumulo.server.master.state;
 
-import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -31,8 +30,6 @@ import org.apache.zookeeper.data.Stat;
 public class DeadServerList {
   private static final Logger log = Logger.getLogger(DeadServerList.class);
   private final String path;
-
-  private static final Charset utf8 = Charset.forName("UTF8");
   
   public DeadServerList(String path) {
     this.path = path;
@@ -75,7 +72,7 @@ public class DeadServerList {
   public void post(String server, String cause) {
     IZooReaderWriter zoo = ZooReaderWriter.getInstance();
     try {
-      zoo.putPersistentData(path + "/" + server, cause.getBytes(utf8), NodeExistsPolicy.SKIP);
+      zoo.putPersistentData(path + "/" + server, cause.getBytes(), NodeExistsPolicy.SKIP);
     } catch (Exception ex) {
       log.error(ex, ex);
     }

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/state/MergeStats.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/state/MergeStats.java?rev=1433166&r1=1433165&r2=1433166&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/state/MergeStats.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/state/MergeStats.java Mon Jan 14 22:03:24 2013
@@ -21,8 +21,8 @@ import java.util.Map;
 import java.util.Map.Entry;
 
 import org.apache.accumulo.core.Constants;
+import org.apache.accumulo.server.cli.ClientOpts;
 import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.client.TableNotFoundException;
 import org.apache.accumulo.core.data.Key;
@@ -30,8 +30,6 @@ import org.apache.accumulo.core.data.Key
 import org.apache.accumulo.core.data.Range;
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.zookeeper.ZooUtil;
-import org.apache.accumulo.server.client.HdfsZooInstance;
-import org.apache.accumulo.server.security.SecurityConstants;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 import org.apache.hadoop.io.DataInputBuffer;
 import org.apache.hadoop.io.Text;
@@ -223,11 +221,14 @@ public class MergeStats {
   }
   
   public static void main(String[] args) throws Exception {
-    Instance instance = HdfsZooInstance.getInstance();
-    Map<String,String> tableIdMap = instance.getConnector(SecurityConstants.getSystemCredentials()).tableOperations().tableIdMap();
+    ClientOpts opts = new ClientOpts();
+    opts.parseArgs(MergeStats.class.getName(), args);
+    
+    Connector conn = opts.getConnector();
+    Map<String,String> tableIdMap = conn.tableOperations().tableIdMap();
     for (String table : tableIdMap.keySet()) {
       String tableId = tableIdMap.get(table);
-      String path = ZooUtil.getRoot(instance.getInstanceID()) + Constants.ZTABLES + "/" + tableId.toString() + "/merge";
+      String path = ZooUtil.getRoot(conn.getInstance().getInstanceID()) + Constants.ZTABLES + "/" + tableId.toString() + "/merge";
       MergeInfo info = new MergeInfo();
       if (ZooReaderWriter.getInstance().exists(path)) {
         byte[] data = ZooReaderWriter.getInstance().getData(path, new Stat());

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/state/SetGoalState.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/state/SetGoalState.java?rev=1433166&r1=1433165&r2=1433166&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/state/SetGoalState.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/state/SetGoalState.java Mon Jan 14 22:03:24 2013
@@ -16,8 +16,6 @@
  */
 package org.apache.accumulo.server.master.state;
 
-import java.nio.charset.Charset;
-
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.file.FileUtil;
 import org.apache.accumulo.core.master.thrift.MasterGoalState;
@@ -32,8 +30,6 @@ import org.apache.accumulo.server.zookee
 import org.apache.hadoop.fs.FileSystem;
 
 public class SetGoalState {
-
-  private static final Charset utf8 = Charset.forName("UTF8");
   
   /**
    * Utility program that will change the goal state for the master from the command line.
@@ -47,7 +43,7 @@ public class SetGoalState {
 
     FileSystem fs = FileUtil.getFileSystem(CachedConfiguration.getInstance(), ServerConfiguration.getSiteConfiguration());
     Accumulo.waitForZookeeperAndHdfs(fs);
-    ZooReaderWriter.getInstance().putPersistentData(ZooUtil.getRoot(HdfsZooInstance.getInstance()) + Constants.ZMASTER_GOAL_STATE, args[0].getBytes(utf8),
+    ZooReaderWriter.getInstance().putPersistentData(ZooUtil.getRoot(HdfsZooInstance.getInstance()) + Constants.ZMASTER_GOAL_STATE, args[0].getBytes(),
         NodeExistsPolicy.OVERWRITE);
   }
   

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/state/TServerInstance.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/state/TServerInstance.java?rev=1433166&r1=1433165&r2=1433166&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/state/TServerInstance.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/state/TServerInstance.java Mon Jan 14 22:03:24 2013
@@ -21,7 +21,6 @@ package org.apache.accumulo.server.maste
 
 import java.io.Serializable;
 import java.net.InetSocketAddress;
-import java.nio.charset.Charset;
 
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.conf.Property;
@@ -42,8 +41,6 @@ public class TServerInstance implements 
   private InetSocketAddress location;
   private String session;
   private String cachedStringRepresentation;
-
-  private static final Charset utf8 = Charset.forName("UTF8");
   
   public TServerInstance(InetSocketAddress address, String session) {
     this.location = address;
@@ -121,7 +118,7 @@ public class TServerInstance implements 
   }
   
   public Value asMutationValue() {
-    return new Value(org.apache.accumulo.core.util.AddressUtil.toString(getLocation()).getBytes(utf8));
+    return new Value(org.apache.accumulo.core.util.AddressUtil.toString(getLocation()).getBytes());
   }
   
   public InetSocketAddress getLocation() {

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/state/TabletStateChangeIterator.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/state/TabletStateChangeIterator.java?rev=1433166&r1=1433165&r2=1433166&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/state/TabletStateChangeIterator.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/state/TabletStateChangeIterator.java Mon Jan 14 22:03:24 2013
@@ -17,7 +17,6 @@
 package org.apache.accumulo.server.master.state;
 
 import java.io.IOException;
-import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -48,8 +47,6 @@ public class TabletStateChangeIterator e
   private static final String TABLES_OPTION = "tables";
   private static final String MERGES_OPTION = "merges";
   // private static final Logger log = Logger.getLogger(TabletStateChangeIterator.class);
-
-  private static final Charset utf8 = Charset.forName("UTF8");
   
   Set<TServerInstance> current;
   Set<String> onlineTables;
@@ -96,7 +93,7 @@ public class TabletStateChangeIterator e
     try {
       Map<Text,MergeInfo> result = new HashMap<Text,MergeInfo>();
       DataInputBuffer buffer = new DataInputBuffer();
-      byte[] data = Base64.decodeBase64(merges.getBytes(utf8));
+      byte[] data = Base64.decodeBase64(merges.getBytes());
       buffer.reset(data, data.length);
       while (buffer.available() > 0) {
         MergeInfo mergeInfo = new MergeInfo();

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/state/ZooTabletStateStore.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/state/ZooTabletStateStore.java?rev=1433166&r1=1433165&r2=1433166&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/state/ZooTabletStateStore.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/state/ZooTabletStateStore.java Mon Jan 14 22:03:24 2013
@@ -18,7 +18,6 @@ package org.apache.accumulo.server.maste
 
 import java.io.IOException;
 import java.net.InetSocketAddress;
-import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
@@ -34,8 +33,6 @@ public class ZooTabletStateStore extends
   
   private static final Logger log = Logger.getLogger(ZooTabletStateStore.class);
   final private DistributedStore store;
-
-  private static final Charset utf8 = Charset.forName("UTF8");
   
   public ZooTabletStateStore(DistributedStore store) {
     this.store = store;
@@ -126,7 +123,7 @@ public class ZooTabletStateStore extends
     if (assignment.tablet.compareTo(Constants.ROOT_TABLET_EXTENT) != 0)
       throw new IllegalArgumentException("You can only store the root tablet location");
     String value = AddressUtil.toString(assignment.server.getLocation()) + "|" + assignment.server.getSession();
-    store.put(Constants.ZROOT_TABLET_FUTURE_LOCATION, value.getBytes(utf8));
+    store.put(Constants.ZROOT_TABLET_FUTURE_LOCATION, value.getBytes());
   }
   
   @Override
@@ -137,8 +134,8 @@ public class ZooTabletStateStore extends
     if (assignment.tablet.compareTo(Constants.ROOT_TABLET_EXTENT) != 0)
       throw new IllegalArgumentException("You can only store the root tablet location");
     String value = AddressUtil.toString(assignment.server.getLocation()) + "|" + assignment.server.getSession();
-    store.put(Constants.ZROOT_TABLET_LOCATION, value.getBytes(utf8));
-    store.put(Constants.ZROOT_TABLET_LAST_LOCATION, value.getBytes(utf8));
+    store.put(Constants.ZROOT_TABLET_LOCATION, value.getBytes());
+    store.put(Constants.ZROOT_TABLET_LAST_LOCATION, value.getBytes());
     store.remove(Constants.ZROOT_TABLET_FUTURE_LOCATION);
     log.debug("Put down root tablet location");
   }

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/state/tables/TableManager.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/state/tables/TableManager.java?rev=1433166&r1=1433165&r2=1433166&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/state/tables/TableManager.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/state/tables/TableManager.java Mon Jan 14 22:03:24 2013
@@ -16,7 +16,6 @@
  */
 package org.apache.accumulo.server.master.state.tables;
 
-import java.nio.charset.Charset;
 import java.security.SecurityPermission;
 import java.util.Collections;
 import java.util.HashMap;
@@ -54,8 +53,6 @@ public class TableManager {
   
   private final Instance instance;
   private ZooCache zooStateCache;
-
-  private static final Charset utf8 = Charset.forName("UTF8");
   
   public static void prepareNewTableState(String instanceId, String tableId, String tableName, TableState state, NodeExistsPolicy existsPolicy)
       throws KeeperException, InterruptedException {
@@ -64,10 +61,10 @@ public class TableManager {
     IZooReaderWriter zoo = ZooReaderWriter.getRetryingInstance();
     zoo.putPersistentData(zTablePath, new byte[0], existsPolicy);
     zoo.putPersistentData(zTablePath + Constants.ZTABLE_CONF, new byte[0], existsPolicy);
-    zoo.putPersistentData(zTablePath + Constants.ZTABLE_NAME, tableName.getBytes(utf8), existsPolicy);
-    zoo.putPersistentData(zTablePath + Constants.ZTABLE_STATE, state.name().getBytes(utf8), existsPolicy);
-    zoo.putPersistentData(zTablePath + Constants.ZTABLE_FLUSH_ID, "0".getBytes(utf8), existsPolicy);
-    zoo.putPersistentData(zTablePath + Constants.ZTABLE_COMPACT_ID, "0".getBytes(utf8), existsPolicy);
+    zoo.putPersistentData(zTablePath + Constants.ZTABLE_NAME, tableName.getBytes(), existsPolicy);
+    zoo.putPersistentData(zTablePath + Constants.ZTABLE_STATE, state.name().getBytes(), existsPolicy);
+    zoo.putPersistentData(zTablePath + Constants.ZTABLE_FLUSH_ID, "0".getBytes(), existsPolicy);
+    zoo.putPersistentData(zTablePath + Constants.ZTABLE_COMPACT_ID, "0".getBytes(), existsPolicy);
   }
   
   public synchronized static TableManager getInstance() {
@@ -115,7 +112,7 @@ public class TableManager {
     String statePath = ZooUtil.getRoot(HdfsZooInstance.getInstance()) + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_STATE;
     
     try {
-      ZooReaderWriter.getRetryingInstance().mutate(statePath, (byte[]) newState.name().getBytes(utf8), ZooUtil.PUBLIC, new Mutator() {
+      ZooReaderWriter.getRetryingInstance().mutate(statePath, (byte[]) newState.name().getBytes(), ZooUtil.PUBLIC, new Mutator() {
         @Override
         public byte[] mutate(byte[] oldData) throws Exception {
           TableState oldState = TableState.UNKNOWN;
@@ -142,7 +139,7 @@ public class TableManager {
           if (!transition)
             throw new IllegalTableTransitionException(oldState, newState);
           log.debug("Transitioning state for table " + tableId + " from " + oldState + " to " + newState);
-          return newState.name().getBytes(utf8);
+          return newState.name().getBytes();
         }
       });
     } catch (Exception e) {

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/tableOps/BulkImport.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/tableOps/BulkImport.java?rev=1433166&r1=1433165&r2=1433166&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/tableOps/BulkImport.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/tableOps/BulkImport.java Mon Jan 14 22:03:24 2013
@@ -22,7 +22,6 @@ import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.OutputStreamWriter;
-import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -57,7 +56,6 @@ import org.apache.accumulo.core.data.Key
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.file.FileOperations;
 import org.apache.accumulo.core.master.state.tables.TableState;
-import org.apache.accumulo.core.security.thrift.AuthInfo;
 import org.apache.accumulo.core.util.Pair;
 import org.apache.accumulo.core.util.SimpleThreadPool;
 import org.apache.accumulo.core.util.UtilWaitThread;
@@ -292,8 +290,7 @@ class CleanUpBulkImport extends MasterRe
     MetadataTable.removeBulkLoadInProgressFlag("/" + bulkDir.getParent().getName() + "/" + bulkDir.getName());
     MetadataTable.addDeleteEntry(tableId, "/" + bulkDir.getName());
     log.debug("removing the metadata table markers for loaded files");
-    AuthInfo creds = SecurityConstants.getSystemCredentials();
-    Connector conn = HdfsZooInstance.getInstance().getConnector(creds.user, creds.password);
+    Connector conn = master.getConnector();
     MetadataTable.removeBulkLoadEntries(conn, tableId, tid);
     log.debug("releasing HDFS reservations for " + source + " and " + error);
     Utils.unreserveHdfsDirectory(source, tid);
@@ -334,8 +331,6 @@ class CopyFailed extends MasterRepo {
   private String source;
   private String bulk;
   private String error;
-
-  private static final Charset utf8 = Charset.forName("UTF8");
   
   public CopyFailed(String tableId, String source, String bulk, String error) {
     this.tableId = tableId;
@@ -363,10 +358,10 @@ class CopyFailed extends MasterRepo {
   }
   
   @Override
-  public Repo<Master> call(long tid, Master environment) throws Exception {
+  public Repo<Master> call(long tid, Master master) throws Exception {
 	//This needs to execute after the arbiter is stopped  
 	  
-    FileSystem fs = environment.getFileSystem();
+    FileSystem fs = master.getFileSystem();
 	  
     if (!fs.exists(new Path(error, "failures.txt")))
       return new CleanUpBulkImport(tableId, source, bulk, error);
@@ -393,8 +388,7 @@ class CopyFailed extends MasterRepo {
      */
 
     // determine which failed files were loaded
-    AuthInfo creds = SecurityConstants.getSystemCredentials();
-    Connector conn = HdfsZooInstance.getInstance().getConnector(creds.user, creds.password);
+    Connector conn = master.getConnector();
     Scanner mscanner = new IsolatedScanner(conn.createScanner(Constants.METADATA_TABLE_NAME, Constants.NO_AUTHS));
     mscanner.setRange(new KeyExtent(new Text(tableId), null, null).toMetadataRange());
     mscanner.fetchColumnFamily(Constants.METADATA_BULKFILE_COLUMN_FAMILY);
@@ -430,7 +424,7 @@ class CopyFailed extends MasterRepo {
         if (fs.exists(dest))
           continue;
         
-        bifCopyQueue.addWork(orig.getName(), (failure + "," + dest).getBytes(utf8));
+        bifCopyQueue.addWork(orig.getName(), (failure + "," + dest).getBytes());
         workIds.add(orig.getName());
         log.debug("tid " + tid + " added to copyq: " + orig + " to " + dest + ": failed");
       }
@@ -532,7 +526,8 @@ class LoadFiles extends MasterRepo {
               // get a connection to a random tablet server, do not prefer cached connections because
               // this is running on the master and there are lots of connections to tablet servers
               // serving the !METADATA tablets
-              Pair<String,Client> pair = ServerClient.getConnection(master.getInstance(), false);
+              long timeInMillis = master.getConfiguration().getConfiguration().getTimeInMillis(Property.MASTER_BULK_TIMEOUT);
+              Pair<String,Client> pair = ServerClient.getConnection(master.getInstance(), false, timeInMillis);
               client = pair.getSecond();
               server = pair.getFirst();
               List<String> attempt = Collections.singletonList(file);

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/tableOps/CompactRange.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/tableOps/CompactRange.java?rev=1433166&r1=1433165&r2=1433166&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/tableOps/CompactRange.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/tableOps/CompactRange.java Mon Jan 14 22:03:24 2013
@@ -16,7 +16,6 @@
  */
 package org.apache.accumulo.server.master.tableOps;
 
-import java.nio.charset.Charset;
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
@@ -48,7 +47,6 @@ import org.apache.accumulo.server.client
 import org.apache.accumulo.server.master.LiveTServerSet.TServerConnection;
 import org.apache.accumulo.server.master.Master;
 import org.apache.accumulo.server.master.state.TServerInstance;
-import org.apache.accumulo.server.security.SecurityConstants;
 import org.apache.accumulo.server.util.MapCounter;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 import org.apache.commons.codec.binary.Hex;
@@ -78,8 +76,7 @@ class CompactionDriver extends MasterRep
   public long isReady(long tid, Master master) throws Exception {
     
     MapCounter<TServerInstance> serversToFlush = new MapCounter<TServerInstance>();
-    Instance instance = HdfsZooInstance.getInstance();
-    Connector conn = instance.getConnector(SecurityConstants.getSystemCredentials());
+    Connector conn = master.getConnector();
     Scanner scanner = new IsolatedScanner(conn.createScanner(Constants.METADATA_TABLE_NAME, Constants.NO_AUTHS));
     
     Range range = new KeyExtent(new Text(tableId), null, startRow == null ? null : new Text(startRow)).toMetadataRange();
@@ -132,6 +129,7 @@ class CompactionDriver extends MasterRep
     
     long scanTime = System.currentTimeMillis() - t1;
     
+    Instance instance = master.getInstance();
     Tables.clearCache(instance);
     if (tabletCount == 0 && !Tables.exists(instance, tableId))
       throw new ThriftTableOperationException(tableId, null, TableOperation.COMPACT, TableOperationExceptionType.NOTFOUND, null);
@@ -186,8 +184,6 @@ public class CompactRange extends Master
   private byte[] startRow;
   private byte[] endRow;
   private IteratorConfig iterators;
-
-  private static final Charset utf8 = Charset.forName("UTF8");
   
   public CompactRange(String tableId, byte[] startRow, byte[] endRow, List<IteratorSetting> iterators) throws ThriftTableOperationException {
     this.tableId = tableId;
@@ -242,7 +238,7 @@ public class CompactRange extends Master
             encodedIterators.append(new String(hex.encode(IteratorUtil.encodeIteratorSettings(iterators))));
           }
           
-          return ("" + flushID + encodedIterators).getBytes(utf8);
+          return ("" + flushID + encodedIterators).getBytes();
         }
       });
       
@@ -275,7 +271,7 @@ public class CompactRange extends Master
           encodedIterators.append(tokens[i]);
         }
         
-        return ("" + flushID + encodedIterators).getBytes(utf8);
+        return ("" + flushID + encodedIterators).getBytes();
       }
     });
 

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/tableOps/CreateTable.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/tableOps/CreateTable.java?rev=1433166&r1=1433165&r2=1433166&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/tableOps/CreateTable.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/tableOps/CreateTable.java Mon Jan 14 22:03:24 2013
@@ -34,7 +34,6 @@ import org.apache.accumulo.core.util.Cac
 import org.apache.accumulo.fate.Repo;
 import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeExistsPolicy;
 import org.apache.accumulo.server.ServerConstants;
-import org.apache.accumulo.server.client.HdfsZooInstance;
 import org.apache.accumulo.server.conf.ServerConfiguration;
 import org.apache.accumulo.server.master.Master;
 import org.apache.accumulo.server.master.state.tables.TableManager;
@@ -180,13 +179,13 @@ class PopulateZookeeper extends MasterRe
   }
   
   @Override
-  public Repo<Master> call(long tid, Master env) throws Exception {
+  public Repo<Master> call(long tid, Master master) throws Exception {
     // reserve the table name in zookeeper or fail
     
     Utils.tableNameLock.lock();
     try {
       // write tableName & tableId to zookeeper
-      Instance instance = HdfsZooInstance.getInstance();
+      Instance instance = master.getInstance();
       
       Utils.checkTableDoesNotExist(instance, tableInfo.tableName, tableInfo.tableId, TableOperation.CREATE);
       
@@ -204,8 +203,8 @@ class PopulateZookeeper extends MasterRe
   }
   
   @Override
-  public void undo(long tid, Master env) throws Exception {
-    Instance instance = HdfsZooInstance.getInstance();
+  public void undo(long tid, Master master) throws Exception {
+    Instance instance = master.getInstance();
     TableManager.getInstance().removeTable(tableInfo.tableId);
     Utils.unreserveTable(tableInfo.tableId, tid, true);
     Tables.clearCache(instance);
@@ -273,7 +272,7 @@ public class CreateTable extends MasterR
   }
   
   @Override
-  public Repo<Master> call(long tid, Master env) throws Exception {
+  public Repo<Master> call(long tid, Master master) throws Exception {
     // first step is to reserve a table id.. if the machine fails during this step
     // it is ok to retry... the only side effect is that a table id may not be used
     // or skipped
@@ -282,8 +281,7 @@ public class CreateTable extends MasterR
     
     Utils.idLock.lock();
     try {
-      Instance instance = HdfsZooInstance.getInstance();
-      tableInfo.tableId = Utils.getNextTableId(tableInfo.tableName, instance);
+      tableInfo.tableId = Utils.getNextTableId(tableInfo.tableName, master.getInstance());
       return new SetupPermissions(tableInfo);
     } finally {
       Utils.idLock.unlock();

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/tableOps/DeleteTable.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/tableOps/DeleteTable.java?rev=1433166&r1=1433165&r2=1433166&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/tableOps/DeleteTable.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/tableOps/DeleteTable.java Mon Jan 14 22:03:24 2013
@@ -23,7 +23,6 @@ import java.util.Map.Entry;
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.BatchScanner;
 import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.IteratorSetting;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.client.impl.Tables;
@@ -38,7 +37,6 @@ import org.apache.accumulo.core.security
 import org.apache.accumulo.core.util.CachedConfiguration;
 import org.apache.accumulo.fate.Repo;
 import org.apache.accumulo.server.ServerConstants;
-import org.apache.accumulo.server.client.HdfsZooInstance;
 import org.apache.accumulo.server.master.Master;
 import org.apache.accumulo.server.master.state.MetaDataTableScanner;
 import org.apache.accumulo.server.master.state.TabletLocationState;
@@ -83,16 +81,15 @@ class CleanUp extends MasterRepo {
   }
   
   @Override
-  public long isReady(long tid, Master environment) throws Exception {
-    if (!environment.hasCycled(creationTime)) {
+  public long isReady(long tid, Master master) throws Exception {
+    if (!master.hasCycled(creationTime)) {
       return 50;
     }
     
     boolean done = true;
     Range tableRange = new KeyExtent(new Text(tableId), null, null).toMetadataRange();
-    Scanner scanner = environment.getInstance().getConnector(SecurityConstants.getSystemCredentials())
-        .createScanner(Constants.METADATA_TABLE_NAME, Constants.NO_AUTHS);
-    MetaDataTableScanner.configureScanner(scanner, environment);
+    Scanner scanner = master.getConnector().createScanner(Constants.METADATA_TABLE_NAME, Constants.NO_AUTHS);
+    MetaDataTableScanner.configureScanner(scanner, master);
     scanner.setRange(tableRange);
     
     KeyExtent prevExtent = null;
@@ -105,7 +102,7 @@ class CleanUp extends MasterRepo {
       }
       prevExtent = locationState.extent;
       
-      TabletState state = locationState.getState(environment.onlineTabletServers());
+      TabletState state = locationState.getState(master.onlineTabletServers());
       if (state.equals(TabletState.ASSIGNED) || state.equals(TabletState.HOSTED)) {
         log.debug("Still waiting for table to be deleted: " + tableId + " locationState: " + locationState);
         done = false;
@@ -120,17 +117,15 @@ class CleanUp extends MasterRepo {
   }
   
   @Override
-  public Repo<Master> call(long tid, Master environment) throws Exception {
-    
-    Instance instance = HdfsZooInstance.getInstance();
+  public Repo<Master> call(long tid, Master master) throws Exception {
     
-    environment.clearMigrations(tableId);
+    master.clearMigrations(tableId);
     
     int refCount = 0;
     
     try {
       // look for other tables that references this tables files
-      Connector conn = instance.getConnector(SecurityConstants.getSystemCredentials());
+      Connector conn = master.getConnector();
       BatchScanner bs = conn.createBatchScanner(Constants.METADATA_TABLE_NAME, Constants.NO_AUTHS, 8);
       try {
         bs.setRanges(Collections.singleton(Constants.NON_ROOT_METADATA_KEYSPACE));
@@ -183,7 +178,7 @@ class CleanUp extends MasterRepo {
     // remove table from zookeeper
     try {
       TableManager.getInstance().removeTable(tableId);
-      Tables.clearCache(instance);
+      Tables.clearCache(master.getInstance());
     } catch (Exception e) {
       log.error("Failed to find table id in zookeeper", e);
     }

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/tableOps/ExportTable.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/tableOps/ExportTable.java?rev=1433166&r1=1433165&r2=1433166&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/tableOps/ExportTable.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/master/tableOps/ExportTable.java Mon Jan 14 22:03:24 2013
@@ -51,7 +51,6 @@ import org.apache.accumulo.server.Server
 import org.apache.accumulo.server.conf.ServerConfiguration;
 import org.apache.accumulo.server.conf.TableConfiguration;
 import org.apache.accumulo.server.master.Master;
-import org.apache.accumulo.server.security.SecurityConstants;
 import org.apache.hadoop.fs.FSDataOutputStream;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
@@ -86,13 +85,13 @@ class WriteExportFiles extends MasterRep
   }
   
   @Override
-  public long isReady(long tid, Master env) throws Exception {
+  public long isReady(long tid, Master master) throws Exception {
     
     long reserved = Utils.reserveTable(tableInfo.tableID, tid, false, true, TableOperation.EXPORT);
     if (reserved > 0)
       return reserved;
 
-    Connector conn = env.getInstance().getConnector(SecurityConstants.getSystemCredentials());
+    Connector conn = master.getConnector();
     
     checkOffline(conn);
     
@@ -121,11 +120,11 @@ class WriteExportFiles extends MasterRep
   }
 
   @Override
-  public Repo<Master> call(long tid, Master env) throws Exception {
-    Connector conn = env.getInstance().getConnector(SecurityConstants.getSystemCredentials());
+  public Repo<Master> call(long tid, Master master) throws Exception {
+    Connector conn = master.getConnector();
 
     try {
-      exportTable(env.getFileSystem(), conn, tableInfo.tableName, tableInfo.tableID, tableInfo.exportDir);
+      exportTable(master.getFileSystem(), conn, tableInfo.tableName, tableInfo.tableID, tableInfo.exportDir);
     } catch (IOException ioe) {
       throw new ThriftTableOperationException(tableInfo.tableID, tableInfo.tableName, TableOperation.EXPORT, TableOperationExceptionType.OTHER,
           "Failed to create export files " + ioe.getMessage());



Mime
View raw message