Junping Du commented on YARN-3431:

Thanks [~zjshen] for delivering a updated patch to fix it! 
The solution here looks good to me in general. Some comments:
In HierarchicalTimelineEntity.java,
+  public ClusterEntity(TimelineEntity entity) {
+    super(entity);
+    if (!entity.getType().equals(TimelineEntityType.YARN_CLUSTER.toString())) {
+      throw new IllegalArgumentException("Incompatible entity type: " + 
+    }
+  }
Sounds like a serious bug here: we have subclass of HierarchicalTimelineEntity, 
it will call the type check in sub class and parent class when doing 
construction. There is always exception get thrown here. We should find some 
way to figure it out. e.g. adding a boolean value of check type?

+  public TimelineEntity(TimelineEntity entity) {
+    prototype = entity.getPrototype();
+  }
+  protected TimelineEntity getPrototype() {
+    return prototype == null ? this : prototype;
+  }
I think we have a prototype TimelineEntity here to create a TimelineEntity 
object from a subclass object of TimelineEnity. Isn't it? If so, I don't 
understand what benefit we gain comparing with type casting directly. Am I 
missing something here? 

> Sub resources of timeline entity needs to be passed to a separate endpoint.
> ---------------------------------------------------------------------------
>                 Key: YARN-3431
>                 URL: https://issues.apache.org/jira/browse/YARN-3431
>             Project: Hadoop YARN
>          Issue Type: Sub-task
>          Components: timelineserver
>            Reporter: Zhijie Shen
>            Assignee: Zhijie Shen
>         Attachments: YARN-3431.1.patch, YARN-3431.2.patch, YARN-3431.3.patch
> We have TimelineEntity and some other entities as subclass that inherit from 
> it. However, we only have a single endpoint, which consume TimelineEntity 
> rather than sub-classes and this endpoint will check the incoming request 
> body contains exactly TimelineEntity object. However, the json data which is 
> serialized from sub-class object seems not to be treated as an TimelineEntity 
> object, and won't be deserialized into the corresponding sub-class object 
> which cause deserialization failure as some discussions in YARN-3334 : 
> https://issues.apache.org/jira/browse/YARN-3334?focusedCommentId=14391059&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14391059.

This message was sent by Atlassian JIRA

Reply via email to