tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jihoon...@apache.org
Subject [1/4] tajo git commit: TAJO-1396 Unexpected IllegalMonitorStateException can be thrown in QueryInProgress
Date Tue, 24 Mar 2015 08:39:50 GMT
Repository: tajo
Updated Branches:
  refs/heads/index_support d09bd8ddc -> 12846ccae


TAJO-1396 Unexpected IllegalMonitorStateException can be thrown in QueryInProgress

Closes #416

Signed-off-by: Jinho Kim <jhkim@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/a9215852
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/a9215852
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/a9215852

Branch: refs/heads/index_support
Commit: a9215852d4bf9e5d7a29598a992ef1884f098d4b
Parents: 8d0146b
Author: navis.ryu <navis@apache.org>
Authored: Thu Mar 12 22:15:49 2015 +0900
Committer: Jinho Kim <jhkim@apache.org>
Committed: Tue Mar 24 13:33:40 2015 +0900

----------------------------------------------------------------------
 CHANGES                                         |  3 +++
 .../org/apache/tajo/master/QueryInProgress.java | 22 ++++++++++++++------
 .../org/apache/tajo/master/QueryManager.java    |  8 +------
 3 files changed, 20 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/a9215852/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index ad3a6bd..811992c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -38,6 +38,9 @@ Release 0.11.0 - unreleased
 
   BUG FIXES
 
+    TAJO-1396: Unexpected IllegalMonitorStateException can be thrown 
+    in QueryInProgress. (Contributed by navis. Committed by jinho)
+
     TAJO-1414: Two RemoteException in rpc module. 
     (Contributed by navis. Committed by jihun)
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/a9215852/tajo-core/src/main/java/org/apache/tajo/master/QueryInProgress.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/master/QueryInProgress.java b/tajo-core/src/main/java/org/apache/tajo/master/QueryInProgress.java
index c24dd90..668a770 100644
--- a/tajo-core/src/main/java/org/apache/tajo/master/QueryInProgress.java
+++ b/tajo-core/src/main/java/org/apache/tajo/master/QueryInProgress.java
@@ -95,7 +95,7 @@ public class QueryInProgress {
         queryMasterRpcClient.killQuery(null, queryId.getProto(), NullCallback.get());
       }
     } catch (Throwable e) {
-      catchException(e);
+      catchException("Failed to kill query " + queryId + " by exception " + e, e);
     } finally {
       writeLock.unlock();
     }
@@ -125,6 +125,11 @@ public class QueryInProgress {
   public boolean startQueryMaster() {
     try {
       writeLock.lockInterruptibly();
+    } catch (Exception e) {
+      catchException("Failed to lock by exception " + e, e);
+      return false;
+    }
+    try {
       LOG.info("Initializing QueryInProgress for QueryID=" + queryId);
       WorkerResourceManager resourceManager = masterContext.getResourceManager();
       WorkerAllocatedResource resource = resourceManager.allocateQueryMaster(this);
@@ -141,7 +146,7 @@ public class QueryInProgress {
 
       return true;
     } catch (Exception e) {
-      catchException(e);
+      catchException("Failed to start query master for query " + queryId + " by exception
" + e, e);
       return false;
     } finally {
       writeLock.unlock();
@@ -163,12 +168,17 @@ public class QueryInProgress {
 
     try {
       writeLock.lockInterruptibly();
+    } catch (Exception e) {
+      LOG.error("Failed to lock by exception " + e.getMessage(), e);
+      return;
+    }
 
+    try {
       if(queryMasterRpcClient == null) {
         connectQueryMaster();
       }
       if(queryMasterRpcClient == null) {
-        LOG.info("No QueryMaster conneciton info.");
+        LOG.info("No QueryMaster connection info.");
         //TODO wait
         return;
       }
@@ -186,14 +196,14 @@ public class QueryInProgress {
       querySubmitted.set(true);
       getQueryInfo().setQueryState(TajoProtos.QueryState.QUERY_MASTER_LAUNCHED);
     } catch (Exception e) {
-      LOG.error(e.getMessage(), e);
+      LOG.error("Failed to submit query " + queryId + " to master by exception " + e, e);
     } finally {
       writeLock.unlock();
     }
   }
 
-  public void catchException(Throwable e) {
-    LOG.error(e.getMessage(), e);
+  public void catchException(String message, Throwable e) {
+    LOG.error(message, e);
     queryInfo.setQueryState(TajoProtos.QueryState.QUERY_FAILED);
     queryInfo.setLastMessage(StringUtils.stringifyException(e));
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/a9215852/tajo-core/src/main/java/org/apache/tajo/master/QueryManager.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/master/QueryManager.java b/tajo-core/src/main/java/org/apache/tajo/master/QueryManager.java
index b1fa17d..0c8d8ce 100644
--- a/tajo-core/src/main/java/org/apache/tajo/master/QueryManager.java
+++ b/tajo-core/src/main/java/org/apache/tajo/master/QueryManager.java
@@ -87,7 +87,7 @@ public class QueryManager extends CompositeService {
 
       this.scheduler = new SimpleFifoScheduler(this);
     } catch (Exception e) {
-      catchException(null, e);
+      LOG.error("Failed to init service " + getName() + " by exception " + e, e);
     }
 
     super.serviceInit(conf);
@@ -304,12 +304,6 @@ public class QueryManager extends CompositeService {
     return executedQuerySize.get();
   }
 
-  private void catchException(QueryId queryId, Exception e) {
-    LOG.error(e.getMessage(), e);
-    QueryInProgress queryInProgress = runningQueries.get(queryId);
-    queryInProgress.catchException(e);
-  }
-
   public synchronized QueryCoordinatorProtocol.TajoHeartbeatResponse.ResponseCommand queryHeartbeat(
       QueryCoordinatorProtocol.TajoHeartbeat queryHeartbeat) {
     QueryInProgress queryInProgress = getQueryInProgress(new QueryId(queryHeartbeat.getQueryId()));


Mime
View raw message