hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From este...@apache.org
Subject hbase git commit: HBASE-13089 Fix test compilation error on building against htrace-3.2.0-incubating
Date Mon, 27 Jul 2015 20:05:28 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 3f80e0ea4 -> 1566ec5fd


HBASE-13089 Fix test compilation error on building against htrace-3.2.0-incubating


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/1566ec5f
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/1566ec5f
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/1566ec5f

Branch: refs/heads/master
Commit: 1566ec5fdc751897b2e931b2b0920c6d503c85ce
Parents: 3f80e0e
Author: Esteban Gutierrez <esteban@apache.org>
Authored: Fri Jul 24 15:34:40 2015 -0700
Committer: Esteban Gutierrez <esteban@apache.org>
Committed: Mon Jul 27 12:57:03 2015 -0700

----------------------------------------------------------------------
 .../apache/hadoop/hbase/trace/TestHTraceHooks.java   | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/1566ec5f/hbase-server/src/test/java/org/apache/hadoop/hbase/trace/TestHTraceHooks.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/trace/TestHTraceHooks.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/trace/TestHTraceHooks.java
index 7a47f52..65dff1b 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/trace/TestHTraceHooks.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/trace/TestHTraceHooks.java
@@ -21,6 +21,7 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
+import java.lang.reflect.Method;
 import java.util.Collection;
 
 import org.apache.hadoop.hbase.HBaseTestingUtility;
@@ -49,9 +50,19 @@ public class TestHTraceHooks {
   private static final byte[] FAMILY_BYTES = "family".getBytes();
   private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
   private static POJOSpanReceiver rcvr;
+  private static long ROOT_SPAN_ID = 0;
 
   @BeforeClass
   public static void before() throws Exception {
+
+    // Find out what the right value to use fo SPAN_ROOT_ID after HTRACE-111. We use HTRACE-32
+    // to find out to detect if we are using HTrace 3.2 or not.
+    try {
+        Method m = Span.class.getMethod("addKVAnnotation", String.class, String.class);
+    } catch (NoSuchMethodException e) {
+      ROOT_SPAN_ID = 0x74aceL; // Span.SPAN_ROOT_ID pre HTrace-3.2
+    }
+
     TEST_UTIL.startMiniCluster(2, 3);
     rcvr = new POJOSpanReceiver(new HBaseHTraceConfiguration(TEST_UTIL.getConfiguration()));
     Trace.addReceiver(rcvr);
@@ -87,7 +98,7 @@ public class TestHTraceHooks {
 
     Collection<Span> spans = rcvr.getSpans();
     TraceTree traceTree = new TraceTree(spans);
-    Collection<Span> roots = traceTree.getSpansByParent().find(Span.ROOT_SPAN_ID);
+    Collection<Span> roots = traceTree.getSpansByParent().find(ROOT_SPAN_ID);
 
     assertEquals(1, roots.size());
     Span createTableRoot = roots.iterator().next();
@@ -118,7 +129,7 @@ public class TestHTraceHooks {
 
     spans = rcvr.getSpans();
     traceTree = new TraceTree(spans);
-    roots = traceTree.getSpansByParent().find(Span.ROOT_SPAN_ID);
+    roots = traceTree.getSpansByParent().find(ROOT_SPAN_ID);
 
     assertEquals(2, roots.size());
     Span putRoot = null;


Mime
View raw message