This is an automated email from the ASF dual-hosted git repository.

rameshkumar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new 2a2889a178f HIVE-26239 Shutdown Hash table load executor service 
threads when they are interrupted (#3302)
2a2889a178f is described below

commit 2a2889a178fa0196c4ddccb38b32a9ba2c58b8f9
Author: Ramesh Kumar <[email protected]>
AuthorDate: Fri May 27 08:48:19 2022 -0700

    HIVE-26239 Shutdown Hash table load executor service threads when they are 
interrupted (#3302)
---
 .../mapjoin/fast/VectorMapJoinFastHashTableLoader.java   | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git 
a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/fast/VectorMapJoinFastHashTableLoader.java
 
b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/fast/VectorMapJoinFastHashTableLoader.java
index 0aa4736742d..0a5a4f308d5 100644
--- 
a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/fast/VectorMapJoinFastHashTableLoader.java
+++ 
b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/fast/VectorMapJoinFastHashTableLoader.java
@@ -34,6 +34,7 @@ import org.apache.hadoop.hive.ql.exec.MemoryMonitorInfo;
 import org.apache.hadoop.hive.ql.exec.Operator;
 import org.apache.hadoop.hive.ql.exec.Utilities;
 import org.apache.hadoop.hive.ql.exec.mapjoin.MapJoinMemoryExhaustionError;
+import 
org.apache.hadoop.hive.ql.security.authorization.plugin.HiveAccessControlException;
 import org.apache.hive.common.util.FixedSizedObjectPool;
 import org.apache.tez.common.counters.TezCounter;
 import org.slf4j.Logger;
@@ -294,7 +295,10 @@ public class VectorMapJoinFastHashTableLoader implements 
org.apache.hadoop.hive.
         LOG.info("Finished loading the queue for input: {} waiting {} minutes 
for TPool shutdown", inputName, 2);
         addQueueDoneSentinel();
         loadExecService.shutdown();
-        loadExecService.awaitTermination(2, TimeUnit.MINUTES);
+
+        if (!loadExecService.awaitTermination(2, TimeUnit.MINUTES)) {
+          throw new HiveException("Failed to complete the hash table loader. 
Loading timed out.");
+        }
         batchPool.clear();
         LOG.info("Total received entries: {} Threads {} HT entries: {}", 
receivedEntries, numLoadThreads, totalEntries.get());
 
@@ -314,12 +318,14 @@ public class VectorMapJoinFastHashTableLoader implements 
org.apache.hadoop.hive.
       } catch (InterruptedException e) {
         Thread.currentThread().interrupt();
         throw new HiveException(e);
-      } catch (IOException e) {
-        throw new HiveException(e);
-      } catch (SerDeException e) {
-        throw new HiveException(e);
+      } catch (HiveException e) {
+        throw e;
       } catch (Exception e) {
         throw new HiveException(e);
+      } finally {
+        if (loadExecService != null && !loadExecService.isTerminated()) {
+          loadExecService.shutdownNow();
+        }
       }
     }
   }

Reply via email to