ignite-4535 : Fixed DHT cache size calculation. (cherry picked from commit 06c845c)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/952c0efd Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/952c0efd Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/952c0efd Branch: refs/heads/ignite-3477-master Commit: 952c0efd12d2b90b3b519a999ae0fd6935b84274 Parents: 0756bb8 Author: Ilya Lantukh <[email protected]> Authored: Fri Mar 24 14:30:00 2017 +0300 Committer: Ilya Lantukh <[email protected]> Committed: Thu Mar 30 16:20:52 2017 +0300 ---------------------------------------------------------------------- .../cache/distributed/dht/GridDhtCacheAdapter.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/952c0efd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java index e85dcf7..7e6ae81 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java @@ -569,6 +569,21 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap } /** {@inheritDoc} */ + @Override public int size() { + return (int)sizeLong(); + } + + /** {@inheritDoc} */ + @Override public long sizeLong() { + long sum = 0; + + for (GridDhtLocalPartition p : topology().currentLocalPartitions()) + sum += p.dataStore().size(); + + return sum; + } + + /** {@inheritDoc} */ @Override public int primarySize() { return (int)primarySizeLong(); } @@ -581,7 +596,7 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap for (GridDhtLocalPartition p : topology().currentLocalPartitions()) { if (p.primary(topVer)) - sum += p.publicSize(); + sum += p.dataStore().size(); } return sum;
