[ 
https://issues.apache.org/jira/browse/YARN-5585?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15470338#comment-15470338
 ] 

Rohith Sharma K S commented on YARN-5585:
-----------------------------------------

One of the challenge for supporting fromId is to iterate in forward or 
backward? This dilemma is mainly due to TimelineEntity#compareTo implementation 
where in sorted in descending order if creation time is null otherwise sorted 
in ascending order of ID. 
Say entities from entity-1 to entity-10 then 
# If entities stored without creationtime, then getEntities has output 
ascending order of ID i.e enitity-1 to entity-10.
# If entities stored with creationtime, then getEntities has output descending 
order of ID i.e enitity-10 to entity-1.

When limit and fromId is applied on both the cases, the expected output changes 
respectively. 
Say limit=5 and fromId=entity-5 then in first case, user expect entity-6 to 
entity-10 because user has already got entity-1 to entity-5 on previous call. 
In second case, user expect entity-4 to entity-1. This is tedious task to 
differentiate between forward or backward iteration from storage level. 

I think anyway this can not be achieved from storage level because of async 
storage of entities. And this can be achieved at TimelineEntityReader having 
another loop. Cons is this would lead to another loop in the code. 

> [Atsv2] Add a new filter fromId in REST endpoints
> -------------------------------------------------
>
>                 Key: YARN-5585
>                 URL: https://issues.apache.org/jira/browse/YARN-5585
>             Project: Hadoop YARN
>          Issue Type: Sub-task
>          Components: timelinereader
>            Reporter: Rohith Sharma K S
>            Assignee: Rohith Sharma K S
>         Attachments: YARN-5585.v0.patch
>
>
> TimelineReader REST API's provides lot of filters to retrieve the 
> applications. Along with those, it would be good to add new filter i.e fromId 
> so that entities can be retrieved after the fromId. 
> Example : If applications are stored database, app-1 app-2 ... app-10.
> *getApps?limit=5* gives app-1 to app-10. But to retrieve next 5 apps, it is 
> difficult.
> So proposal is to have fromId in the filter like 
> *getApps?limit=5&&fromId=app-5* which gives list of apps from app-6 to 
> app-10. 
> This is very useful for pagination in web UI.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to