ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject ignite git commit: Fixed Visor tasks.
Date Thu, 21 Jan 2016 12:02:17 GMT
Repository: ignite
Updated Branches:
  refs/heads/master 4fa85a185 -> 340658d83


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/340658d8
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/340658d8
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/340658d8

Branch: refs/heads/master
Commit: 340658d83db3d8853127791797ba8a18740c4890
Parents: 4fa85a1
Author: Alexey Kuznetsov <akuznetsov@apache.org>
Authored: Thu Jan 21 19:02:08 2016 +0700
Committer: Alexey Kuznetsov <akuznetsov@apache.org>
Committed: Thu Jan 21 19:02:08 2016 +0700

----------------------------------------------------------------------
 .../ignite/internal/visor/cache/VisorCache.java | 12 +++++---
 .../visor/cache/VisorCacheConfiguration.java    | 31 +++++++++++++++-----
 .../visor/node/VisorNodeDataCollectorJob.java   | 18 +++++++++++-
 3 files changed, 49 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/340658d8/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 0e830e2..9115c0c 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
@@ -37,6 +37,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheA
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopology;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap2;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter;
 import org.apache.ignite.internal.util.lang.IgnitePair;
@@ -106,7 +107,7 @@ public class VisorCache implements Serializable {
     private VisorCacheMetrics metrics;
 
     /** Cache partitions states. */
-    private GridDhtPartitionMap2 partitionsMap;
+    private GridDhtPartitionMap partitionsMap;
 
     /**
      * @param ignite Grid.
@@ -156,8 +157,11 @@ public class VisorCache implements Serializable {
             if (dca != null) {
                 GridDhtPartitionTopology top = dca.topology();
 
-                if (cfg.getCacheMode() != CacheMode.LOCAL && cfg.getBackups() >
0)
-                    partitionsMap = top.localPartitionMap();
+                if (cfg.getCacheMode() != CacheMode.LOCAL && cfg.getBackups() >
0) {
+                    GridDhtPartitionMap2 map2 = top.localPartitionMap();
+
+                    partitionsMap = new GridDhtPartitionMap(map2.nodeId(), map2.updateSequence(),
map2.map());
+                }
 
                 List<GridDhtLocalPartition> parts = top.localPartitions();
 
@@ -411,7 +415,7 @@ public class VisorCache implements Serializable {
     /**
      * @return Cache partitions states.
      */
-    @Nullable public GridDhtPartitionMap2 partitionMap() {
+    @Nullable public GridDhtPartitionMap partitionMap() {
         return partitionsMap;
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/340658d8/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 b29f6d5..efa6740 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
@@ -28,6 +28,7 @@ import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.internal.IgniteEx;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.jetbrains.annotations.Nullable;
+import org.apache.ignite.lang.IgniteProductVersion;
 
 import static org.apache.ignite.internal.visor.util.VisorTaskUtils.compactClass;
 
@@ -38,19 +39,22 @@ public class VisorCacheConfiguration implements Serializable {
     /** */
     private static final long serialVersionUID = 0L;
 
+    /** */
+    private static final IgniteProductVersion VER_1_4_1 = IgniteProductVersion.fromString("1.4.1");
+
     /** Cache name. */
     private String name;
 
     /** Cache mode. */
     private CacheMode mode;
 
-    /** Cache atomicity mode */
+    /** Cache atomicity mode. */
     private CacheAtomicityMode atomicityMode;
 
     /** Cache atomicity write ordering mode. */
     private CacheAtomicWriteOrderMode atomicWriteOrderMode;
 
-    /** Eager ttl flag */
+    /** Eager ttl flag. */
     private boolean eagerTtl;
 
     /** Write synchronization mode. */
@@ -68,7 +72,7 @@ public class VisorCacheConfiguration implements Serializable {
     /** Off-heap max memory. */
     private long offHeapMaxMemory;
 
-    /** Max concurrent async operations */
+    /** Max concurrent async operations. */
     private int maxConcurrentAsyncOps;
 
     /** Memory mode. */
@@ -89,10 +93,10 @@ public class VisorCacheConfiguration implements Serializable {
     /** Near cache config. */
     private VisorCacheNearConfiguration nearCfg;
 
-    /** Default config */
+    /** Default config. */
     private VisorCacheDefaultConfiguration dfltCfg;
 
-    /** Store config */
+    /** Store config. */
     private VisorCacheStoreConfiguration storeCfg;
 
     /** Collection of type metadata. */
@@ -151,8 +155,21 @@ public class VisorCacheConfiguration implements Serializable {
         evictCfg = VisorCacheEvictionConfiguration.from(ccfg);
         nearCfg = VisorCacheNearConfiguration.from(ccfg);
         dfltCfg = VisorCacheDefaultConfiguration.from(ccfg);
-        storeCfg = new VisorCacheStoreConfiguration().from(ignite, ccfg);
-        qryCfg = new VisorCacheQueryConfiguration().from(ccfg);
+
+        boolean compatibility = false;
+
+        for (org.apache.ignite.cluster.ClusterNode node : ignite.cluster().nodes()) {
+            if (node.version().compareToIgnoreTimestamp(VER_1_4_1) <= 0) {
+                compatibility = true;
+
+                break;
+            }
+        }
+
+        storeCfg = (compatibility ? new VisorCacheStoreConfiguration() : new VisorCacheStoreConfigurationV2())
+                .from(ignite, ccfg);
+
+        qryCfg = (compatibility ? new VisorCacheQueryConfiguration() : new VisorCacheQueryConfigurationV2()).from(ccfg);
 
         return this;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/340658d8/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 a135b7a..f996d9a 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
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.visor.node;
 import java.util.Collection;
 import java.util.concurrent.ConcurrentMap;
 import org.apache.ignite.IgniteFileSystem;
+import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.processors.cache.GridCacheProcessor;
 import org.apache.ignite.internal.processors.igfs.IgfsProcessorAdapter;
@@ -32,6 +33,7 @@ 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;
+import org.apache.ignite.lang.IgniteProductVersion;
 
 import static org.apache.ignite.internal.processors.cache.GridCacheUtils.isIgfsCache;
 import static org.apache.ignite.internal.processors.cache.GridCacheUtils.isSystemCache;
@@ -48,6 +50,9 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
     /** */
     private static final long serialVersionUID = 0L;
 
+    /** */
+    private static final IgniteProductVersion VER_1_4_1 = IgniteProductVersion.fromString("1.4.1");
+
     /**
      * Create job with given argument.
      *
@@ -131,7 +136,18 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
                     long start0 = U.currentTimeMillis();
 
                     try {
-                        VisorCache cache = new VisorCacheV2().from(ignite, cacheName, arg.sample());
+                        boolean compatibility = false;
+
+                        for (ClusterNode node : ignite.cluster().nodes()) {
+                            if (node.version().compareToIgnoreTimestamp(VER_1_4_1) <=
0) {
+                                compatibility = true;
+
+                                break;
+                            }
+                        }
+
+                        VisorCache cache = (compatibility ? new VisorCache() : new VisorCacheV2())
+                                .from(ignite, cacheName, arg.sample());
 
                         if (cache != null)
                             res.caches().add(cache);


Mime
View raw message