Repository: ignite Updated Branches: refs/heads/ignite-gg-13195-cache-groups [created] 914ad3c7a
GG-13195 WIP on groups support. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/914ad3c7 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/914ad3c7 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/914ad3c7 Branch: refs/heads/ignite-gg-13195-cache-groups Commit: 914ad3c7a5b3e961d80e6b9fd91ef59195be7954 Parents: 4817944 Author: Alexey Kuznetsov <akuznet...@apache.org> Authored: Fri Jul 27 17:11:42 2018 +0700 Committer: Alexey Kuznetsov <akuznet...@apache.org> Committed: Fri Jul 27 17:11:42 2018 +0700 ---------------------------------------------------------------------- .../visor/node/VisorNodeDataCollectorJob.java | 8 +++- .../node/VisorNodeDataCollectorTaskArg.java | 47 ++++++++++++++++++-- 2 files changed, 51 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/914ad3c7/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java index 14b9281..5d9eddd 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java @@ -32,6 +32,7 @@ import org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeMan import org.apache.ignite.internal.processors.cache.GridCacheProcessor; import org.apache.ignite.internal.processors.igfs.IgfsProcessorAdapter; import org.apache.ignite.internal.util.ipc.IpcServerEndpoint; +import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.internal.S; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.internal.visor.VisorJob; @@ -187,6 +188,10 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa double total = 0; double ready = 0; + String cacheGrp = arg.getCacheGroup(); + + boolean collectByGroup = cacheGrp != null; + for (String cacheName : cacheProc.cacheNames()) { if (proxyCache(cacheName)) continue; @@ -213,7 +218,8 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa total += partTotal; ready += partReady; - resCaches.add(new VisorCache(ignite, ca, arg.isCollectCacheMetrics())); + if (!collectByGroup || F.eq(cacheGrp, ca.configuration().getGroupName())) + resCaches.add(new VisorCache(ignite, ca, arg.isCollectCacheMetrics())); } catch(IllegalStateException | IllegalArgumentException e) { if (debug && ignite.log() != null) http://git-wip-us.apache.org/repos/asf/ignite/blob/914ad3c7/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskArg.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskArg.java index 1876d06..a583792 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskArg.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskArg.java @@ -46,6 +46,9 @@ public class VisorNodeDataCollectorTaskArg extends VisorDataTransferObject { /** If {@code false} then cache metrics will not be collected. */ private boolean collectCacheMetrics; + /** Optional cache group, if provided, then caches only from that group will be collected. */ + private String cacheGrp; + /** * Default constructor. */ @@ -61,19 +64,40 @@ public class VisorNodeDataCollectorTaskArg extends VisorDataTransferObject { * @param evtThrottleCntrKey Event throttle counter key, unique for Visor instance. * @param sysCaches If {@code true} then collect information about system caches. * @param collectCacheMetrics If {@code false} then cache metrics will not be collected. + * @param cacheGrp Optional cache group, if provided, then caches only from that group will be collected. */ public VisorNodeDataCollectorTaskArg( boolean taskMonitoringEnabled, String evtOrderKey, String evtThrottleCntrKey, boolean sysCaches, - boolean collectCacheMetrics + boolean collectCacheMetrics, + String cacheGrp ) { this.taskMonitoringEnabled = taskMonitoringEnabled; this.evtOrderKey = evtOrderKey; this.evtThrottleCntrKey = evtThrottleCntrKey; this.sysCaches = sysCaches; this.collectCacheMetrics = collectCacheMetrics; + this.cacheGrp = cacheGrp; + } + /** + * Create task arguments with given parameters. + * + * @param taskMonitoringEnabled If {@code true} then Visor should collect information about tasks. + * @param evtOrderKey Event order key, unique for Visor instance. + * @param evtThrottleCntrKey Event throttle counter key, unique for Visor instance. + * @param sysCaches If {@code true} then collect information about system caches. + * @param collectCacheMetrics If {@code false} then cache metrics will not be collected. + */ + public VisorNodeDataCollectorTaskArg( + boolean taskMonitoringEnabled, + String evtOrderKey, + String evtThrottleCntrKey, + boolean sysCaches, + boolean collectCacheMetrics + ) { + this(taskMonitoringEnabled, evtOrderKey, evtThrottleCntrKey, sysCaches, true, null); } /** @@ -90,7 +114,7 @@ public class VisorNodeDataCollectorTaskArg extends VisorDataTransferObject { String evtThrottleCntrKey, boolean sysCaches ) { - this(taskMonitoringEnabled, evtOrderKey, evtThrottleCntrKey, sysCaches, true); + this(taskMonitoringEnabled, evtOrderKey, evtThrottleCntrKey, sysCaches, true, null); } /** @@ -163,9 +187,23 @@ public class VisorNodeDataCollectorTaskArg extends VisorDataTransferObject { this.collectCacheMetrics = collectCacheMetrics; } + /** + * @return Optional cache group, if provided, then caches only from that group will be collected. + */ + public String getCacheGroup() { + return cacheGrp; + } + + /** + * @param cacheGrp Optional cache group, if provided, then caches only from that group will be collected. + */ + public void setCollectCacheMetrics(String cacheGrp) { + this.cacheGrp = cacheGrp; + } + /** {@inheritDoc} */ @Override public byte getProtocolVersion() { - return V2; + return V3; } /** {@inheritDoc} */ @@ -175,6 +213,7 @@ public class VisorNodeDataCollectorTaskArg extends VisorDataTransferObject { U.writeString(out, evtThrottleCntrKey); out.writeBoolean(sysCaches); out.writeBoolean(collectCacheMetrics); + U.writeString(out, cacheGrp); } /** {@inheritDoc} */ @@ -185,6 +224,8 @@ public class VisorNodeDataCollectorTaskArg extends VisorDataTransferObject { sysCaches = in.readBoolean(); collectCacheMetrics = protoVer < V2 || in.readBoolean(); + + cacheGrp = protoVer < V3 ? null : U.readString(in); } /** {@inheritDoc} */