commit 3cd310b52311a9945f6e7e087ef9d95c5cedbfff Author: Thejas M Nair Date: Mon Jan 30 23:06:24 2017 -0800 release session on task shutdown diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezTask.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezTask.java index 7479b85..53167b1 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezTask.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezTask.java @@ -98,6 +98,7 @@ private final DagUtils utils; private DAGClient dagClient = null; + private TezSessionState session = null; Map workToVertex = new HashMap(); Map workToConf = new HashMap(); @@ -120,7 +121,6 @@ public int execute(DriverContext driverContext) { int rc = 1; boolean cleanContext = false; Context ctx = null; - TezSessionState session = null; try { // Get or create Context object. If we create it we have to clean it later as well. @@ -608,8 +608,14 @@ public void shutdown() { } closeDagClientWithoutEx(); } + if (session != null) { + try { + TezSessionPoolManager.getInstance().returnSession(session, getWork().getLlapMode()); + } catch (Exception e1) { + LOG.error("Error returning session", e1); + } + } } - /** DAG client that does dumb global sync on all the method calls; * Tez DAG client is not thread safe and getting the 2nd one is not recommended. */ public class SyncDagClient extends DAGClient {