accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1459766 - in /accumulo/trunk: ./ assemble/ core/ core/src/main/java/org/apache/accumulo/core/trace/ core/src/main/java/org/apache/accumulo/core/util/shell/commands/ examples/ fate/src/main/java/org/apache/accumulo/fate/ fate/src/main/java/...
Date Fri, 22 Mar 2013 13:38:35 GMT
Author: ecn
Date: Fri Mar 22 13:38:35 2013
New Revision: 1459766

URL: http://svn.apache.org/r1459766
Log:
ACCUMULO-581 wait longer for traces to flush out

Modified:
    accumulo/trunk/   (props changed)
    accumulo/trunk/assemble/   (props changed)
    accumulo/trunk/core/   (props changed)
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/trace/TraceDump.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java
    accumulo/trunk/examples/   (props changed)
    accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java   (props changed)
    accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java 
 (props changed)
    accumulo/trunk/server/   (props changed)
    accumulo/trunk/src/   (props changed)
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/ShellServerTest.java

Propchange: accumulo/trunk/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5:r1459752,1459765

Propchange: accumulo/trunk/assemble/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/assemble:r1459752,1459765

Propchange: accumulo/trunk/core/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/core:r1459752,1459765

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/trace/TraceDump.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/trace/TraceDump.java?rev=1459766&r1=1459765&r2=1459766&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/trace/TraceDump.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/trace/TraceDump.java Fri Mar
22 13:38:35 2013
@@ -154,6 +154,7 @@ public class TraceDump {
       for (RemoteSpan span : sortByStart(tree.nodes.values())) {
         out.print(String.format("%s %s %s", Long.toHexString(span.spanId), Long.toHexString(span.parentId),
span.description));
       }
+      return -1;
     }
     return count;
   }

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java?rev=1459766&r1=1459765&r2=1459766&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java
(original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java
Fri Mar 22 13:38:35 2013
@@ -42,7 +42,10 @@ public class TraceCommand extends DebugC
         if (Trace.isTracing()) {
           final long trace = Trace.currentTrace().traceId();
           Trace.off();
+          StringBuffer sb = new StringBuffer();
+          int traceCount = 0;
           for (int i = 0; i < 30; i++) {
+            sb = new StringBuffer();
             try {
               final Map<String,String> properties = shellState.getConnector().instanceOperations().getSystemConfiguration();
               final String table = properties.get(Property.TRACE_TABLE.getKey());
@@ -50,17 +53,18 @@ public class TraceCommand extends DebugC
               final Authorizations auths = shellState.getConnector().securityOperations().getUserAuthorizations(user);
               final Scanner scanner = shellState.getConnector().createScanner(table, auths);
               scanner.setRange(new Range(new Text(Long.toHexString(trace))));
-              final StringBuffer sb = new StringBuffer();
-              if (TraceDump.printTrace(scanner, new Printer() {
+              final StringBuffer finalSB = sb;
+              traceCount = TraceDump.printTrace(scanner, new Printer() {
                 @Override
                 public void print(final String line) {
                   try {
-                    sb.append(line + "\n");
+                    finalSB.append(line + "\n");
                   } catch (Exception ex) {
                     throw new RuntimeException(ex);
                   }
                 }
-              }) > 0) {
+              });
+              if (traceCount > 0) {
                 shellState.getReader().printString(sb.toString());
                 break;
               }
@@ -71,6 +75,10 @@ public class TraceCommand extends DebugC
             shellState.getReader().flushConsole();
             UtilWaitThread.sleep(500);
           }
+          if (traceCount < 0) {
+            // display the trace even though there are unrooted spans
+            shellState.getReader().printString(sb.toString());
+          }
         } else {
           shellState.getReader().printString("Not tracing\n");
         }

Propchange: accumulo/trunk/examples/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/examples:r1459752,1459765

Propchange: accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java:r1459752,1459765

Propchange: accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java:r1459752,1459765

Propchange: accumulo/trunk/server/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/server:r1459752,1459765

Propchange: accumulo/trunk/src/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5/src:r1459752,1459765

Modified: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/ShellServerTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/ShellServerTest.java?rev=1459766&r1=1459765&r2=1459766&view=diff
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/ShellServerTest.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/ShellServerTest.java Fri Mar
22 13:38:35 2013
@@ -125,6 +125,8 @@ public class ShellServerTest {
     shell.start();
     shell.setExit(false);
     traceProcess = cluster.exec(TraceServer.class);
+    // give the tracer some time to start
+    UtilWaitThread.sleep(1000);
   }
   
   @AfterClass
@@ -598,8 +600,8 @@ public class ShellServerTest {
     };
     thread.start();
     exec("sleep 0.1", true);
-    System.out.println(exec("listscans", true));
-    String lines[] = output.get().split("\n");
+    String scans = exec("listscans", true);
+    String lines[] = scans.split("\n");
     String last = lines[lines.length - 1];
     assertTrue(last.contains("RUNNING"));
     String parts[] = last.split("\\|");
@@ -608,18 +610,18 @@ public class ShellServerTest {
     exec("deletetable -f t", true);
   }
   
-  //@Test(timeout = 60000)
+  @Test(timeout = 30000)
   public void trace() throws Exception {
-    exec("sleep 1", true);
     exec("trace on", true);
     exec("createtable t", true);
-    System.out.println(exec("trace off"));
-    exec("table trace");
-    System.out.println(exec("scan -np"));
-    exec("sleep 10");
-    System.out.println(exec("scan -np"));
-    UtilWaitThread.sleep(60*1000);
+    exec("insert a b c value", true);
+    exec("scan -np", true, "value", true);
     exec("deletetable -f t");
+    String trace = exec("trace off");
+    //System.out.println("trace: " + trace);
+    assertTrue(trace.contains("binMutations"));
+    assertTrue(trace.contains("update"));
+    assertTrue(trace.contains("DeleteTable"));
   }
   
   private int countkeys(String table) throws IOException {



Mime
View raw message