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

Nanda kumar commented on HDFS-12751:
------------------------------------

[~vagarychen] & [~anu], thanks for getting this done and sorry for commenting 
this late.
I reviewed the patch and it looks very good to me, I have a couple of minor 
concerns which we can discuss and if needed we can create follow up jiras.

1. Getting all the containers from {{ContainerStateManager}} for updating 
allocated bytes.
We can just get the list of open containers and update allocated bytes, there 
is no need to update the value of containers in other states. I know the 
current data-structure in which we store the container information doesn't 
support such APIs, we still have HDFS-12522 and HDFS-12520 open for that.
For closed containers, we can update the value while closing them.

2. Exposing setter method for allocated bytes - {{setAllocatedBytes}}.
Since {{ContainerInfo}} is exposed to the client; someone who is using SCM's 
container protocol will get {{ContainerInfo}} from SCM, I feel that we should 
make {{ContainerInfo}} immutable.
I know there is a {{allocate}} method which will modify allocated bytes (so we 
really can't make it immutable), the reason for having {{allocate}} method 
rather than having {{setAllocatedBytes}} is that {{allocate}} method will give 
us some control on how the value is getting modified. With 
{{setAllocatedBytes}} I can set it to any value (even negative values).
For this same reason {{updateContainerState}} recreates the {{ContainerInfo}} 
using builder rather than having {{setState}} method in {{ContainerInfo}}.
If a user queries and gets {{ContainerInfo}} from SCM, we should see to that 
the {{ContainerInfo}} object is not easily modifiable at client side (by some 
bug in client code)

> Ozone: SCM: update container allocated size to container db for all the open 
> containers in ContainerStateManager#close
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: HDFS-12751
>                 URL: https://issues.apache.org/jira/browse/HDFS-12751
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>          Components: ozone
>            Reporter: Nanda kumar
>            Assignee: Chen Liang
>             Fix For: HDFS-7240
>
>         Attachments: HDFS-12751-HDFS-7240.001.patch, 
> HDFS-12751-HDFS-7240.002.patch
>
>
> Container allocated size is maintained in memory by 
> {{ContainerStateManager}}, this has to be updated in container db when we 
> shutdown SCM. {{ContainerStateManager#close}} will be called during SCM 
> shutdown, so updating allocated size for all the open containers should be 
> done here.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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

Reply via email to