Browse Source

HADOOP-2216. Fix jobtasks.jsp to ensure that it first collects the taskids which satisfy the filtering criteria and then use that list to print out only the required task-reports, previously it was oblivious to the filtering and hence used the wrong index into the array of task-reports. Contributed by Amar Kamat.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@597626 13f79535-47bb-0310-9956-ffa450edef68
Arun Murthy 17 năm trước cách đây
mục cha
commit
2d192c222b
2 tập tin đã thay đổi với 19 bổ sung10 xóa
  1. 6 0
      CHANGES.txt
  2. 13 10
      src/webapps/job/jobtasks.jsp

+ 6 - 0
CHANGES.txt

@@ -143,6 +143,12 @@ Trunk (unreleased changes)
     incorporating the jobid. Also adds a test-case for JobControl vis-a-vis the 
     LocalJobRunner. (Adrian Woodhead via acmurthy)
 
+    HADOOP-2216.  Fix jobtasks.jsp to ensure that it first collects the
+    taskids which satisfy the filtering criteria and then use that list to
+    print out only the required task-reports, previously it was oblivious to
+    the filtering and hence used the wrong index into the array of task-reports. 
+    (Amar Kamat via acmurthy)
+
 
 Release 0.15.1 - 2007-11-27
 

+ 13 - 10
src/webapps/job/jobtasks.jsp

@@ -57,17 +57,20 @@
   }
   // Filtering the reports if some filter is specified
   if (!"all".equals(state)) {
+    List<String> filteredReportsTaskIds = new ArrayList<String>();
     List<TaskReport> filteredReports = new ArrayList<TaskReport>();
-    for (int i = 0; i < reports.length; ++i) {
-      if ("completed".equals(state) && tasks[i].isComplete()) {
-        filteredReports.add(reports[i]);
-      } else if ("running".equals(state) && tasks[i].isRunning()) {
-        filteredReports.add(reports[i]);
-      } else if ("killed".equals(state) && tasks[i].wasKilled()) {
-        filteredReports.add(reports[i]);
-      } else if ("pending".equals(state) 
-                 && !(tasks[i].isComplete() || tasks[i].isRunning() 
-                      || tasks[i].wasKilled())) {
+    for (int i = 0; i < tasks.length; ++i) {
+      if (("completed".equals(state) && tasks[i].isComplete()) 
+          || ("running".equals(state) && tasks[i].isRunning()) 
+          || ("killed".equals(state) && tasks[i].wasKilled()) 
+          || ("pending".equals(state)  && !(tasks[i].isComplete() 
+                                            || tasks[i].isRunning() 
+                                            || tasks[i].wasKilled()))) {
+        filteredReportsTaskIds.add(tasks[i].getTIPId());
+      }
+    }
+    for (int i = 0 ; i < reports.length; ++i) {
+      if (filteredReportsTaskIds.contains(reports[i].getTaskId())) {
         filteredReports.add(reports[i]);
       }
     }