tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hyun...@apache.org
Subject git commit: TAJO-672: Wrong progress status when overwrites to partition table. (hyoungjunkim via hyunsik)
Date Fri, 07 Mar 2014 11:58:01 GMT
Repository: incubator-tajo
Updated Branches:
  refs/heads/branch-0.8.0 1cac6789e -> 8cf31be82


TAJO-672: Wrong progress status when overwrites to partition table. (hyoungjunkim via hyunsik)


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

Branch: refs/heads/branch-0.8.0
Commit: 8cf31be82a87e4a0ca828e363487fc070f83086c
Parents: 1cac678
Author: Hyunsik Choi <hyunsik@apache.org>
Authored: Fri Mar 7 20:56:58 2014 +0900
Committer: Hyunsik Choi <hyunsik@apache.org>
Committed: Fri Mar 7 20:57:45 2014 +0900

----------------------------------------------------------------------
 CHANGES.txt                                                 | 3 +++
 .../src/main/java/org/apache/tajo/worker/Task.java          | 8 +++++++-
 .../src/test/java/org/apache/tajo/worker/TestFetcher.java   | 9 +++++++++
 3 files changed, 19 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/8cf31be8/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 7d2305e..faa265e 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -273,6 +273,9 @@ Release 0.8.0 - unreleased
 
   BUG FIXES
 
+    TAJO-672: Wrong progress status when overwrites to partition table.
+    (hyoungjunkim via hyunsik)
+
     TAJO-663: CREATE TABLE USING RAW doesn't throw ERROR. (jaehwa)
 
     TAJO-665: sort buffer size must be dealt as long type values. 

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/8cf31be8/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/worker/Task.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/worker/Task.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/worker/Task.java
index c542afb..30f56ee 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/worker/Task.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/worker/Task.java
@@ -18,6 +18,7 @@
 
 package org.apache.tajo.worker;
 
+import com.google.common.annotations.VisibleForTesting;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import org.apache.commons.lang.exception.ExceptionUtils;
@@ -588,6 +589,11 @@ public class Task {
     }
   }
 
+  @VisibleForTesting
+  public static float adjustFetchProcess(int totalFetcher, int remainFetcher) {
+    return ((float)(totalFetcher - remainFetcher)) / (float)totalFetcher * FETCHER_PROGRESS;
+  }
+
   private synchronized void fetcherFinished(TaskAttemptContext ctx) {
     int fetcherSize = fetcherRunners.size();
     if(fetcherSize == 0) {
@@ -599,7 +605,7 @@ public class Task {
       if (numRunningFetcher == 0) {
         context.setProgress(FETCHER_PROGRESS);
       } else {
-        context.setProgress(((float)(fetcherSize - numRunningFetcher)) / numRunningFetcher
* FETCHER_PROGRESS);
+        context.setProgress(adjustFetchProcess(fetcherSize, numRunningFetcher));
       }
     } finally {
       ctx.getFetchLatch().countDown();

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/8cf31be8/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/worker/TestFetcher.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/worker/TestFetcher.java
b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/worker/TestFetcher.java
index aa4a20c..0c47320 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/worker/TestFetcher.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/worker/TestFetcher.java
@@ -82,4 +82,13 @@ public class TestFetcher {
     FileStatus outStatus = fs.getFileStatus(new Path(OUTPUT_DIR, "data"));
     assertEquals(inStatus.getLen(), outStatus.getLen());
   }
+
+  @Test
+  public void testAdjustFetchProcess() {
+    assertEquals(0.05f, Task.adjustFetchProcess(10, 9), 0);
+    assertEquals(0.1f, Task.adjustFetchProcess(10, 8), 0);
+    assertEquals(0.25f, Task.adjustFetchProcess(10, 5), 0);
+    assertEquals(0.45f, Task.adjustFetchProcess(10, 1), 0);
+    assertEquals(0.5f, Task.adjustFetchProcess(10, 0), 0);
+  }
 }


Mime
View raw message