You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tajo.apache.org by hy...@apache.org on 2014/01/04 16:49:31 UTC

git commit: TAJO-470: Fetcher's finished time and file length is changed in WEB UI. (hyoungjunkim via hyunsik)

Updated Branches:
  refs/heads/master 7aba3958e -> a65f8a10a


TAJO-470: Fetcher's finished time and file length is changed in WEB UI. (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/a65f8a10
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tajo/tree/a65f8a10
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tajo/diff/a65f8a10

Branch: refs/heads/master
Commit: a65f8a10a0855ce2a9490088898cc7bcd37169a5
Parents: 7aba395
Author: Hyunsik Choi <hy...@apache.org>
Authored: Sun Jan 5 00:49:17 2014 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Sun Jan 5 00:49:17 2014 +0900

----------------------------------------------------------------------
 CHANGES.txt                                          |  3 +++
 .../main/java/org/apache/tajo/worker/Fetcher.java    | 15 +++++++++++----
 .../src/main/java/org/apache/tajo/worker/Task.java   |  1 +
 .../java/org/apache/tajo/worker/TaskHistory.java     |  9 +++++++++
 .../src/main/resources/webapps/worker/taskdetail.jsp |  3 ++-
 5 files changed, 26 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/a65f8a10/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 48bfa3d..e08f938 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -192,6 +192,9 @@ Release 0.8.0 - unreleased
 
   BUG FIXES
 
+    TAJO-470: Fetcher's finished time and file length is changed in WEB UI.
+    (hyoungjunkim via hyunsik)
+
     TAJO-469: CTAS with no column definition will get  a NPE.
     (Min Zhou via hyunsik)
 

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/a65f8a10/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/worker/Fetcher.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/worker/Fetcher.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/worker/Fetcher.java
index 46d980b..99286ce 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/worker/Fetcher.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/worker/Fetcher.java
@@ -53,6 +53,7 @@ public class Fetcher {
   private long startTime;
   private long finishTime;
   private long fileLen;
+  private int messageReceiveCount;
 
   public Fetcher(URI uri, File file) {
     this.uri = uri;
@@ -82,6 +83,10 @@ public class Fetcher {
     return fileLen;
   }
 
+  public int getMessageReceiveCount() {
+    return messageReceiveCount;
+  }
+
   public String getStatus() {
     if(startTime == 0) {
       return "READY";
@@ -147,11 +152,14 @@ public class Fetcher {
 
     public HttpClientHandler(File file) throws FileNotFoundException {
       this.file = file;
+      this.raf = new RandomAccessFile(file, "rw");
+      this.fc = raf.getChannel();
     }
 
     @Override
     public void messageReceived(ChannelHandlerContext ctx, MessageEvent e)
         throws Exception {
+      messageReceiveCount++;
       try {
         if (!readingChunks) {
           HttpResponse response = (HttpResponse) e.getMessage();
@@ -180,12 +188,11 @@ public class Fetcher {
 
           if (response.getStatus() == HttpResponseStatus.NO_CONTENT) {
             LOG.info("There are no data corresponding to the request");
+            fc.close();
+            raf.close();
             return;
           }
 
-          this.raf = new RandomAccessFile(file, "rw");
-          this.fc = raf.getChannel();
-
           if (response.isChunked()) {
             readingChunks = true;
           } else {
@@ -208,6 +215,7 @@ public class Fetcher {
               LOG.info("Data fetch is done, but cannot get all data "
                   + "(received/total: " + fileLength + "/" + length + ")");
             }
+            finishTime = System.currentTimeMillis();
           } else {
             fc.write(chunk.getContent().toByteBuffer());
           }
@@ -216,7 +224,6 @@ public class Fetcher {
         if(raf != null) {
           fileLen = file.length();
         }
-        finishTime = System.currentTimeMillis();
       }
     }
   }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/a65f8a10/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 eff384b..820c883 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
@@ -463,6 +463,7 @@ public class Task {
           fetcherHistory.setStatus(eachFetcher.getStatus());
           fetcherHistory.setUri(eachFetcher.getURI().toString());
           fetcherHistory.setFileLen(eachFetcher.getFileLen());
+          fetcherHistory.setMessageReceiveCount(eachFetcher.getMessageReceiveCount());
 
           fetcherHistories.put(eachFetcher.getURI(), fetcherHistory);
         }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/a65f8a10/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/worker/TaskHistory.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/worker/TaskHistory.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/worker/TaskHistory.java
index efbd93b..2650c4a 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/worker/TaskHistory.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/worker/TaskHistory.java
@@ -40,6 +40,7 @@ public class TaskHistory {
     private String status;
     private String uri;
     private long fileLen;
+    private int messageReceiveCount;
 
     public long getStartTime() {
       return startTime;
@@ -80,6 +81,14 @@ public class TaskHistory {
     public void setFileLen(long fileLen) {
       this.fileLen = fileLen;
     }
+
+    public int getMessageReceiveCount() {
+      return messageReceiveCount;
+    }
+
+    public void setMessageReceiveCount(int messageReceiveCount) {
+      this.messageReceiveCount = messageReceiveCount;
+    }
   }
 
   public long getStartTime() {

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/a65f8a10/tajo-core/tajo-core-backend/src/main/resources/webapps/worker/taskdetail.jsp
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/resources/webapps/worker/taskdetail.jsp b/tajo-core/tajo-core-backend/src/main/resources/webapps/worker/taskdetail.jsp
index 86e63a5..4a64d0b 100644
--- a/tajo-core/tajo-core-backend/src/main/resources/webapps/worker/taskdetail.jsp
+++ b/tajo-core/tajo-core-backend/src/main/resources/webapps/worker/taskdetail.jsp
@@ -97,7 +97,7 @@
     <hr/>
     <h3>Fetch Status</h3>
     <table border="1" width="100%" class="border_table">
-        <tr><th>No</th><th>StartTime</th><th>FinishTime</th><th>RunTime</th><th>Status</th><th>File Length</th><th>URI</th></tr>
+        <tr><th>No</th><th>StartTime</th><th>FinishTime</th><th>RunTime</th><th>Status</th><th>File Length</th><th># Messages</th><th>URI</th></tr>
 <%
     int index = 1;
     for(TaskHistory.FetcherHistory eachFetcher: taskHistory.getFetchers()) {
@@ -109,6 +109,7 @@
             <td><%=JSPUtil.getElapsedTime(eachFetcher.getStartTime(), eachFetcher.getFinishTime())%></td>
             <td><%=eachFetcher.getStatus()%></td>
             <td align="right"><%=eachFetcher.getFileLen()%></td>
+            <td align="right"><%=eachFetcher.getMessageReceiveCount()%></td>
             <td><a href="<%=eachFetcher.getUri()%>"><%=eachFetcher.getUri()%></a></td>
         </tr>
 <%