Repository: hive Updated Branches: refs/heads/master 15d7d6dc9 -> 09a73bfba
Revert "HIVE-19897: Add more tests for parallel compilation (Yongzhi Chen, reviewed by Aihua Xu)" This reverts commit 596edd181624afb5175fb98eea2c672775c2f378. Project: http://git-wip-us.apache.org/repos/asf/hive/repo Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/09a73bfb Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/09a73bfb Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/09a73bfb Branch: refs/heads/master Commit: 09a73bfba3213d24f227714426eecb09a7677ba6 Parents: 15d7d6d Author: Yongzhi Chen <ych...@apache.org> Authored: Thu Jun 28 06:17:33 2018 -0400 Committer: Yongzhi Chen <ych...@apache.org> Committed: Thu Jun 28 06:17:33 2018 -0400 ---------------------------------------------------------------------- .../apache/hive/jdbc/TestJdbcWithMiniHS2.java | 67 ++------------------ 1 file changed, 5 insertions(+), 62 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hive/blob/09a73bfb/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcWithMiniHS2.java ---------------------------------------------------------------------- diff --git a/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcWithMiniHS2.java b/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcWithMiniHS2.java index dba0721..d7d7097 100644 --- a/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcWithMiniHS2.java +++ b/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcWithMiniHS2.java @@ -281,75 +281,21 @@ public class TestJdbcWithMiniHS2 { } @Test - public void testParallelCompilation3() throws Exception { - Statement stmt = conTestDb.createStatement(); - stmt.execute("set hive.driver.parallel.compilation=true"); - stmt.execute("set hive.server2.async.exec.async.compile=true"); - stmt.close(); - Connection conn = getConnection(testDbName); - stmt = conn.createStatement(); - stmt.execute("set hive.driver.parallel.compilation=true"); - stmt.execute("set hive.server2.async.exec.async.compile=true"); - stmt.close(); - int poolSize = 100; - SynchronousQueue<Runnable> executorQueue1 = new SynchronousQueue<Runnable>(); - ExecutorService workers1 = - new ThreadPoolExecutor(1, poolSize, 20, TimeUnit.SECONDS, executorQueue1); - SynchronousQueue<Runnable> executorQueue2 = new SynchronousQueue<Runnable>(); - ExecutorService workers2 = - new ThreadPoolExecutor(1, poolSize, 20, TimeUnit.SECONDS, executorQueue2); - List<Future<Boolean>> list1 = startTasks(workers1, conTestDb, tableName, 10); - List<Future<Boolean>> list2 = startTasks(workers2, conn, tableName, 10); - finishTasks(list1, workers1); - finishTasks(list2, workers2); - conn.close(); - } - - @Test - public void testParallelCompilation4() throws Exception { - Statement stmt = conTestDb.createStatement(); - stmt.execute("set hive.driver.parallel.compilation=true"); - stmt.execute("set hive.server2.async.exec.async.compile=false"); - stmt.close(); - Connection conn = getConnection(testDbName); - stmt = conn.createStatement(); - stmt.execute("set hive.driver.parallel.compilation=true"); - stmt.execute("set hive.server2.async.exec.async.compile=false"); - stmt.close(); - int poolSize = 100; - SynchronousQueue<Runnable> executorQueue1 = new SynchronousQueue<Runnable>(); - ExecutorService workers1 = - new ThreadPoolExecutor(1, poolSize, 20, TimeUnit.SECONDS, executorQueue1); - SynchronousQueue<Runnable> executorQueue2 = new SynchronousQueue<Runnable>(); - ExecutorService workers2 = - new ThreadPoolExecutor(1, poolSize, 20, TimeUnit.SECONDS, executorQueue2); - List<Future<Boolean>> list1 = startTasks(workers1, conTestDb, tableName, 10); - List<Future<Boolean>> list2 = startTasks(workers2, conn, tableName, 10); - finishTasks(list1, workers1); - finishTasks(list2, workers2); - conn.close(); - } - - @Test public void testConcurrentStatements() throws Exception { startConcurrencyTest(conTestDb, tableName, 50); } private static void startConcurrencyTest(Connection conn, String tableName, int numTasks) { // Start concurrent testing - int poolSize = 100; + int POOL_SIZE = 100; + int TASK_COUNT = numTasks; + SynchronousQueue<Runnable> executorQueue = new SynchronousQueue<Runnable>(); ExecutorService workers = - new ThreadPoolExecutor(1, poolSize, 20, TimeUnit.SECONDS, executorQueue); - List<Future<Boolean>> list = startTasks(workers, conn, tableName, numTasks); - finishTasks(list, workers); - } - - private static List<Future<Boolean>> startTasks(ExecutorService workers, Connection conn, - String tableName, int numTasks) { + new ThreadPoolExecutor(1, POOL_SIZE, 20, TimeUnit.SECONDS, executorQueue); List<Future<Boolean>> list = new ArrayList<Future<Boolean>>(); int i = 0; - while (i < numTasks) { + while (i < TASK_COUNT) { try { Future<Boolean> future = workers.submit(new JDBCTask(conn, i, tableName)); list.add(future); @@ -362,10 +308,7 @@ public class TestJdbcWithMiniHS2 { } } } - return list; - } - private static void finishTasks(List<Future<Boolean>> list, ExecutorService workers) { for (Future<Boolean> future : list) { try { Boolean result = future.get(30, TimeUnit.SECONDS);