[ 
https://issues.apache.org/jira/browse/HIVE-21864?focusedWorklogId=260138&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-260138
 ]

ASF GitHub Bot logged work on HIVE-21864:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 14/Jun/19 06:21
            Start Date: 14/Jun/19 06:21
    Worklog Time Spent: 10m 
      Work Description: ShubhamChaurasia commented on pull request #669: 
HIVE-21864: LlapBaseInputFormat#closeAll() throws 
ConcurrentModificationException
URL: https://github.com/apache/hive/pull/669#discussion_r293672095
 
 

 ##########
 File path: 
itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcWithMiniLlapArrow.java
 ##########
 @@ -427,5 +437,85 @@ public void testKillQueryByTagOwner() throws Exception {
     assertNotNull("tExecute", tExecuteHolder.throwable);
     assertNull("tCancel", tKillHolder.throwable);
   }
+
+  @Test
+  public void testAddCloseCloseAllConnections() throws Exception {
+    System.out.println("BaseJdbcWithMiniLlap.testAddCloseCloseAllConnections");
+
+    createTestTable("testtab1");
+
+    String url = miniHS2.getJdbcURL();
+    String user = System.getProperty("user.name");
+    String pwd = user;
+
+    InputFormat<NullWritable, Row> inputFormat = getInputFormat();
+
+    // Get splits
+    JobConf job = new JobConf(conf);
+    job.set(LlapBaseInputFormat.URL_KEY, url);
+    job.set(LlapBaseInputFormat.USER_KEY, user);
+    job.set(LlapBaseInputFormat.PWD_KEY, pwd);
+    job.set(LlapBaseInputFormat.QUERY_KEY, "select * from testtab1");
+
+    final String[] handleIds = IntStream.range(0, 20).boxed().map(i -> 
"handleId-" + i).toArray(String[]::new);
+    final Iterator<String> handleIdsItr = 
Iterables.cycle(handleIds).iterator();
+
+    final ExceptionHolder exceptionHolder = new ExceptionHolder();
+
+    // addConnThread thread will keep adding connections
+    // closeConnThread thread tries close connection(s) associated to 
handleIds, one at a time
+    // closeAllConnThread thread tries to close All at once.
+
+    final int numIterations = 100;
+    Thread addConnThread = new Thread(() -> executeNTimes(() -> {
+      String handleId = handleIdsItr.next();
+      job.set(LlapBaseInputFormat.HANDLE_ID, handleId);
+      InputSplit[] splits = inputFormat.getSplits(job, 1);
+      assertTrue(splits.length > 0);
+      return null;
+    }, numIterations, 1, exceptionHolder));
+
+    Thread closeConnThread = new Thread(() -> executeNTimes(() -> {
+      String handleId = handleIdsItr.next();
+      LlapBaseInputFormat.close(handleId);
+      return null;
+    }, numIterations, 2, exceptionHolder));
+
 
 Review comment:
   done
 
----------------------------------------------------------------
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: 260138)
    Time Spent: 1h 40m  (was: 1.5h)

> LlapBaseInputFormat#closeAll() throws ConcurrentModificationException
> ---------------------------------------------------------------------
>
>                 Key: HIVE-21864
>                 URL: https://issues.apache.org/jira/browse/HIVE-21864
>             Project: Hive
>          Issue Type: Bug
>          Components: llap
>    Affects Versions: 3.1.1
>            Reporter: Shubham Chaurasia
>            Assignee: Shubham Chaurasia
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: HIVE-21864.1.patch, HIVE-21864.2.patch
>
>          Time Spent: 1h 40m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to