Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id E5D66200CB0 for ; Fri, 9 Jun 2017 07:18:24 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id E47A0160BE5; Fri, 9 Jun 2017 05:18:24 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 1037F160BD5 for ; Fri, 9 Jun 2017 07:18:23 +0200 (CEST) Received: (qmail 5865 invoked by uid 500); 9 Jun 2017 05:18:23 -0000 Mailing-List: contact dev-help@phoenix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@phoenix.apache.org Delivered-To: mailing list dev@phoenix.apache.org Received: (qmail 5854 invoked by uid 99); 9 Jun 2017 05:18:23 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Jun 2017 05:18:23 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id C3C0AC090B for ; Fri, 9 Jun 2017 05:18:22 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id NzNO_u1jl054 for ; Fri, 9 Jun 2017 05:18:21 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 2B14060DF0 for ; Fri, 9 Jun 2017 05:18:19 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 5AB0EE0634 for ; Fri, 9 Jun 2017 05:18:18 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 136E021938 for ; Fri, 9 Jun 2017 05:18:18 +0000 (UTC) Date: Fri, 9 Jun 2017 05:18:18 +0000 (UTC) From: "Karan Mehta (JIRA)" To: dev@phoenix.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (PHOENIX-3799) Error on tracing query with "union all" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Fri, 09 Jun 2017 05:18:25 -0000 [ https://issues.apache.org/jira/browse/PHOENIX-3799?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16043949#comment-16043949 ] Karan Mehta commented on PHOENIX-3799: -------------------------------------- Hey Marco, Could you confirm the Phoenix version number as well as HTrace version number that it is using? Till now, Phoenix uses the version of HTrace which doesn't throw an exception on this error. [~samarthjain] I looked into the issue. For a union query, we try tracing individual iterators for all the queries involved. Since this happens in a single thread, the parent span of each new iterator is equal to previous iterator's span, but in fact it should not be tied to it, since both of them are independent iterators altogether. For example, in the query {{SELECT K FROM TABLEA UNION ALL SELECT K FROM TABLEB UNION ALL SELECT K FROM TABLEC}}, three separate iterators are created for all the three queries involved in the same thread. Hence, the spans look something like this {code} Parent Span + TABLEA Iterator Span + TABLEB Iterator Span + TABLEC Iterator Span + HBase Spans for TABLEC + HBase Spans for TABLEB + HBase Spans for TABLEA {code} and hence when these iterators are closed, the span in threadlocal will not match the span in the current scope, resulting in this exception. What we really want is something like this {code} Parent Span + TABLEA Iterator Span + HBase Spans for TABLEA + TABLEB Iterator Span + HBase Spans for TABLEA + TABLEC Iterator Span + HBase Spans for TABLEA {code} However such a thing is not possible unless we initialize the iterators parallely. Please suggest as to how we should handle this. For now, we don't have any parent span with a TraceScope of complete query. > Error on tracing query with "union all" > ---------------------------------------- > > Key: PHOENIX-3799 > URL: https://issues.apache.org/jira/browse/PHOENIX-3799 > Project: Phoenix > Issue Type: Bug > Affects Versions: 4.7.0 > Environment: Phoenix on Cloudera 5.8 > Reporter: Marco > Labels: TRACING > > When i try to enable tracing for query with a "union all" clause, I receive an error and the process stop the execution. > Error: > 0: jdbc:phoenix:xxxxxxxxx> select sum(1) as num from ( > . . . . . . . . . . . . . . > select count(1) as num from my_tab where meas_ym ='201601' > . . . . . . . . . . . . . . > union all > . . . . . . . . . . . . . . > select count(1) as num from my_tab where meas_ym ='201602'); > 17/04/20 15:39:38 ERROR htrace.Tracer: Tried to close trace span {"i":"7a2caddba3cc1d5d","s":"f262306696ff7120","b":1492702777540,"d":"Creating basic query for [CLIENT 10-CHUNK 9560319 ROWS 2516584015 BYTES PARALLEL 1-WAY RANGE SCAN OVER MY_TAB ['201601'], SERVER FILTER BY FIRST KEY ONLY, SERVER AGGREGATE INTO SINGLE ROW]","p":["f6e9e018136584b0"],"t":[{"t":1492702777542,"m":"First request completed"}]} but it is not the current span for the main thread. You have probably forgotten to close or detach {"i":"7a2caddba3cc1d5d","s":"f1a3a546476f1c94","b":1492702777541,"d":"Creating basic query for [CLIENT 36-CHUNK 40590914 ROWS 10380911994 BYTES PARALLEL 1-WAY RANGE SCAN OVER MY_TAB ['201602'], SERVER FILTER BY FIRST KEY ONLY, SERVER AGGREGATE INTO SINGLE ROW]","p":["f262306696ff7120"]} > java.lang.RuntimeException: Tried to close trace span {"i":"7a2caddba3cc1d5d","s":"f262306696ff7120","b":1492702777540,"d":"Creating basic query for [CLIENT 10-CHUNK 9560319 ROWS 2516584015 BYTES PARALLEL 1-WAY RANGE SCAN OVER MY_TAB ['201601'], SERVER FILTER BY FIRST KEY ONLY, SERVER AGGREGATE INTO SINGLE ROW]","p":["f6e9e018136584b0"],"t":[{"t":1492702777542,"m":"First request completed"}]} but it is not the current span for the main thread. You have probably forgotten to close or detach {"i":"7a2caddba3cc1d5d","s":"f1a3a546476f1c94","b":1492702777541,"d":"Creating basic query for [CLIENT 36-CHUNK 40590914 ROWS 10380911994 BYTES PARALLEL 1-WAY RANGE SCAN OVER MY_TAB ['201602'], SERVER FILTER BY FIRST KEY ONLY, SERVER AGGREGATE INTO SINGLE ROW]","p":["f262306696ff7120"]} > at org.apache.htrace.Tracer.clientError(Tracer.java:60) > at org.apache.htrace.TraceScope.close(TraceScope.java:90) > at org.apache.phoenix.trace.TracingIterator.close(TracingIterator.java:46) > at org.apache.phoenix.iterate.DelegateResultIterator.close(DelegateResultIterator.java:39) > at org.apache.phoenix.iterate.LookAheadResultIterator$1.close(LookAheadResultIterator.java:42) > at org.apache.phoenix.iterate.ConcatResultIterator.currentIterator(ConcatResultIterator.java:104) > at org.apache.phoenix.iterate.ConcatResultIterator.next(ConcatResultIterator.java:117) > at org.apache.phoenix.iterate.DelegateResultIterator.next(DelegateResultIterator.java:44) > at org.apache.phoenix.execute.TupleProjectionPlan$1.next(TupleProjectionPlan.java:67) > at org.apache.phoenix.iterate.LookAheadResultIterator$1.advance(LookAheadResultIterator.java:47) > at org.apache.phoenix.iterate.LookAheadResultIterator.next(LookAheadResultIterator.java:67) > at org.apache.phoenix.iterate.BaseGroupedAggregatingResultIterator.next(BaseGroupedAggregatingResultIterator.java:64) > at org.apache.phoenix.iterate.LookAheadResultIterator$1.advance(LookAheadResultIterator.java:47) > at org.apache.phoenix.iterate.LookAheadResultIterator.init(LookAheadResultIterator.java:59) > at org.apache.phoenix.iterate.LookAheadResultIterator.next(LookAheadResultIterator.java:65) > at org.apache.phoenix.iterate.BaseGroupedAggregatingResultIterator.next(BaseGroupedAggregatingResultIterator.java:64) > at org.apache.phoenix.iterate.UngroupedAggregatingResultIterator.next(UngroupedAggregatingResultIterator.java:39) > at org.apache.phoenix.jdbc.PhoenixResultSet.next(PhoenixResultSet.java:778) > at sqlline.BufferedRows.(BufferedRows.java:37) > at sqlline.SqlLine.print(SqlLine.java:1650) > at sqlline.Commands.execute(Commands.java:833) > at sqlline.Commands.sql(Commands.java:732) > at sqlline.SqlLine.dispatch(SqlLine.java:808) > at sqlline.SqlLine.begin(SqlLine.java:681) > at sqlline.SqlLine.start(SqlLine.java:398) > at sqlline.SqlLine.main(SqlLine.java:292) > Without tracing, the query works fine: > 0: jdbc:phoenix:xxxxxxxxx> select sum(1) as num from ( > . . . . . . . . . . . . . . > select count(1) as num from my_tab where meas_ym ='201601' > . . . . . . . . . . . . . . > union all > . . . . . . . . . . . . . . > select count(1) as num from my_tab where meas_ym ='201602'); > +------+ > | NUM | > +------+ > | 2 | > +------+ > 1 row selected (8.507 seconds) -- This message was sent by Atlassian JIRA (v6.3.15#6346)