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 2012/01/05 16:51:52 UTC

svn commit: r1227650 - in /incubator/accumulo/branches/1.4: docs/examples/README.bloom src/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java

Author: ecn
Date: Thu Jan  5 15:51:52 2012
New Revision: 1227650

URL: http://svn.apache.org/viewvc?rev=1227650&view=rev
Log:
ACCUMULO-249 add -e option to the shell, simplify the bloom README

Modified:
    incubator/accumulo/branches/1.4/docs/examples/README.bloom
    incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java

Modified: incubator/accumulo/branches/1.4/docs/examples/README.bloom
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/docs/examples/README.bloom?rev=1227650&r1=1227649&r2=1227650&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/docs/examples/README.bloom (original)
+++ incubator/accumulo/branches/1.4/docs/examples/README.bloom Thu Jan  5 15:51:52 2012
@@ -41,16 +41,19 @@ initialized with the seed 7.
 
     $ ./bin/accumulo org.apache.accumulo.examples.client.RandomBatchWriter -s 7 instance zookeepers username password bloom_test 1000000 0 1000000000 50 2000000 60000 3 exampleVis
 
-Below the table is flushed, look at the monitor page and wait for the flush to
-complete.  
+Below the table is flushed:
 
-    $ ./bin/accumulo shell -u username -p password
-    username@instance> flush -t bloom_test
-    Flush of table bloom_test initiated...
-    username@instance> exit
-
-The flush will be finished when there are no entries in memory and the 
-number of minor compactions goes to zero. Refresh the page to see changes to the table.
+    $ ./bin/accumulo shell -u username -p password -e 'flush -t bloom_test -w'
+    Shell - Accumulo Interactive Shell
+    - 
+    - version: 1.4.0-incubating-SNAPSHOT
+    - instance name: test
+    - instance id: 54e9b81f-bf36-4a66-a020-f93d98f151a6
+    - 
+    - type 'help' for a list of available commands
+    - 
+    root@test> flush -t bloom_test -w
+    05 10:40:06,069 [shell.Shell] INFO : Flush of table bloom_test completed.
 
 After the flush completes, 500 random queries are done against the table.  The
 same seed is used to generate the queries, therefore everything is found in the

Modified: incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java?rev=1227650&r1=1227649&r2=1227650&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java (original)
+++ incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java Thu Jan  5 15:51:52 2012
@@ -182,6 +182,8 @@ public class Shell {
   
   // file to execute commands from
   private String execFile = null;
+  // single command to execute from the command line
+  private String execCommand = null;
   private boolean verbose = true;
   
   private boolean tabCompletion;
@@ -213,6 +215,9 @@ public class Shell {
     Option helpOpt = new Option(helpOption, helpLongOption, false, "display this help");
     opts.addOption(helpOpt);
     
+    Option execCommandOpt = new Option("e", "execute-command", true, "executes a command, and then exits");
+    opts.addOption(execCommandOpt);
+
     OptionGroup execFileGroup = new OptionGroup();
     
     Option execfileOption = new Option("f", "execute-file", true, "executes commands from a file at startup");
@@ -334,8 +339,12 @@ public class Shell {
     if (cl.hasOption(execfileOption.getOpt())) {
       execFile = cl.getOptionValue(execfileOption.getOpt());
       verbose = false;
-    } else if (cl.hasOption(execfileVerboseOption.getOpt()))
+    } else if (cl.hasOption(execfileVerboseOption.getOpt())) {
       execFile = cl.getOptionValue(execfileVerboseOption.getOpt());
+    }
+    if (cl.hasOption(execCommandOpt.getOpt())) {
+      execCommand = cl.getOptionValue(execCommandOpt.getOpt());
+    }
     
     rootToken = new Token();
     Command external[] = {new AboutCommand(), new AddSplitsCommand(), new AuthenticateCommand(), new ByeCommand(), new ClasspathCommand(), new ClearCommand(),
@@ -414,6 +423,11 @@ public class Shell {
       java.util.Scanner scanner = new java.util.Scanner(new File(execFile));
       while (scanner.hasNextLine())
         execCommand(scanner.nextLine(), true, isVerbose());
+    } else if (execCommand != null) {
+      for (String command : execCommand.split("\n")) {
+        execCommand(command, true, isVerbose());
+      }
+      return exitCode;
     }
     
     while (true) {