[GitHub] [ignite] nizhikov commented on a change in pull request #6738: IGNITE-12027 NPE on try to read the MinimumNumberOfPartitionCopies metric.
nizhikov commented on a change in pull request #6738: IGNITE-12027 NPE on try to read the MinimumNumberOfPartitionCopies metric. URL: https://github.com/apache/ignite/pull/6738#discussion_r324658886 ## File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java ## @@ -428,6 +428,9 @@ protected DataRegionMetricsProvider dataRegionMetricsProvider(final DataRegionCo private CacheFreeList freeList; private CacheFreeList getFreeList() { +if (freeListMap == null) Review comment: This change will break something. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [ignite] nizhikov commented on a change in pull request #6738: IGNITE-12027 NPE on try to read the MinimumNumberOfPartitionCopies metric.
nizhikov commented on a change in pull request #6738: IGNITE-12027 NPE on try to read the MinimumNumberOfPartitionCopies metric. URL: https://github.com/apache/ignite/pull/6738#discussion_r324658886 ## File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java ## @@ -428,6 +428,9 @@ protected DataRegionMetricsProvider dataRegionMetricsProvider(final DataRegionCo private CacheFreeList freeList; private CacheFreeList getFreeList() { +if (freeListMap == null) Review comment: This change will break something. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [ignite] nizhikov commented on a change in pull request #6738: IGNITE-12027 NPE on try to read the MinimumNumberOfPartitionCopies metric.
nizhikov commented on a change in pull request #6738: IGNITE-12027 NPE on try to read the MinimumNumberOfPartitionCopies metric. URL: https://github.com/apache/ignite/pull/6738#discussion_r324635677 ## File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupMetricsImpl.java ## @@ -59,6 +60,12 @@ /** */ private final LongAdderMetric groupPageAllocationTracker; +/** */ +private volatile LongMetric storageSize; + +/** */ +private volatile LongMetric sparseStorageSize; Review comment: Why this variable is volatile? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [ignite] nizhikov commented on a change in pull request #6738: IGNITE-12027 NPE on try to read the MinimumNumberOfPartitionCopies metric.
nizhikov commented on a change in pull request #6738: IGNITE-12027 NPE on try to read the MinimumNumberOfPartitionCopies metric. URL: https://github.com/apache/ignite/pull/6738#discussion_r324635651 ## File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupMetricsImpl.java ## @@ -59,6 +60,12 @@ /** */ private final LongAdderMetric groupPageAllocationTracker; +/** */ +private volatile LongMetric storageSize; Review comment: Why this variable is volatile? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [ignite] nizhikov commented on a change in pull request #6738: IGNITE-12027 NPE on try to read the MinimumNumberOfPartitionCopies metric.
nizhikov commented on a change in pull request #6738: IGNITE-12027 NPE on try to read the MinimumNumberOfPartitionCopies metric. URL: https://github.com/apache/ignite/pull/6738#discussion_r324627634 ## File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupMetricsImpl.java ## @@ -126,13 +133,22 @@ public CacheGroupMetricsImpl(CacheGroupContext ctx) { this::getTotalAllocatedSize, "Total size of memory allocated for group, in bytes."); -mreg.register("StorageSize", -this::getStorageSize, -"Storage space allocated for group, in bytes."); +if (ctx.shared().database() instanceof GridCacheDatabaseSharedManager) { +mreg.register("StorageSize", +() -> database().forGroupPageStores(ctx, PageStore::size), +"Storage space allocated for group, in bytes."); -mreg.register("SparseStorageSize", -this::getSparseStorageSize, -"Storage space allocated for group adjusted for possible sparsity, in bytes."); +mreg.register("SparseStorageSize", +() -> database().forGroupPageStores(ctx, PageStore::getSparseSize), +"Storage space allocated for group adjusted for possible sparsity, in bytes."); + +storageSize = mreg.findMetric("StorageSize"); +sparseStorageSize = mreg.findMetric("SparseStorageSize"); +} +else { +storageSize = new AtomicLongMetric("NO_OP", null); Review comment: I think it can be reworked as `storageSize == null ? 0 : storageSize.longValue()`. Let's do it? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [ignite] nizhikov commented on a change in pull request #6738: IGNITE-12027 NPE on try to read the MinimumNumberOfPartitionCopies metric.
nizhikov commented on a change in pull request #6738: IGNITE-12027 NPE on try to read the MinimumNumberOfPartitionCopies metric. URL: https://github.com/apache/ignite/pull/6738#discussion_r324616851 ## File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupMetricsImpl.java ## @@ -126,13 +133,22 @@ public CacheGroupMetricsImpl(CacheGroupContext ctx) { this::getTotalAllocatedSize, "Total size of memory allocated for group, in bytes."); -mreg.register("StorageSize", -this::getStorageSize, -"Storage space allocated for group, in bytes."); +if (ctx.shared().database() instanceof GridCacheDatabaseSharedManager) { Review comment: Let's create `isPDSEnabled` method instead of direct usage `instanceof` operator This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [ignite] nizhikov commented on a change in pull request #6738: IGNITE-12027 NPE on try to read the MinimumNumberOfPartitionCopies metric.
nizhikov commented on a change in pull request #6738: IGNITE-12027 NPE on try to read the MinimumNumberOfPartitionCopies metric. URL: https://github.com/apache/ignite/pull/6738#discussion_r324617035 ## File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupMetricsImpl.java ## @@ -126,13 +133,22 @@ public CacheGroupMetricsImpl(CacheGroupContext ctx) { this::getTotalAllocatedSize, "Total size of memory allocated for group, in bytes."); -mreg.register("StorageSize", -this::getStorageSize, -"Storage space allocated for group, in bytes."); +if (ctx.shared().database() instanceof GridCacheDatabaseSharedManager) { +mreg.register("StorageSize", +() -> database().forGroupPageStores(ctx, PageStore::size), +"Storage space allocated for group, in bytes."); -mreg.register("SparseStorageSize", -this::getSparseStorageSize, -"Storage space allocated for group adjusted for possible sparsity, in bytes."); +mreg.register("SparseStorageSize", +() -> database().forGroupPageStores(ctx, PageStore::getSparseSize), +"Storage space allocated for group adjusted for possible sparsity, in bytes."); + +storageSize = mreg.findMetric("StorageSize"); +sparseStorageSize = mreg.findMetric("SparseStorageSize"); +} +else { +storageSize = new AtomicLongMetric("NO_OP", null); Review comment: Why do we need this `NO_OP` metrics? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [ignite] nizhikov commented on a change in pull request #6738: IGNITE-12027 NPE on try to read the MinimumNumberOfPartitionCopies metric.
nizhikov commented on a change in pull request #6738: IGNITE-12027 NPE on try to read the MinimumNumberOfPartitionCopies metric. URL: https://github.com/apache/ignite/pull/6738#discussion_r323239575 ## File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupMetricsImpl.java ## @@ -444,11 +472,25 @@ public void remove() { * @return Database. */ private GridCacheDatabaseSharedManager database() { +if (!(ctx.shared().database() instanceof GridCacheDatabaseSharedManager)) +return null; + return (GridCacheDatabaseSharedManager)ctx.shared().database(); } /** @return Metric group name. */ private String metricGroupName() { return metricName(CACHE_GROUP_METRICS_PREFIX, ctx.cacheOrGroupName()); } + +/** @return {@code True} if topology started. */ +private boolean isTopologyStarted() { Review comment: We should implement this method different. Let's add to the `CacheGroupContext` following method: ``` public boolean isTopologyStarted() { return top == null; } ``` This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services