accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1459765 - in /accumulo/branches/1.5: core/src/main/java/org/apache/accumulo/core/trace/ core/src/main/java/org/apache/accumulo/core/util/shell/commands/ test/src/test/java/org/apache/accumulo/test/
Date Fri, 22 Mar 2013 13:37:56 GMT
Author: ecn
Date: Fri Mar 22 13:37:56 2013
New Revision: 1459765

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

Modified:
    accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/trace/TraceDump.java
    accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java
    accumulo/branches/1.5/test/src/test/java/org/apache/accumulo/test/ShellServerTest.java

Modified: accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/trace/TraceDump.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/trace/TraceDump.java?rev=1459765&r1=1459764&r2=1459765&view=diff
==============================================================================
--- accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/trace/TraceDump.java
(original)
+++ accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/trace/TraceDump.java
Fri Mar 22 13:37:56 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/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java?rev=1459765&r1=1459764&r2=1459765&view=diff
==============================================================================
--- accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java
(original)
+++ accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java
Fri Mar 22 13:37:56 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");
         }

Modified: accumulo/branches/1.5/test/src/test/java/org/apache/accumulo/test/ShellServerTest.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/test/src/test/java/org/apache/accumulo/test/ShellServerTest.java?rev=1459765&r1=1459764&r2=1459765&view=diff
==============================================================================
--- accumulo/branches/1.5/test/src/test/java/org/apache/accumulo/test/ShellServerTest.java
(original)
+++ accumulo/branches/1.5/test/src/test/java/org/apache/accumulo/test/ShellServerTest.java
Fri Mar 22 13:37:56 2013
@@ -131,9 +131,9 @@ public class ShellServerTest {
   
   @AfterClass
   public static void tearDownAfterClass() throws Exception {
-    //cluster.stop();
-    //traceProcess.destroy();
-    //folder.delete();
+    cluster.stop();
+    traceProcess.destroy();
+    folder.delete();
   }
   
   @Test(timeout = 30000)
@@ -600,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("\\|");
@@ -618,9 +618,8 @@ public class ShellServerTest {
     exec("scan -np", true, "value", true);
     exec("deletetable -f t");
     String trace = exec("trace off");
-    assertTrue(trace.contains("shell@"));
+    //System.out.println("trace: " + trace);
     assertTrue(trace.contains("binMutations"));
-    assertTrue(trace.contains("client:update"));
     assertTrue(trace.contains("update"));
     assertTrue(trace.contains("DeleteTable"));
   }



Mime
View raw message