[ https://issues.apache.org/jira/browse/IGNITE-3227?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15339657#comment-15339657 ]
Ilya Lantukh commented on IGNITE-3227: -------------------------------------- Hi [~saikatr], I don't think that implementation of GridCacheAdapter#localSizeLong(int partition, CachePeekMode[] peekModes) is correct. Currently it will count all local entries, even from other partitions. To obtain partition size, you should use GridDhtLocalPartition#publicSize() method. It also has methods to check whether partition is primary or backup for a given topology version. An instance of GridDhtLocalPartition can be accessed from GridCacheAdapter by calling {code}ctx.topology().localPartition(int p, AffinityTopologyVersion topVer, boolean create){code}. To count entries in swap and offheap, methods GridCacheSwapManager#swapEntriesCount(int partId) and GridCacheSwapManager#offheapEntriesCount(int partId) should be used, respectively. > 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)