Repository: hadoop
Updated Branches:
  refs/heads/branch-2.7 feefa57e4 -> 991461340


MAPREDUCE-7133. History Server task attempts REST API returns invalid data. 
Contributed by Oleksandr Shevchenko

(cherry picked from commit 2886024ac3a8613ecc27f1595b278ce6fc2d03ba)


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

Branch: refs/heads/branch-2.7
Commit: 991461340a79733123d7bbf83168f29157136f38
Parents: feefa57
Author: Jason Lowe <jl...@apache.org>
Authored: Thu Sep 13 15:07:18 2018 -0500
Committer: Jason Lowe <jl...@apache.org>
Committed: Thu Sep 13 15:07:18 2018 -0500

----------------------------------------------------------------------
 hadoop-mapreduce-project/CHANGES.txt                         | 3 +++
 .../hadoop/mapreduce/v2/app/webapp/dao/TaskAttemptsInfo.java | 8 +++++---
 .../mapreduce/v2/app/webapp/TestAMWebServicesAttempts.java   | 3 +++
 .../src/site/markdown/MapredAppMasterRest.md                 | 2 +-
 4 files changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/99146134/hadoop-mapreduce-project/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/CHANGES.txt 
b/hadoop-mapreduce-project/CHANGES.txt
index cb5571c..bd15b99 100644
--- a/hadoop-mapreduce-project/CHANGES.txt
+++ b/hadoop-mapreduce-project/CHANGES.txt
@@ -16,6 +16,9 @@ Release 2.7.8 - UNRELEASED
     files from intermediate to finished but thinks file is in
     intermediate. (Anthony Hsu via jlowe)
 
+    MAPREDUCE-7133. History Server task attempts REST API returns invalid
+    data. (Oleksandr Shevchenko via jlowe)
+
 Release 2.7.7 - 2018-07-18
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/99146134/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/webapp/dao/TaskAttemptsInfo.java
----------------------------------------------------------------------
diff --git 
a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/webapp/dao/TaskAttemptsInfo.java
 
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/webapp/dao/TaskAttemptsInfo.java
index c92488f..6f188d9 100644
--- 
a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/webapp/dao/TaskAttemptsInfo.java
+++ 
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/webapp/dao/TaskAttemptsInfo.java
@@ -19,12 +19,10 @@ package org.apache.hadoop.mapreduce.v2.app.webapp.dao;
 
 import java.util.ArrayList;
 
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElementRef;
 import javax.xml.bind.annotation.XmlRootElement;
 
 @XmlRootElement(name = "taskAttempts")
-@XmlAccessorType(XmlAccessType.FIELD)
 public class TaskAttemptsInfo {
 
   protected ArrayList<TaskAttemptInfo> taskAttempt = new 
ArrayList<TaskAttemptInfo>();
@@ -36,6 +34,10 @@ public class TaskAttemptsInfo {
     taskAttempt.add(taskattemptInfo);
   }
 
+  // XmlElementRef annotation should be used to identify the exact type of a 
list element
+  // otherwise metadata will be added to XML attributes,
+  // it can lead to incorrect JSON marshaling
+  @XmlElementRef
   public ArrayList<TaskAttemptInfo> getTaskAttempts() {
     return taskAttempt;
   }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/99146134/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/webapp/TestAMWebServicesAttempts.java
----------------------------------------------------------------------
diff --git 
a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/webapp/TestAMWebServicesAttempts.java
 
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/webapp/TestAMWebServicesAttempts.java
index dcd5d29..fb00dbb 100644
--- 
a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/webapp/TestAMWebServicesAttempts.java
+++ 
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/webapp/TestAMWebServicesAttempts.java
@@ -20,6 +20,7 @@
 package org.apache.hadoop.mapreduce.v2.app.webapp;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
@@ -477,6 +478,8 @@ public class TestAMWebServicesAttempts extends JerseyTest {
       Boolean found = false;
       for (int i = 0; i < nodes.getLength(); i++) {
         Element element = (Element) nodes.item(i);
+        assertFalse("task attempt should not contain any attributes, it can 
lead to incorrect JSON marshaling",
+            element.hasAttributes());
 
         if (attid.matches(WebServicesTestUtils.getXmlString(element, "id"))) {
           found = true;

http://git-wip-us.apache.org/repos/asf/hadoop/blob/99146134/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/site/markdown/MapredAppMasterRest.md
----------------------------------------------------------------------
diff --git 
a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/site/markdown/MapredAppMasterRest.md
 
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/site/markdown/MapredAppMasterRest.md
index d49c231..c96da9e 100644
--- 
a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/site/markdown/MapredAppMasterRest.md
+++ 
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/site/markdown/MapredAppMasterRest.md
@@ -1888,7 +1888,7 @@ Response Body:
 
     <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
     <taskAttempts>
-      <taskAttempt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:type="reduceTaskAttemptInfo">
+      <taskAttempt>
         <startTime>1326238777460</startTime>
         <finishTime>0</finishTime>
         <elapsedTime>0</elapsedTime>


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-commits-h...@hadoop.apache.org

Reply via email to