tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jihoon...@apache.org
Subject [12/19] git commit: TAJO-869: Sometimes, the unit test of testTaskRunnerHistory is failed. (jinho)
Date Tue, 15 Jul 2014 07:16:51 GMT
TAJO-869: Sometimes, the unit test of testTaskRunnerHistory is failed. (jinho)


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

Branch: refs/heads/index_support
Commit: 0a39818f5ee29be56b23060c978915fd7287fd0a
Parents: 01857da
Author: jinossy <jinossy@gmail.com>
Authored: Sat Jul 12 00:28:31 2014 +0900
Committer: jinossy <jinossy@gmail.com>
Committed: Sat Jul 12 00:28:31 2014 +0900

----------------------------------------------------------------------
 CHANGES                                                      | 3 +++
 tajo-core/src/main/java/org/apache/tajo/worker/Task.java     | 8 +++-----
 .../main/java/org/apache/tajo/worker/TaskRunnerHistory.java  | 5 +++--
 3 files changed, 9 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/0a39818f/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 87cf7b0..26d3341 100644
--- a/CHANGES
+++ b/CHANGES
@@ -82,6 +82,9 @@ Release 0.9.0 - unreleased
 
   BUG FIXES
 
+    TAJO-869: Sometimes, the unit test of testTaskRunnerHistory is failed.
+    (jinho)
+
     TAJO-908: Fetcher does not retry, when pull server connection was closed.
     (jinho)
  

http://git-wip-us.apache.org/repos/asf/tajo/blob/0a39818f/tajo-core/src/main/java/org/apache/tajo/worker/Task.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/worker/Task.java b/tajo-core/src/main/java/org/apache/tajo/worker/Task.java
index 9350838..ee3c40d 100644
--- a/tajo-core/src/main/java/org/apache/tajo/worker/Task.java
+++ b/tajo-core/src/main/java/org/apache/tajo/worker/Task.java
@@ -85,7 +85,6 @@ public class Task {
   private boolean interQuery;
   private boolean killed = false;
   private boolean aborted = false;
-  private boolean stopped = false;
   private final Reporter reporter;
   private Path inputTableBaseDir;
 
@@ -411,7 +410,6 @@ public class Task {
       aborted = true;
     } finally {
       context.setProgress(1.0f);
-      stopped = true;
       taskRunnerContext.completedTasksNum.incrementAndGet();
 
       if (killed || aborted) {
@@ -466,7 +464,7 @@ public class Task {
       finishTime = System.currentTimeMillis();
       LOG.info("Worker's task counter - total:" + taskRunnerContext.completedTasksNum.intValue()
+
           ", succeeded: " + taskRunnerContext.succeededTasksNum.intValue()
-          + ", killed: " + taskRunnerContext.killedTasksNum.incrementAndGet()
+          + ", killed: " + taskRunnerContext.killedTasksNum.intValue()
           + ", failed: " + taskRunnerContext.failedTasksNum.intValue());
       cleanupTask();
     }
@@ -711,7 +709,7 @@ public class Task {
         int remainingRetries = MAX_RETRIES;
         @Override
         public void run() {
-          while (!stop.get() && !stopped) {
+          while (!stop.get() && !context.isStopped()) {
             try {
               if(executor != null && context.getProgress() < 1.0f) {
                 float progress = executor.getProgress();
@@ -736,7 +734,7 @@ public class Task {
                 throw new RuntimeException(t);
               }
             } finally {
-              if (remainingRetries > 0) {
+              if (!context.isStopped() && remainingRetries > 0) {
                 synchronized (pingThread) {
                   try {
                     pingThread.wait(PROGRESS_INTERVAL);

http://git-wip-us.apache.org/repos/asf/tajo/blob/0a39818f/tajo-core/src/main/java/org/apache/tajo/worker/TaskRunnerHistory.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/worker/TaskRunnerHistory.java b/tajo-core/src/main/java/org/apache/tajo/worker/TaskRunnerHistory.java
index df60855..a8a11c1 100644
--- a/tajo-core/src/main/java/org/apache/tajo/worker/TaskRunnerHistory.java
+++ b/tajo-core/src/main/java/org/apache/tajo/worker/TaskRunnerHistory.java
@@ -57,7 +57,7 @@ public class TaskRunnerHistory implements ProtoObject<TaskRunnerHistoryProto>
{
     this.startTime = proto.getStartTime();
     this.finishTime = proto.getFinishTime();
     this.executionBlockId = new ExecutionBlockId(proto.getExecutionBlockId());
-    this.taskHistoryMap = Maps.newHashMap();
+    this.taskHistoryMap = Maps.newTreeMap();
     for (TaskHistoryProto taskHistoryProto : proto.getTaskHistoriesList()) {
       TaskHistory taskHistory = new TaskHistory(taskHistoryProto);
       taskHistoryMap.put(taskHistory.getQueryUnitAttemptId(), taskHistory);
@@ -74,7 +74,8 @@ public class TaskRunnerHistory implements ProtoObject<TaskRunnerHistoryProto>
{
 
   @Override
   public int hashCode() {
-    return Objects.hashCode(containerId, executionBlockId, taskHistoryMap);
+    return Objects.hashCode(containerId, executionBlockId, state, startTime,
+        finishTime, taskHistoryMap.size());
   }
 
   @Override


Mime
View raw message