[ https://issues.apache.org/jira/browse/HIVE-23619?focusedWorklogId=450236&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-450236 ]
ASF GitHub Bot logged work on HIVE-23619: ----------------------------------------- Author: ASF GitHub Bot Created on: 24/Jun/20 05:34 Start Date: 24/Jun/20 05:34 Worklog Time Spent: 10m Work Description: adesh-rao commented on a change in pull request #1146: URL: https://github.com/apache/hive/pull/1146#discussion_r444654203 ########## File path: itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/reexec/TestReExecuteKilledTezAMQueryPlugin.java ########## @@ -0,0 +1,207 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hadoop.hive.ql.reexec; + +import org.apache.hadoop.fs.Path; +import org.apache.hadoop.hive.conf.HiveConf; +import org.apache.hadoop.hive.llap.LlapBaseInputFormat; +import org.apache.hadoop.hive.ql.metadata.HiveException; +import org.apache.hadoop.yarn.api.records.ApplicationReport; +import org.apache.hadoop.yarn.api.records.YarnApplicationState; +import org.apache.hadoop.yarn.client.api.YarnClient; +import org.apache.hive.jdbc.BaseJdbcWithMiniLlap; +import org.apache.hive.jdbc.HiveStatement; +import org.apache.hive.jdbc.TestJdbcWithMiniLlapArrow; +import org.apache.hive.jdbc.miniHS2.MiniHS2; +import org.junit.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.net.URL; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class TestReExecuteKilledTezAMQueryPlugin { + protected static final Logger LOG = LoggerFactory.getLogger(TestJdbcWithMiniLlapArrow.class); + + private static MiniHS2 miniHS2 = null; + private static final String tableName = "testKillTezAmTbl"; + private static String dataFileDir; + private static final String testDbName = "testKillTezAmDb"; + protected static Connection hs2Conn = null; + private static HiveConf conf; + + private static class ExceptionHolder { + Throwable throwable; + } + + static HiveConf defaultConf() throws Exception { + String confDir = "../../data/conf/llap/"; + if (confDir != null && !confDir.isEmpty()) { + HiveConf.setHiveSiteLocation(new URL("file://"+ new File(confDir).toURI().getPath() + "/hive-site.xml")); + System.out.println("Setting hive-site: " + HiveConf.getHiveSiteLocation()); + } + HiveConf defaultConf = new HiveConf(); + defaultConf.setBoolVar(HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY, false); + defaultConf.setBoolVar(HiveConf.ConfVars.HIVE_SERVER2_ENABLE_DOAS, false); + defaultConf.addResource(new URL("file://" + new File(confDir).toURI().getPath() + "/tez-site.xml")); + return defaultConf; + } + + @BeforeClass + public static void beforeTest() throws Exception { + conf = defaultConf(); + conf.setVar(HiveConf.ConfVars.USERS_IN_ADMIN_ROLE, System.getProperty("user.name")); + conf.set(HiveConf.ConfVars.HIVE_QUERY_REEXECUTION_STRATEGIES.varname, "reexecute_lost_am"); + MiniHS2.cleanupLocalDir(); + Class.forName(MiniHS2.getJdbcDriverName()); + miniHS2 = new MiniHS2(conf, MiniHS2.MiniClusterType.LLAP); + dataFileDir = conf.get("test.data.files").replace('\\', '/').replace("c:", ""); + Map<String, String> confOverlay = new HashMap<String, String>(); + miniHS2.start(confOverlay); + miniHS2.getDFS().getFileSystem().mkdirs(new Path("/apps_staging_dir/anonymous")); + + Connection conDefault = getConnection(miniHS2.getJdbcURL(), + System.getProperty("user.name"), "bar"); + Statement stmt = conDefault.createStatement(); + String tblName = testDbName + "." + tableName; + Path dataFilePath = new Path(dataFileDir, "kv1.txt"); + String udfName = TestJdbcWithMiniLlapArrow.SleepMsUDF.class.getName(); + stmt.execute("drop database if exists " + testDbName + " cascade"); + stmt.execute("create database " + testDbName); + stmt.execute("set role admin"); + stmt.execute("dfs -put " + dataFilePath.toString() + " " + "kv1.txt"); + stmt.execute("use " + testDbName); + stmt.execute("create table " + tblName + " (int_col int, value string) "); + stmt.execute("load data inpath 'kv1.txt' into table " + tblName); + stmt.execute("create function sleepMsUDF as '" + udfName + "'"); + stmt.execute("grant select on table " + tblName + " to role public"); + + stmt.close(); + conDefault.close(); + } + + @AfterClass + public static void afterTest() { + if (miniHS2 != null && miniHS2.isStarted()) { + miniHS2.stop(); + } + } + + @Before + public void setUp() throws Exception { + hs2Conn = getConnection(miniHS2.getJdbcURL(), System.getProperty("user.name"), "bar"); + } + + public static Connection getConnection(String jdbcURL, String user, String pwd) throws SQLException { + Connection conn = DriverManager.getConnection(jdbcURL, user, pwd); + conn.createStatement().execute("set hive.support.concurrency = false"); + return conn; + } + + @After + public void tearDown() throws Exception { + LlapBaseInputFormat.closeAll(); + hs2Conn.close(); + } + Review comment: fixed. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 450236) Time Spent: 1h 20m (was: 1h 10m) > HiveServer2 should retry query if the TezAM running it gets killed > ------------------------------------------------------------------ > > Key: HIVE-23619 > URL: https://issues.apache.org/jira/browse/HIVE-23619 > Project: Hive > Issue Type: Improvement > Components: HiveServer2 > Reporter: Adesh Kumar Rao > Assignee: Adesh Kumar Rao > Priority: Minor > Labels: pull-request-available > Fix For: 4.0.0 > > Time Spent: 1h 20m > Remaining Estimate: 0h > > If the TezAM was running a query and it gets killed because of external > factors like node going node, HS2 should retry the query in different TezAM. -- This message was sent by Atlassian Jira (v8.3.4#803005)