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 0DDB9200D56 for ; Mon, 27 Nov 2017 22:50:16 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 0C69E160BFA; Mon, 27 Nov 2017 21:50:16 +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 36913160C14 for ; Mon, 27 Nov 2017 22:50:15 +0100 (CET) Received: (qmail 34027 invoked by uid 500); 27 Nov 2017 21:50:14 -0000 Mailing-List: contact issues-help@drill.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@drill.apache.org Delivered-To: mailing list issues@drill.apache.org Received: (qmail 34018 invoked by uid 99); 27 Nov 2017 21:50:14 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Nov 2017 21:50:14 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id A240EC1586 for ; Mon, 27 Nov 2017 21:50:13 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.011 X-Spam-Level: X-Spam-Status: No, score=-99.011 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KB_WAM_FROM_NAME_SINGLEWORD=0.2, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id RpJDZaoY0Zwo for ; Mon, 27 Nov 2017 21:50:11 +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 7DE115F36A for ; Mon, 27 Nov 2017 21:50:10 +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 4AEBFE25B7 for ; Mon, 27 Nov 2017 21:50:07 +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 4FA75241E2 for ; Mon, 27 Nov 2017 21:50:03 +0000 (UTC) Date: Mon, 27 Nov 2017 21:50:03 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@drill.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (DRILL-5963) Canceling a query hung in planning state, leaves the query in ENQUEUED state for ever. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 27 Nov 2017 21:50:16 -0000 [ https://issues.apache.org/jira/browse/DRILL-5963?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16267639#comment-16267639 ] ASF GitHub Bot commented on DRILL-5963: --------------------------------------- Github user ppadma commented on a diff in the pull request: https://github.com/apache/drill/pull/1051#discussion_r153294703 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/ProfileUtil.java --- @@ -19,30 +19,35 @@ import org.apache.drill.exec.proto.UserBitShared.QueryResult.QueryState; +import java.util.HashMap; +import java.util.Map; + public class ProfileUtil { - // Display names for QueryState enum in UserBitShared.proto - private static final String[] queryStateDisplayNames = { - "Starting", // STARTING = 0 - "Running", // RUNNING = 1 - "Succeeded", // COMPLETED = 2 - "Canceled", // CANCELED = 3 - "Failed", // FAILED = 4 - "CancellationRequested", // CANCELLATION_REQUESTED = 5 - "Enqueued" // ENQUEUED = 6 - }; + private static final Map queryStateDisplayMap = new HashMap<>(QueryState.values().length); + + static { + queryStateDisplayMap.put(QueryState.PREPARING, "Preparing"); + queryStateDisplayMap.put(QueryState.PLANNING, "Planning"); + queryStateDisplayMap.put(QueryState.ENQUEUED, "Enqueued"); + queryStateDisplayMap.put(QueryState.STARTING, "Starting"); + queryStateDisplayMap.put(QueryState.RUNNING, "Running"); + queryStateDisplayMap.put(QueryState.COMPLETED, "Succeeded"); --- End diff -- To be consistent, should we name this state QueryState.SUCCEEDED ? > Canceling a query hung in planning state, leaves the query in ENQUEUED state for ever. > -------------------------------------------------------------------------------------- > > Key: DRILL-5963 > URL: https://issues.apache.org/jira/browse/DRILL-5963 > Project: Apache Drill > Issue Type: Bug > Components: Execution - Flow > Affects Versions: 1.12.0 > Environment: Drill 1.12.0-SNAPSHOT, commit: 4a718a0bd728ae02b502ac93620d132f0f6e1b6c > Reporter: Khurram Faraaz > Assignee: Arina Ielchiieva > Priority: Critical > Fix For: 1.13.0 > > Attachments: enqueued-2.png > > > Canceling the below query that is hung in planning state, leaves the query in ENQUEUED state for ever. > Here is the query that is hung in planning state > {noformat} > 0: jdbc:drill:schema=dfs.tmp> select 1 || ',' || 2 || ',' || 3 || ',' || 4 || ',' || 5 || ',' || 6 || ',' || 7 || ',' || 8 || ',' || 9 || ',' || 0 || ',' AS CSV_DATA from (values(1)); > +--+ > | | > +--+ > +--+ > No rows selected (304.291 seconds) > {noformat} > Explain plan for that query also just hangs. > {noformat} > explain plan for select 1 || ',' || 2 || ',' || 3 || ',' || 4 || ',' || 5 || ',' || 6 || ',' || 7 || ',' || 8 || ',' || 9 || ',' || 0 || ',' AS CSV_DATA from (values(1)); > ... > {noformat} > The above issues show the following problems: > *1. Simple query with reasonable number of concat functions hangs.* > In reality query does not hang it just take lots of time to execute. The root cause is that during planning time DrillFuncHolderExpr return type is extensively used to determine matching function, matching type etc. Though this type is retrieved via [getter|https://github.com/apache/drill/blob/master/exec/java-exec/src/main/java/org/apache/drill/exec/expr/DrillFuncHolderExpr.java#L41] in reality complex logic is executed beaneath it. For example for [concat function|https://github.com/apache/drill/blob/master/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/output/ConcatReturnTypeInference.java#L47]. Since function return type can not be changes during DrillFuncHolderExpr life time, it is safe to cache it. > *2. No mechanism to cancel query during ENQUEUED state.* > Currently Drill does not have mechanism to cancel query before STARTING / RUNNING states. Plus ENQUEUED state includes two PLANNING and ENQUEUED. > Also submitting mechanism for submitting query to the queue is blocking, making foreman wait till enqueueing is done Making it non-blocking will prevent consuming threads that just sit idle in a busy system and also is important when we move to a real admission control solution. > The following changes were made to address above issues: > a. two new states were added: PREPARING (when foreman is initialized) and PLANNING (includes logical and / or physical planning). > b. process of query enqueuing was made non-blocking. Once query was enqueued, fragments runner is called to submit fragments locally and remotely. > c. ability to cancel query during planning and enqueued states was added. -- This message was sent by Atlassian JIRA (v6.4.14#64029)