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

Ilya Lantukh commented on IGNITE-3227:
--------------------------------------

Hi [~samaitra],

I have a few comments regarding GridCacheAdapter#localSizeLong(int partition, 
CachePeekMode[] peekModes) implementation:

1. When you obtain an instance of GridDhtLocalPartition:
        {code}GridDhtLocalPartition gridDthLocalPartition = 
ctx.topology().localPartition(partition, topVer, true);{code}
I think it's better to set create flag (last parameter) to false, and in case 
it returns null assume that publicSize() == 0.

2. When you check partition for being primary or backup:
{code}    if (modes.primary && gridDthLocalPartition.primary(topVer)) {
        size += gridDthLocalPartition.publicSize();
    }
    if (modes.backup && gridDthLocalPartition.backup(topVer)) {
        size += gridDthLocalPartition.publicSize();
    }{code}
These conditions are mutually exclusive. Please use "else if".

> IgniteCache: add method to calculate size per partition
> -------------------------------------------------------
>
>                 Key: IGNITE-3227
>                 URL: https://issues.apache.org/jira/browse/IGNITE-3227
>             Project: Ignite
>          Issue Type: Improvement
>            Reporter: Denis Magda
>            Assignee: Saikat Maitra
>              Labels: community, important
>
> It makes sense to add size calculation per partition. Actually the following 
> methods should be added to the {{IgniteCache}} API.
> {code}
> public int size(int partition, CachePeekMode... peekModes) throws 
> CacheException;
> public int localSize(int partition, CachePeekMode... peekModes);
> {code}



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

Reply via email to