Fixed Visor tasks.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c77fc84b Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c77fc84b Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c77fc84b Branch: refs/heads/ignite-gg-10837 Commit: c77fc84bdd6a232adabc9a8023c5746649941908 Parents: 1c302e4 Author: Alexey Kuznetsov <akuznet...@apache.org> Authored: Wed Jan 20 21:42:04 2016 +0700 Committer: Alexey Kuznetsov <akuznet...@apache.org> Committed: Wed Jan 20 21:42:04 2016 +0700 ---------------------------------------------------------------------- .../ignite/internal/visor/cache/VisorCache.java | 30 ++++----- .../visor/cache/VisorCacheConfiguration.java | 4 +- .../cache/VisorCacheQueryConfiguration.java | 15 +---- .../cache/VisorCacheQueryConfigurationV2.java | 47 ++++++++++++++ .../cache/VisorCacheStoreConfiguration.java | 13 +--- .../cache/VisorCacheStoreConfigurationV2.java | 48 +++++++++++++++ .../internal/visor/cache/VisorCacheV2.java | 64 ++++++++++++++++++++ .../visor/node/VisorIgfsConfiguration.java | 32 +++++++++- .../visor/node/VisorNodeDataCollectorJob.java | 5 +- .../visor/node/VisorNodeDataCollectorTask.java | 2 +- .../commands/cache/VisorCacheCommand.scala | 10 ++- 11 files changed, 220 insertions(+), 50 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/c77fc84b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java index 6def8c3..5c1382b 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java @@ -108,9 +108,6 @@ public class VisorCache implements Serializable { /** Cache partitions states. */ private GridDhtPartitionMap2 partitionsMap; - /** Flag indicating that cache has near cache. */ - private boolean near; - /** * @param ignite Grid. * @param cacheName Cache name. @@ -143,8 +140,6 @@ public class VisorCache implements Serializable { CacheConfiguration cfg = ca.configuration(); - near = ca.context().isNear(); - mode = cfg.getCacheMode(); boolean partitioned = (mode == CacheMode.PARTITIONED || mode == CacheMode.REPLICATED) @@ -259,11 +254,11 @@ public class VisorCache implements Serializable { } /** - * @return New instance suitable to store in history. + * Fill values that should be stored in history; + * + * @param c Source cache. */ - public VisorCache history() { - VisorCache c = new VisorCache(); - + protected void initHistory(VisorCache c) { c.name = name; c.mode = mode; c.memorySize = memorySize; @@ -280,7 +275,15 @@ public class VisorCache implements Serializable { c.primaryPartitions = Collections.emptyList(); c.backupPartitions = Collections.emptyList(); c.metrics = metrics; - c.near = near; + } + + /** + * @return New instance suitable to store in history. + */ + public VisorCache history() { + VisorCache c = new VisorCache(); + + initHistory(c); return c; } @@ -411,13 +414,6 @@ public class VisorCache implements Serializable { return partitionsMap; } - /** - * @return {@code true} if cache has near cache. - */ - public boolean near() { - return near; - } - /** {@inheritDoc} */ @Override public String toString() { return S.toString(VisorCache.class, this); http://git-wip-us.apache.org/repos/asf/ignite/blob/c77fc84b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java index 69eb311..b29f6d5 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java @@ -151,8 +151,8 @@ public class VisorCacheConfiguration implements Serializable { evictCfg = VisorCacheEvictionConfiguration.from(ccfg); nearCfg = VisorCacheNearConfiguration.from(ccfg); dfltCfg = VisorCacheDefaultConfiguration.from(ccfg); - storeCfg = VisorCacheStoreConfiguration.from(ignite, ccfg); - qryCfg = VisorCacheQueryConfiguration.from(ccfg); + storeCfg = new VisorCacheStoreConfiguration().from(ignite, ccfg); + qryCfg = new VisorCacheQueryConfiguration().from(ccfg); return this; } http://git-wip-us.apache.org/repos/asf/ignite/blob/c77fc84b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryConfiguration.java index a779db4..c00d211 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryConfiguration.java @@ -35,9 +35,6 @@ public class VisorCacheQueryConfiguration implements Serializable { private long longQryWarnTimeout; /** */ - private String sqlSchema; - - /** */ private boolean sqlEscapeAll; /** */ @@ -67,12 +64,11 @@ public class VisorCacheQueryConfiguration implements Serializable { * @param ccfg Cache configuration. * @return Fill data transfer object with cache query configuration data. */ - public static VisorCacheQueryConfiguration from(CacheConfiguration ccfg) { + public VisorCacheQueryConfiguration from(CacheConfiguration ccfg) { VisorCacheQueryConfiguration cfg = new VisorCacheQueryConfiguration(); cfg.sqlFuncClss = compactClasses(ccfg.getSqlFunctionClasses()); cfg.longQryWarnTimeout = ccfg.getLongQueryWarningTimeout(); - cfg.sqlSchema = ccfg.getSqlSchema(); cfg.sqlEscapeAll = ccfg.isSqlEscapeAll(); cfg.indexedTypes = compactClasses(ccfg.getIndexedTypes()); cfg.sqlOnheapRowCacheSize = ccfg.getSqlOnheapRowCacheSize(); @@ -95,13 +91,6 @@ public class VisorCacheQueryConfiguration implements Serializable { } /** - * @return Schema name, which is used by SQL engine for SQL statements generation. - */ - public String sqlSchema() { - return sqlSchema; - } - - /** * @return {@code true} if SQL engine generate SQL statements with escaped names. */ public boolean sqlEscapeAll() { @@ -121,4 +110,4 @@ public class VisorCacheQueryConfiguration implements Serializable { public int sqlOnheapRowCacheSize() { return sqlOnheapRowCacheSize; } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/c77fc84b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryConfigurationV2.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryConfigurationV2.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryConfigurationV2.java new file mode 100644 index 0000000..e914b73 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryConfigurationV2.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.visor.cache; + +import org.apache.ignite.configuration.CacheConfiguration; + +/** + * Data transfer object for cache query configuration data. + */ +public class VisorCacheQueryConfigurationV2 extends VisorCacheQueryConfiguration { + /** */ + private static final long serialVersionUID = 0L; + + /** */ + private String sqlSchema; + + /** + * @return Schema name, which is used by SQL engine for SQL statements generation. + */ + public String sqlSchema() { + return sqlSchema; + } + + /** {@inheritDoc} */ + @Override public VisorCacheQueryConfiguration from(CacheConfiguration ccfg) { + super.from(ccfg); + + sqlSchema = ccfg.getSqlSchema(); + + return this; + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/c77fc84b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStoreConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStoreConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStoreConfiguration.java index 38a419a..c152d76 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStoreConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStoreConfiguration.java @@ -65,15 +65,12 @@ public class VisorCacheStoreConfiguration implements Serializable { /** Number of threads that will perform cache flushing. */ private int flushThreadCnt; - /** Keep binary in store flag. */ - private boolean storeKeepBinary; - /** * @param ignite Ignite instance. * @param ccfg Cache configuration. * @return Data transfer object for cache store configuration properties. */ - public static VisorCacheStoreConfiguration from(IgniteEx ignite, CacheConfiguration ccfg) { + public VisorCacheStoreConfiguration from(IgniteEx ignite, CacheConfiguration ccfg) { VisorCacheStoreConfiguration cfg = new VisorCacheStoreConfiguration(); IgniteCacheProxy<Object, Object> c = ignite.context().cache().jcache(ccfg.getName()); @@ -84,7 +81,6 @@ public class VisorCacheStoreConfiguration implements Serializable { cfg.store = compactClass(store); cfg.storeFactory = compactClass(ccfg.getCacheStoreFactory()); - cfg.storeKeepBinary = ccfg.isStoreKeepBinary(); cfg.readThrough = ccfg.isReadThrough(); cfg.writeThrough = ccfg.isWriteThrough(); @@ -127,13 +123,6 @@ public class VisorCacheStoreConfiguration implements Serializable { } /** - * @return Keep binary in store flag. - */ - public boolean storeKeepBinary() { - return storeKeepBinary; - } - - /** * @return Whether cache should operate in read-through mode. */ public boolean readThrough() { http://git-wip-us.apache.org/repos/asf/ignite/blob/c77fc84b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStoreConfigurationV2.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStoreConfigurationV2.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStoreConfigurationV2.java new file mode 100644 index 0000000..8595177 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheStoreConfigurationV2.java @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.visor.cache; + +import org.apache.ignite.configuration.CacheConfiguration; +import org.apache.ignite.internal.IgniteEx; + +/** + * Data transfer object for cache store configuration properties. + */ +public class VisorCacheStoreConfigurationV2 extends VisorCacheStoreConfiguration { + /** */ + private static final long serialVersionUID = 0L; + + /** Keep binary in store flag. */ + private boolean storeKeepBinary; + + /** {@inheritDoc} */ + @Override public VisorCacheStoreConfiguration from(IgniteEx ignite, CacheConfiguration ccfg) { + super.from(ignite, ccfg); + + storeKeepBinary = ccfg.isStoreKeepBinary(); + + return this; + } + + /** + * @return Keep binary in store flag. + */ + public boolean storeKeepBinary() { + return storeKeepBinary; + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/c77fc84b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheV2.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheV2.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheV2.java new file mode 100644 index 0000000..a4b0409 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheV2.java @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.visor.cache; + +import org.apache.ignite.IgniteCache; +import org.apache.ignite.IgniteCheckedException; +import org.apache.ignite.internal.IgniteEx; +import org.apache.ignite.internal.processors.cache.GridCacheAdapter; + +/** + * Data transfer object for {@link IgniteCache}. + */ +public class VisorCacheV2 extends VisorCache { + /** */ + private static final long serialVersionUID = 0L; + + /** + * Flag indicating that cache has near cache. + */ + private boolean near; + + /** {@inheritDoc} */ + @Override public VisorCache from(IgniteEx ignite, String cacheName, int sample) throws IgniteCheckedException { + super.from(ignite, cacheName, sample); + + GridCacheAdapter ca = ignite.context().cache().internalCache(cacheName); + + // Cache was not started. + if (ca != null && ca.context().started()) + near = ca.context().isNear(); + + return this; + } + + /** {@inheritDoc} */ + @Override public void initHistory(VisorCache c) { + super.initHistory(c); + + if (c instanceof VisorCacheV2) + ((VisorCacheV2) c).near = near; + } + + /** + * @return {@code true} if cache has near cache. + */ + public boolean near() { + return near; + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/c77fc84b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorIgfsConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorIgfsConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorIgfsConfiguration.java index ea0e721..50917eb 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorIgfsConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorIgfsConfiguration.java @@ -62,6 +62,15 @@ public class VisorIgfsConfiguration implements Serializable { /** Number of batches that can be concurrently sent to remote node. */ private int perNodeParallelBatchCnt; + /** @deprecated Needed only for backward compatibility. */ + private String secondaryHadoopFileSysUri; + + /** @deprecated Needed only for backward compatibility. */ + private String secondaryHadoopFileSysCfgPath; + + /** @deprecated Needed only for backward compatibility. */ + private String secondaryHadoopFileSysUserName; + /** IGFS instance mode. */ private IgfsMode dfltMode; @@ -229,6 +238,27 @@ public class VisorIgfsConfiguration implements Serializable { } /** + * @deprecated Needed only for backward compatibility. + */ + @Nullable public String secondaryHadoopFileSystemUri() { + return secondaryHadoopFileSysUri; + } + + /** + * @deprecated Needed only for backward compatibility. + */ + @Nullable public String secondaryHadoopFileSystemUserName() { + return secondaryHadoopFileSysUserName; + } + + /** + * @deprecated Needed only for backward compatibility. + */ + @Nullable public String secondaryHadoopFileSystemConfigPath() { + return secondaryHadoopFileSysCfgPath; + } + + /** * @return IGFS instance mode. */ public IgfsMode defaultMode() { @@ -351,4 +381,4 @@ public class VisorIgfsConfiguration implements Serializable { @Override public String toString() { return S.toString(VisorIgfsConfiguration.class, this); } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/c77fc84b/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 1deabe5..a135b7a 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 @@ -28,6 +28,7 @@ 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; import org.apache.ignite.internal.visor.cache.VisorCache; +import org.apache.ignite.internal.visor.cache.VisorCacheV2; import org.apache.ignite.internal.visor.compute.VisorComputeMonitoringHolder; import org.apache.ignite.internal.visor.igfs.VisorIgfs; import org.apache.ignite.internal.visor.igfs.VisorIgfsEndpoint; @@ -130,7 +131,7 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa long start0 = U.currentTimeMillis(); try { - VisorCache cache = new VisorCache().from(ignite, cacheName, arg.sample()); + VisorCache cache = new VisorCacheV2().from(ignite, cacheName, arg.sample()); if (cache != null) res.caches().add(cache); @@ -230,4 +231,4 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa @Override public String toString() { return S.toString(VisorNodeDataCollectorJob.class, this); } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/c77fc84b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTask.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTask.java index 395cddb..494f902 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTask.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTask.java @@ -138,4 +138,4 @@ public class VisorNodeDataCollectorTask extends VisorMultiNodeTask<VisorNodeData if (jobRes.igfssEx() != null) taskRes.igfssEx().put(nid, new VisorExceptionWrapper(jobRes.igfssEx())); } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/c77fc84b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala ---------------------------------------------------------------------- diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala index 57f7066..13b4e32 100644 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala +++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala @@ -866,7 +866,10 @@ object VisorCacheCommand { cacheT += ("Store Enabled", bool2Str(storeCfg.enabled())) cacheT += ("Store Class", safe(storeCfg.store())) cacheT += ("Store Factory Class", storeCfg.storeFactory()) - cacheT += ("Store Keep Binary", storeCfg.storeKeepBinary()) + cacheT += ("Store Keep Binary", storeCfg match { + case cfg: VisorCacheStoreConfigurationV2 => cfg.storeKeepBinary() + case _ => false + }) cacheT += ("Store Read Through", bool2Str(storeCfg.readThrough())) cacheT += ("Store Write Through", bool2Str(storeCfg.writeThrough())) @@ -889,7 +892,10 @@ object VisorCacheCommand { cacheT += ("Expiry Policy Factory Class Name", safe(cfg.expiryPolicyFactory())) cacheT +=("Query Execution Time Threshold", queryCfg.longQueryWarningTimeout()) - cacheT +=("Query Schema Name", queryCfg.sqlSchema()) + cacheT +=("Query Schema Name", queryCfg match { + case cfg: VisorCacheQueryConfigurationV2 => cfg.sqlSchema() + case _ => null + }) cacheT +=("Query Escaped Names", bool2Str(queryCfg.sqlEscapeAll())) cacheT +=("Query Onheap Cache Size", queryCfg.sqlOnheapRowCacheSize())