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

Meng Zhu edited comment on MESOS-9242 at 9/8/19 5:25 AM:
---------------------------------------------------------

Another seemingly possible fix is to store shared items as individual objects 
in the Resources list e.g. 60 disk resources that got shared twice could have 
two resource with shared info set. However, this has a confusing problem when 
doing arithmetics: if we add another addable 60 shared disk, should it be kept 
as a distinct object or combine scalar value with the same object?

Looks like we have to live with the count. However, returning `sharedCount` 
number of a resource object in the iterator also seems less than ideal. It 
would go against caller's assumption that resource objects are unique. For 
example, when calculating total scalar quantities, one would expect to simply 
add scalars with the same resource name together.

A better solution seems to expose the shared count i.e. get rid of the 
`Resource_` wrapper and put `shared_count` as a field in the Resource 
SharedInfo proto message.


was (Author: mzhu):
Another seemingly possible fix is to store shared items as individual objects 
in the Resources list e.g. 60 disk resources that got shared twice could have 
two resource with shared info set. However, this has a confusing problem when 
doing arithmetics: if we add another addable 60 shared disk, should it be kept 
as a distinct object or combine scalar value with the same object?

Looks like we have to live with the count.

> Resources wrapper loses shared resource count information.
> ----------------------------------------------------------
>
>                 Key: MESOS-9242
>                 URL: https://issues.apache.org/jira/browse/MESOS-9242
>             Project: Mesos
>          Issue Type: Bug
>          Components: allocation
>            Reporter: Benjamin Mahler
>            Assignee: Meng Zhu
>            Priority: Major
>              Labels: resource-management
>
> The Resources wrapper stores a {{Resource_}} wrapper type that stores 
> multiple copies of the a shared resource in a single {{Resource_}} with a 
> shared count.
> On the output paths Resources, we lose the shared counts since we convert 
> {{Resource_}} directly back into a single {{Resource}}, even if the shared 
> count was > 1.
> We need to fix this in the following:
> * Implicit cast operator back to repeated ptr field of resource, this is easy 
> to adjust.
> * Resource iteration, since we only expose const iteration, it should be 
> possible to use an iterator adaptor to return the shared resource {{count}} 
> times rather than just once when there are multiple copies.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

Reply via email to