You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by se...@apache.org on 2015/06/10 00:21:23 UTC

[01/14] incubator-ignite git commit: # IGNITE-992 Review.

Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-484-1 d48525c62 -> ef50a38b8


# IGNITE-992 Review.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/662f7337
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/662f7337
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/662f7337

Branch: refs/heads/ignite-484-1
Commit: 662f7337f7d03f94373f4ebd083d308823aff50c
Parents: a5b5ec7
Author: AKuznetsov <ak...@gridgain.com>
Authored: Mon Jun 8 16:44:25 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Mon Jun 8 16:44:25 2015 +0700

----------------------------------------------------------------------
 .../internal/util/IgniteExceptionRegistry.java  |  7 +-
 .../visor/node/VisorNodeDataCollectorTask.java  |  9 ++-
 .../node/VisorNodeDataCollectorTaskResult.java  | 17 +++--
 .../internal/visor/query/VisorQueryJob.java     | 11 +--
 .../internal/visor/query/VisorQueryTask.java    |  3 +-
 .../visor/util/VisorExceptionWrapper.java       | 78 ++++++++++++++++++++
 .../internal/visor/util/VisorTaskUtils.java     | 10 +++
 7 files changed, 114 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/662f7337/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteExceptionRegistry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteExceptionRegistry.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteExceptionRegistry.java
index ab113d7..a56570a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteExceptionRegistry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteExceptionRegistry.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.util;
 import org.apache.ignite.*;
 import org.apache.ignite.internal.util.tostring.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.internal.visor.util.*;
 
 import java.io.*;
 import java.util.*;
@@ -160,7 +161,7 @@ public class IgniteExceptionRegistry {
 
         /** */
         @GridToStringExclude
-        private final Throwable error;
+        private final VisorExceptionWrapper error;
 
         /** */
         private final long threadId;
@@ -186,7 +187,7 @@ public class IgniteExceptionRegistry {
          */
         public ExceptionInfo(long order, Throwable error, String msg, long threadId, String threadName, long time) {
             this.order = order;
-            this.error = error;
+            this.error = VisorTaskUtils.wrap(error);
             this.threadId = threadId;
             this.threadName = threadName;
             this.time = time;
@@ -210,7 +211,7 @@ public class IgniteExceptionRegistry {
         /**
          * @return Suppressed error.
          */
-        public Throwable error() {
+        public VisorExceptionWrapper error() {
             return error;
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/662f7337/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 fde871b..7dbfd39 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
@@ -23,6 +23,7 @@ import org.apache.ignite.compute.*;
 import org.apache.ignite.internal.processors.task.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.internal.visor.*;
+import org.apache.ignite.internal.visor.util.*;
 import org.jetbrains.annotations.*;
 
 import java.util.*;
@@ -87,7 +88,7 @@ public class VisorNodeDataCollectorTask extends VisorMultiNodeTask<VisorNodeData
                 else {
                     // Ignore nodes that left topology.
                     if (!(unhandledEx instanceof ClusterGroupEmptyException))
-                        taskRes.unhandledEx().put(nid, unhandledEx);
+                        taskRes.unhandledEx().put(nid, VisorTaskUtils.wrap(unhandledEx));
                 }
             }
         }
@@ -116,13 +117,13 @@ public class VisorNodeDataCollectorTask extends VisorMultiNodeTask<VisorNodeData
             taskRes.events().addAll(jobRes.events());
 
         if (jobRes.eventsEx() != null)
-            taskRes.eventsEx().put(nid, jobRes.eventsEx());
+            taskRes.eventsEx().put(nid, VisorTaskUtils.wrap(jobRes.eventsEx()));
 
         if (!jobRes.caches().isEmpty())
             taskRes.caches().put(nid, jobRes.caches());
 
         if (jobRes.cachesEx() != null)
-            taskRes.cachesEx().put(nid, jobRes.cachesEx());
+            taskRes.cachesEx().put(nid, VisorTaskUtils.wrap(jobRes.cachesEx()));
 
         if (!jobRes.igfss().isEmpty())
             taskRes.igfss().put(nid, jobRes.igfss());
@@ -131,6 +132,6 @@ public class VisorNodeDataCollectorTask extends VisorMultiNodeTask<VisorNodeData
             taskRes.igfsEndpoints().put(nid, jobRes.igfsEndpoints());
 
         if (jobRes.igfssEx() != null)
-            taskRes.igfssEx().put(nid, jobRes.igfssEx());
+            taskRes.igfssEx().put(nid, VisorTaskUtils.wrap(jobRes.igfssEx()));
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/662f7337/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java
index 6485978..1a4eb02 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.visor.node;
 import org.apache.ignite.internal.visor.cache.*;
 import org.apache.ignite.internal.visor.event.*;
 import org.apache.ignite.internal.visor.igfs.*;
+import org.apache.ignite.internal.visor.util.*;
 
 import java.io.*;
 import java.util.*;
@@ -32,7 +33,7 @@ public class VisorNodeDataCollectorTaskResult implements Serializable {
     private static final long serialVersionUID = 0L;
 
     /** Unhandled exceptions from nodes. */
-    private final Map<UUID, Throwable> unhandledEx = new HashMap<>();
+    private final Map<UUID, VisorExceptionWrapper> unhandledEx = new HashMap<>();
 
     /** Nodes grid names. */
     private final Map<UUID, String> gridNames = new HashMap<>();
@@ -50,13 +51,13 @@ public class VisorNodeDataCollectorTaskResult implements Serializable {
     private final List<VisorGridEvent> evts = new ArrayList<>();
 
     /** Exceptions caught during collecting events from nodes. */
-    private final Map<UUID, Throwable> evtsEx = new HashMap<>();
+    private final Map<UUID, VisorExceptionWrapper> evtsEx = new HashMap<>();
 
     /** All caches collected from nodes. */
     private final Map<UUID, Collection<VisorCache>> caches = new HashMap<>();
 
     /** Exceptions caught during collecting caches from nodes. */
-    private final Map<UUID, Throwable> cachesEx = new HashMap<>();
+    private final Map<UUID, VisorExceptionWrapper> cachesEx = new HashMap<>();
 
     /** All IGFS collected from nodes. */
     private final Map<UUID, Collection<VisorIgfs>> igfss = new HashMap<>();
@@ -65,7 +66,7 @@ public class VisorNodeDataCollectorTaskResult implements Serializable {
     private final Map<UUID, Collection<VisorIgfsEndpoint>> igfsEndpoints = new HashMap<>();
 
     /** Exceptions caught during collecting IGFS from nodes. */
-    private final Map<UUID, Throwable> igfssEx = new HashMap<>();
+    private final Map<UUID, VisorExceptionWrapper> igfssEx = new HashMap<>();
 
     /**
      * @return {@code true} If no data was collected.
@@ -88,7 +89,7 @@ public class VisorNodeDataCollectorTaskResult implements Serializable {
     /**
      * @return Unhandled exceptions from nodes.
      */
-    public Map<UUID, Throwable> unhandledEx() {
+    public Map<UUID, VisorExceptionWrapper> unhandledEx() {
         return unhandledEx;
     }
 
@@ -123,7 +124,7 @@ public class VisorNodeDataCollectorTaskResult implements Serializable {
     /**
      * @return Exceptions caught during collecting events from nodes.
      */
-    public Map<UUID, Throwable> eventsEx() {
+    public Map<UUID, VisorExceptionWrapper> eventsEx() {
         return evtsEx;
     }
 
@@ -137,7 +138,7 @@ public class VisorNodeDataCollectorTaskResult implements Serializable {
     /**
      * @return Exceptions caught during collecting caches from nodes.
      */
-    public Map<UUID, Throwable> cachesEx() {
+    public Map<UUID, VisorExceptionWrapper> cachesEx() {
         return cachesEx;
     }
 
@@ -158,7 +159,7 @@ public class VisorNodeDataCollectorTaskResult implements Serializable {
     /**
      * @return Exceptions caught during collecting IGFS from nodes.
      */
-    public Map<UUID, Throwable> igfssEx() {
+    public Map<UUID, VisorExceptionWrapper> igfssEx() {
         return igfssEx;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/662f7337/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java
index 8915240..82555cc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java
@@ -24,6 +24,7 @@ import org.apache.ignite.internal.processors.query.*;
 import org.apache.ignite.internal.processors.timeout.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.internal.visor.*;
+import org.apache.ignite.internal.visor.util.*;
 import org.apache.ignite.lang.*;
 
 import javax.cache.*;
@@ -36,7 +37,7 @@ import static org.apache.ignite.internal.visor.query.VisorQueryUtils.*;
 /**
  * Job for execute SCAN or SQL query and get first page of results.
  */
-public class VisorQueryJob extends VisorJob<VisorQueryArg, IgniteBiTuple<? extends Exception, VisorQueryResultEx>> {
+public class VisorQueryJob extends VisorJob<VisorQueryArg, IgniteBiTuple<? extends VisorExceptionWrapper, VisorQueryResultEx>> {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -61,7 +62,7 @@ public class VisorQueryJob extends VisorJob<VisorQueryArg, IgniteBiTuple<? exten
     }
 
     /** {@inheritDoc} */
-    @Override protected IgniteBiTuple<? extends Exception, VisorQueryResultEx> run(VisorQueryArg arg) {
+    @Override protected IgniteBiTuple<? extends VisorExceptionWrapper, VisorQueryResultEx> run(VisorQueryArg arg) {
         try {
             UUID nid = ignite.localNode().id();
 
@@ -110,8 +111,8 @@ public class VisorQueryJob extends VisorJob<VisorQueryArg, IgniteBiTuple<? exten
                 Collection<GridQueryFieldMetadata> meta = cur.fieldsMeta();
 
                 if (meta == null)
-                    return new IgniteBiTuple<Exception, VisorQueryResultEx>(
-                        new SQLException("Fail to execute query. No metadata available."), null);
+                    return new IgniteBiTuple<>(
+                        VisorTaskUtils.wrap(new SQLException("Fail to execute query. No metadata available.")), null);
                 else {
                     List<VisorQueryField> names = new ArrayList<>(meta.size());
 
@@ -138,7 +139,7 @@ public class VisorQueryJob extends VisorJob<VisorQueryArg, IgniteBiTuple<? exten
             }
         }
         catch (Exception e) {
-            return new IgniteBiTuple<>(e, null);
+            return new IgniteBiTuple<>(VisorTaskUtils.wrap(e), null);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/662f7337/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTask.java
index 4f2fda5..98c876a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTask.java
@@ -19,13 +19,14 @@ package org.apache.ignite.internal.visor.query;
 
 import org.apache.ignite.internal.processors.task.*;
 import org.apache.ignite.internal.visor.*;
+import org.apache.ignite.internal.visor.util.*;
 import org.apache.ignite.lang.*;
 
 /**
  * Task for execute SCAN or SQL query and get first page of results.
  */
 @GridInternal
-public class VisorQueryTask extends VisorOneNodeTask<VisorQueryArg, IgniteBiTuple<? extends Exception, VisorQueryResultEx>> {
+public class VisorQueryTask extends VisorOneNodeTask<VisorQueryArg, IgniteBiTuple<? extends VisorExceptionWrapper, VisorQueryResultEx>> {
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/662f7337/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorExceptionWrapper.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorExceptionWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorExceptionWrapper.java
new file mode 100644
index 0000000..be6f63c
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorExceptionWrapper.java
@@ -0,0 +1,78 @@
+/*
+ * 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.util;
+
+/**
+ * Wrapper of exceptions for transferring to Visor with absent exception classes.
+ */
+public class VisorExceptionWrapper extends Throwable {
+    /** Detail message string of this throwable */
+    private String detailMsg;
+
+    /** Simple class name of original throwable */
+    private String originalName;
+
+    /** Full class name of original throwable */
+    private String fullName;
+
+    /**
+     * Wrap throwable by presented on Visor throwable object.
+     *
+     * @param cause Base throwable object.
+     */
+    public VisorExceptionWrapper(Throwable cause) {
+        assert cause != null;
+
+        originalName = cause.getClass().getSimpleName();
+        fullName = cause.getClass().getName();
+
+        detailMsg = cause.getMessage();
+
+        StackTraceElement[] stackTrace = cause.getStackTrace();
+
+        if (stackTrace != null)
+            setStackTrace(stackTrace);
+
+        if (cause.getCause() != null)
+            initCause(new VisorExceptionWrapper(cause.getCause()));
+    }
+
+    /**
+     * @return Simple name of base throwable object.
+     */
+    public String getOriginalName() {
+        return originalName;
+    }
+
+    /**
+     * @return Full name of base throwable object.
+     */
+    public String getFullName() {
+        return fullName;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getMessage() {
+        return detailMsg;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return (detailMsg != null) ? (fullName + ": " + detailMsg) : fullName;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/662f7337/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
index e8ae76d..b0afbc9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
@@ -867,4 +867,14 @@ public class VisorTaskUtils {
 
         return bos.toByteArray();
     }
+
+    /**
+     * Wrap throwable object of any type to presented on Visor throwable object.
+     *
+     * @param e Base throwable object.
+     * @return Wrapped throwable object.
+     */
+    public static VisorExceptionWrapper wrap(Throwable e) {
+        return new VisorExceptionWrapper(e);
+    }
 }


[05/14] incubator-ignite git commit: # IGNITE-992 Review.

Posted by se...@apache.org.
# IGNITE-992 Review.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/8740b6e7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/8740b6e7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/8740b6e7

Branch: refs/heads/ignite-484-1
Commit: 8740b6e76107eeb2885e9454f670044edf11e619
Parents: e934bca
Author: AKuznetsov <ak...@gridgain.com>
Authored: Tue Jun 9 12:20:23 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Tue Jun 9 12:20:23 2015 +0700

----------------------------------------------------------------------
 .../internal/util/IgniteExceptionRegistry.java     |  7 +++----
 .../visor/node/VisorNodeSuppressedErrorsTask.java  | 12 +++++++++++-
 .../internal/visor/util/VisorExceptionWrapper.java | 17 ++++++++++-------
 3 files changed, 24 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8740b6e7/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteExceptionRegistry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteExceptionRegistry.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteExceptionRegistry.java
index 8ad3348..ab113d7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteExceptionRegistry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteExceptionRegistry.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.util;
 import org.apache.ignite.*;
 import org.apache.ignite.internal.util.tostring.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.internal.visor.util.*;
 
 import java.io.*;
 import java.util.*;
@@ -161,7 +160,7 @@ public class IgniteExceptionRegistry {
 
         /** */
         @GridToStringExclude
-        private final VisorExceptionWrapper error;
+        private final Throwable error;
 
         /** */
         private final long threadId;
@@ -187,7 +186,7 @@ public class IgniteExceptionRegistry {
          */
         public ExceptionInfo(long order, Throwable error, String msg, long threadId, String threadName, long time) {
             this.order = order;
-            this.error = new VisorExceptionWrapper(error);
+            this.error = error;
             this.threadId = threadId;
             this.threadName = threadName;
             this.time = time;
@@ -211,7 +210,7 @@ public class IgniteExceptionRegistry {
         /**
          * @return Suppressed error.
          */
-        public VisorExceptionWrapper error() {
+        public Throwable error() {
             return error;
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8740b6e7/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeSuppressedErrorsTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeSuppressedErrorsTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeSuppressedErrorsTask.java
index 8b39d09..9fc1cc4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeSuppressedErrorsTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeSuppressedErrorsTask.java
@@ -22,6 +22,7 @@ import org.apache.ignite.internal.processors.task.*;
 import org.apache.ignite.internal.util.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.internal.visor.*;
+import org.apache.ignite.internal.visor.util.*;
 import org.apache.ignite.lang.*;
 import org.jetbrains.annotations.*;
 
@@ -83,12 +84,21 @@ public class VisorNodeSuppressedErrorsTask extends VisorMultiNodeTask<Map<UUID,
 
             List<IgniteExceptionRegistry.ExceptionInfo> errors = ignite.context().exceptionRegistry().getErrors(order);
 
+            List<IgniteExceptionRegistry.ExceptionInfo> wrapped = new ArrayList<>(errors.size());
+
             for (IgniteExceptionRegistry.ExceptionInfo error : errors) {
                 if (error.order() > order)
                     order = error.order();
+
+                wrapped.add(new IgniteExceptionRegistry.ExceptionInfo(error.order(),
+                    new VisorExceptionWrapper(error.error()),
+                    error.message(),
+                    error.threadId(),
+                    error.threadName(),
+                    error.time()));
             }
 
-            return new IgniteBiTuple<>(order, errors);
+            return new IgniteBiTuple<>(order, wrapped);
         }
 
         /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8740b6e7/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorExceptionWrapper.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorExceptionWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorExceptionWrapper.java
index e253dcf..d2ae0e1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorExceptionWrapper.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorExceptionWrapper.java
@@ -21,14 +21,17 @@ package org.apache.ignite.internal.visor.util;
  * Exception wrapper for safe for transferring to Visor.
  */
 public class VisorExceptionWrapper extends Throwable {
+    /** */
+    private static final long serialVersionUID = 0L;
+
     /** Detail message string of this throwable */
     private String detailMsg;
 
     /** Simple class name of base throwable object. */
-    private String classSimpleName;
+    private String clsSimpleName;
 
     /** Class name of base throwable object. */
-    private String className;
+    private String clsName;
 
     /**
      * Wrap throwable by presented on Visor throwable object.
@@ -38,8 +41,8 @@ public class VisorExceptionWrapper extends Throwable {
     public VisorExceptionWrapper(Throwable cause) {
         assert cause != null;
 
-        classSimpleName = cause.getClass().getSimpleName();
-        className = cause.getClass().getName();
+        clsSimpleName = cause.getClass().getSimpleName();
+        clsName = cause.getClass().getName();
 
         detailMsg = cause.getMessage();
 
@@ -56,14 +59,14 @@ public class VisorExceptionWrapper extends Throwable {
      * @return Class simple name of base throwable object.
      */
     public String getClassSimpleName() {
-        return classSimpleName;
+        return clsSimpleName;
     }
 
     /**
      * @return Class name of base throwable object.
      */
     public String getClassName() {
-        return className;
+        return clsName;
     }
 
     /** {@inheritDoc} */
@@ -73,6 +76,6 @@ public class VisorExceptionWrapper extends Throwable {
 
     /** {@inheritDoc} */
     @Override public String toString() {
-        return (detailMsg != null) ? (className + ": " + detailMsg) : className;
+        return (detailMsg != null) ? (clsName + ": " + detailMsg) : clsName;
     }
 }


[07/14] incubator-ignite git commit: # ignite-sprint-5 added clientMode flag in node start message

Posted by se...@apache.org.
# ignite-sprint-5 added clientMode flag in node start message


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/e7d8b5ab
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e7d8b5ab
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e7d8b5ab

Branch: refs/heads/ignite-484-1
Commit: e7d8b5abf922a69edd7a4a17d15a6d4ded8075b8
Parents: 14bb076
Author: sboikov <sb...@gridgain.com>
Authored: Tue Jun 9 11:35:46 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Jun 9 11:35:46 2015 +0300

----------------------------------------------------------------------
 .../src/main/java/org/apache/ignite/internal/IgniteKernal.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e7d8b5ab/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 1c12402..4f5e365 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -1550,7 +1550,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
                     ">>> Grid name: " + gridName + NL +
                     ">>> Local node [" +
                     "ID=" + locNode.id().toString().toUpperCase() +
-                    ", order=" + locNode.order() +
+                    ", order=" + locNode.order() + ", clientMode=" + ctx.clientNode() +
                     "]" + NL +
                     ">>> Local node addresses: " + U.addressesAsString(locNode) + NL +
                     ">>> Local ports: " + sb + NL;


[06/14] incubator-ignite git commit: # ignite-883

Posted by se...@apache.org.
# ignite-883


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/eb0e2db5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/eb0e2db5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/eb0e2db5

Branch: refs/heads/ignite-484-1
Commit: eb0e2db5718d36693952bad897fcd31bae74d37d
Parents: 14bb076
Author: sboikov <sb...@gridgain.com>
Authored: Tue Jun 9 10:02:24 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Jun 9 10:11:58 2015 +0300

----------------------------------------------------------------------
 .../processors/affinity/GridAffinityAssignment.java   | 12 ++++++++++++
 .../affinity/GridAffinityAssignmentCache.java         |  4 ++--
 .../dht/atomic/GridNearAtomicUpdateFuture.java        |  6 +++++-
 .../preloader/GridDhtPartitionsExchangeFuture.java    | 14 +++++++++-----
 4 files changed, 28 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/eb0e2db5/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignment.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignment.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignment.java
index e9df8b8..5373e46 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignment.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignment.java
@@ -68,6 +68,18 @@ class GridAffinityAssignment implements Serializable {
     }
 
     /**
+     * @param topVer Topology version.
+     * @param aff Assignment to copy from.
+     */
+    GridAffinityAssignment(AffinityTopologyVersion topVer, GridAffinityAssignment aff) {
+        this.topVer = topVer;
+
+        assignment = aff.assignment;
+        primary = aff.primary;
+        backup = aff.backup;
+    }
+
+    /**
      * @return Affinity assignment.
      */
     public List<List<ClusterNode>> assignment() {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/eb0e2db5/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java
index 0969a57..c46490e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java
@@ -235,7 +235,7 @@ public class GridAffinityAssignmentCache {
         assert evt.type() == EVT_DISCOVERY_CUSTOM_EVT  || aff.primaryPartitions(evt.eventNode().id()).isEmpty() : evt;
         assert evt.type() == EVT_DISCOVERY_CUSTOM_EVT  || aff.backupPartitions(evt.eventNode().id()).isEmpty() : evt;
 
-        GridAffinityAssignment assignmentCpy = new GridAffinityAssignment(topVer, aff.assignment());
+        GridAffinityAssignment assignmentCpy = new GridAffinityAssignment(topVer, aff);
 
         affCache.put(topVer, assignmentCpy);
         head.set(assignmentCpy);
@@ -244,7 +244,7 @@ public class GridAffinityAssignmentCache {
             if (entry.getKey().compareTo(topVer) <= 0) {
                 if (log.isDebugEnabled())
                     log.debug("Completing topology ready future (use previous affinity) " +
-                            "[locNodeId=" + ctx.localNodeId() + ", futVer=" + entry.getKey() + ", topVer=" + topVer + ']');
+                        "[locNodeId=" + ctx.localNodeId() + ", futVer=" + entry.getKey() + ", topVer=" + topVer + ']');
 
                 entry.getValue().onDone(topVer);
             }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/eb0e2db5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
index 55cc027..07f5ecf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
@@ -463,7 +463,11 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
                 if (waitTopFut) {
                     fut.listen(new CI1<IgniteInternalFuture<AffinityTopologyVersion>>() {
                         @Override public void apply(IgniteInternalFuture<AffinityTopologyVersion> t) {
-                            mapOnTopology(keys, remap, oldNodeId, waitTopFut);
+                            cctx.kernalContext().closure().runLocalSafe(new Runnable() {
+                                @Override public void run() {
+                                    mapOnTopology(keys, remap, oldNodeId, waitTopFut);
+                                }
+                            });
                         }
                     });
                 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/eb0e2db5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index 05f5eaf..9f18c98 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -976,14 +976,18 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
 
     /** {@inheritDoc} */
     @Override public boolean onDone(AffinityTopologyVersion res, Throwable err) {
-        Map<Integer, Boolean> m = new HashMap<>();
+        Map<Integer, Boolean> m = null;
 
         for (GridCacheContext cacheCtx : cctx.cacheContexts()) {
-            if (cacheCtx.config().getTopologyValidator() != null && !CU.isSystemCache(cacheCtx.name()))
+            if (cacheCtx.config().getTopologyValidator() != null && !CU.isSystemCache(cacheCtx.name())) {
+                if (m == null)
+                    m = new HashMap<>();
+
                 m.put(cacheCtx.cacheId(), cacheCtx.config().getTopologyValidator().validate(discoEvt.topologyNodes()));
+            }
         }
 
-        cacheValidRes = m;
+        cacheValidRes = m != null ? m : Collections.<Integer, Boolean>emptyMap();
 
         cctx.cache().onExchangeDone(exchId.topologyVersion(), reqs, err);
 
@@ -1001,8 +1005,8 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
             if (timeoutObj != null)
                 cctx.kernalContext().timeout().removeTimeoutObject(timeoutObj);
 
-            for (GridCacheContext cacheCtx : cctx.cacheContexts()) {
-                if (exchId.event() == EventType.EVT_NODE_FAILED || exchId.event() == EventType.EVT_NODE_LEFT)
+            if (exchId.isLeft()) {
+                for (GridCacheContext cacheCtx : cctx.cacheContexts())
                     cacheCtx.config().getAffinity().removeNode(exchId.nodeId());
             }
 


[09/14] incubator-ignite git commit: #sberb-23: Get caused exception for indexed entity in offheap mode. Add test for bug

Posted by se...@apache.org.
#sberb-23: Get caused exception for indexed entity in offheap mode.
Add test for bug


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/638dd313
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/638dd313
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/638dd313

Branch: refs/heads/ignite-484-1
Commit: 638dd313eded4946adcf3dc3d309db1c59ae8ce3
Parents: 410c1d7
Author: ivasilinets <iv...@gridgain.com>
Authored: Tue Jun 9 12:13:51 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Tue Jun 9 12:13:51 2015 +0300

----------------------------------------------------------------------
 .../cache/GridCacheOffheapIndexGetSelfTest.java | 62 +++++++++++++++++++-
 1 file changed, 61 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/638dd313/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffheapIndexGetSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffheapIndexGetSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffheapIndexGetSelfTest.java
index 41eb45a..4e613ae 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffheapIndexGetSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffheapIndexGetSelfTest.java
@@ -19,14 +19,17 @@ package org.apache.ignite.internal.processors.cache;
 
 import org.apache.ignite.*;
 import org.apache.ignite.cache.query.*;
+import org.apache.ignite.cache.query.annotations.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.spi.discovery.tcp.*;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
 import org.apache.ignite.spi.swapspace.file.*;
 import org.apache.ignite.testframework.junits.common.*;
+import org.apache.ignite.transactions.*;
 
 import javax.cache.*;
+import java.io.*;
 import java.util.*;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.*;
@@ -71,7 +74,7 @@ public class GridCacheOffheapIndexGetSelfTest extends GridCommonAbstractTest {
         cacheCfg.setAtomicityMode(TRANSACTIONAL);
         cacheCfg.setMemoryMode(OFFHEAP_TIERED);
         cacheCfg.setEvictionPolicy(null);
-        cacheCfg.setIndexedTypes(Long.class, Long.class);
+        cacheCfg.setIndexedTypes(Long.class, Long.class, String.class, TestEntity.class);
 
         cfg.setCacheConfiguration(cacheCfg);
 
@@ -120,4 +123,61 @@ public class GridCacheOffheapIndexGetSelfTest extends GridCommonAbstractTest {
             assertNotNull(e.getValue());
         }
     }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPutGet() throws Exception {
+        IgniteCache<Object, Object> cache = grid(0).cache(null);
+
+        Map map = new HashMap();
+
+        try (Transaction tx = grid(0).transactions().txStart(TransactionConcurrency.PESSIMISTIC,
+            TransactionIsolation.REPEATABLE_READ, 100000, 1000)) {
+
+            for (int i = 4; i < 400; i++) {
+                map.put("key" + i, new TestEntity("value"));
+                map.put(i, "value");
+            }
+
+            cache.putAll(map);
+
+            tx.commit();
+        }
+
+        for (int i = 0; i < 100; i++) {
+            cache.get("key" + i);
+            cache.get(i);
+        }
+    }
+
+    /**
+     * Test entry class.
+     */
+    private static class TestEntity implements Serializable {
+        /** Value. */
+        @QuerySqlField(index = true)
+        private String val;
+
+        /**
+         * @param value Value.
+         */
+        public TestEntity(String value) {
+            this.val = value;
+        }
+
+        /**
+         * @return Value.
+         */
+        public String getValue() {
+            return val;
+        }
+
+        /**
+         * @param val Value
+         */
+        public void setValue(String val) {
+            this.val = val;
+        }
+    }
 }


[12/14] incubator-ignite git commit: ignite-1002 Inject Ignite before applying predicate

Posted by se...@apache.org.
ignite-1002 Inject Ignite before applying predicate


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/91104a29
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/91104a29
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/91104a29

Branch: refs/heads/ignite-484-1
Commit: 91104a29bc32b6d73e7bf4c70eafa9f777b62352
Parents: e3fe8ce
Author: agura <ag...@gridgain.com>
Authored: Mon Jun 8 18:41:43 2015 +0300
Committer: agura <ag...@gridgain.com>
Committed: Tue Jun 9 20:17:33 2015 +0300

----------------------------------------------------------------------
 .../continuous/GridContinuousProcessor.java     |   2 +
 .../util/nio/GridNioDelimitedBuffer.java        |   2 +-
 .../nio/GridNioDelimitedBufferSelfTest.java     | 112 +++++++++++++++++++
 .../util/nio/GridNioDelimitedBufferTest.java    | 112 -------------------
 .../stream/socket/SocketStreamerSelfTest.java   |  29 ++---
 .../ignite/testsuites/IgniteBasicTestSuite.java |   1 +
 .../testsuites/IgniteStreamSelfTestSuite.java   |  39 +++++++
 .../testsuites/IgniteStreamTestSuite.java       |  39 -------
 .../testsuites/IgniteUtilSelfTestSuite.java     |   2 +-
 9 files changed, 168 insertions(+), 170 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/91104a29/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
index 67b32a6..38d970b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
@@ -710,6 +710,8 @@ public class GridContinuousProcessor extends GridProcessorAdapter {
             try {
                 IgnitePredicate<ClusterNode> prjPred = data.projectionPredicate();
 
+                ctx.resource().injectGeneric(prjPred);
+
                 if (prjPred == null || prjPred.apply(ctx.discovery().node(ctx.localNodeId()))) {
                     registered = registerHandler(node.id(), routineId, hnd, data.bufferSize(), data.interval(),
                         data.autoUnsubscribe(), false);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/91104a29/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioDelimitedBuffer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioDelimitedBuffer.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioDelimitedBuffer.java
index 2b764ec..44ab4a5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioDelimitedBuffer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioDelimitedBuffer.java
@@ -85,7 +85,7 @@ public class GridNioDelimitedBuffer {
                         idx++;
                     }
                     else {
-                        pos = cnt - idx;
+                        pos = cnt - (i - pos) - 1;
 
                         idx = 0;
                     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/91104a29/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioDelimitedBufferSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioDelimitedBufferSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioDelimitedBufferSelfTest.java
new file mode 100644
index 0000000..cbf7d89
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioDelimitedBufferSelfTest.java
@@ -0,0 +1,112 @@
+/*
+ * 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.util.nio;
+
+import junit.framework.TestCase;
+
+import java.nio.*;
+import java.util.*;
+
+/**
+ * Tests for {@link GridNioDelimitedBuffer}.
+ */
+public class GridNioDelimitedBufferSelfTest extends TestCase {
+    /** */
+    private static final String ASCII = "ASCII";
+
+    /**
+     * Tests simple delimiter (excluded from alphabet)
+     */
+    public void testReadZString() throws Exception {
+        Random rnd = new Random();
+
+        int buffSize = 0;
+
+        byte[] delim = new byte[] {0};
+
+        List<String> strs = new ArrayList<>(50);
+
+        for (int i = 0; i < 50; i++) {
+            int len = rnd.nextInt(128) + 1;
+
+            buffSize += len + delim.length;
+
+            StringBuilder sb = new StringBuilder(len);
+
+            for (int j = 0; j < len; j++)
+                sb.append((char)(rnd.nextInt(26) + 'a'));
+
+
+            strs.add(sb.toString());
+        }
+
+        ByteBuffer buff = ByteBuffer.allocate(buffSize);
+
+        for (String str : strs) {
+            buff.put(str.getBytes(ASCII));
+            buff.put(delim);
+        }
+
+        buff.flip();
+
+        byte[] msg;
+
+        GridNioDelimitedBuffer delimBuff = new GridNioDelimitedBuffer(delim);
+
+        List<String> res = new ArrayList<>(strs.size());
+
+        while ((msg = delimBuff.read(buff)) != null)
+            res.add(new String(msg, ASCII));
+
+        assertEquals(strs, res);
+    }
+
+    /**
+     * Tests compound delimiter (included to alphabet)
+     */
+    public void testDelim() throws Exception {
+        byte[] delim = "aabb".getBytes(ASCII);
+
+        List<String> strs = Arrays.asList("za", "zaa", "zaab", "zab", "zaabaababbbbabaab");
+
+        int buffSize = 0;
+
+        for (String str : strs)
+            buffSize += str.length() + delim.length;
+
+        ByteBuffer buff = ByteBuffer.allocate(buffSize);
+
+        for (String str : strs) {
+            buff.put(str.getBytes(ASCII));
+            buff.put(delim);
+        }
+
+        buff.flip();
+
+        byte[] msg;
+
+        GridNioDelimitedBuffer delimBuff = new GridNioDelimitedBuffer(delim);
+
+        List<String> res = new ArrayList<>(strs.size());
+
+        while ((msg = delimBuff.read(buff)) != null)
+            res.add(new String(msg, ASCII));
+
+        assertEquals(strs, res);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/91104a29/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioDelimitedBufferTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioDelimitedBufferTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioDelimitedBufferTest.java
deleted file mode 100644
index a0dd2e5..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioDelimitedBufferTest.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * 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.util.nio;
-
-import junit.framework.TestCase;
-
-import java.nio.*;
-import java.util.*;
-
-/**
- * Tests for {@link GridNioDelimitedBuffer}.
- */
-public class GridNioDelimitedBufferTest extends TestCase {
-    /** */
-    private static final String ASCII = "ASCII";
-
-    /**
-     * Tests simple delimiter (excluded from alphabet)
-     */
-    public void testReadZString() throws Exception {
-        Random rnd = new Random();
-
-        int buffSize = 0;
-
-        byte[] delim = new byte[] {0};
-
-        List<String> strs = new ArrayList<>(50);
-
-        for (int i = 0; i < 50; i++) {
-            int len = rnd.nextInt(128) + 1;
-
-            buffSize += len + delim.length;
-
-            StringBuilder sb = new StringBuilder(len);
-
-            for (int j = 0; j < len; j++)
-                sb.append((char)(rnd.nextInt(26) + 'a'));
-
-
-            strs.add(sb.toString());
-        }
-
-        ByteBuffer buff = ByteBuffer.allocate(buffSize);
-
-        for (String str : strs) {
-            buff.put(str.getBytes(ASCII));
-            buff.put(delim);
-        }
-
-        buff.flip();
-
-        byte[] msg;
-
-        GridNioDelimitedBuffer delimBuff = new GridNioDelimitedBuffer(delim);
-
-        List<String> res = new ArrayList<>(strs.size());
-
-        while ((msg = delimBuff.read(buff)) != null)
-            res.add(new String(msg, ASCII));
-
-        assertEquals(strs, res);
-    }
-
-    /**
-     * Tests compound delimiter (included to alphabet)
-     */
-    public void testDelim() throws Exception {
-        byte[] delim = "aabb".getBytes(ASCII);
-
-        List<String> strs = Arrays.asList("za", "zaa", "zaab", "zab", "zaabaababbbbabaab");
-
-        int buffSize = 0;
-
-        for (String str : strs)
-            buffSize += str.length() + delim.length;
-
-        ByteBuffer buff = ByteBuffer.allocate(buffSize);
-
-        for (String str : strs) {
-            buff.put(str.getBytes(ASCII));
-            buff.put(delim);
-        }
-
-        buff.flip();
-
-        byte[] msg;
-
-        GridNioDelimitedBuffer delimBuff = new GridNioDelimitedBuffer(delim);
-
-        List<String> res = new ArrayList<>(strs.size());
-
-        while ((msg = delimBuff.read(buff)) != null)
-            res.add(new String(msg, ASCII));
-
-        assertEquals(strs, res);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/91104a29/modules/core/src/test/java/org/apache/ignite/stream/socket/SocketStreamerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/stream/socket/SocketStreamerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/stream/socket/SocketStreamerSelfTest.java
index 752e43c..04f9b41 100644
--- a/modules/core/src/test/java/org/apache/ignite/stream/socket/SocketStreamerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/stream/socket/SocketStreamerSelfTest.java
@@ -58,14 +58,11 @@ public class SocketStreamerSelfTest extends GridCommonAbstractTest {
     /** Port. */
     private static int port;
 
-    /** Ignite. */
-    private static Ignite ignite;
-
     /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration() throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration();
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
 
-        CacheConfiguration ccfg = cacheConfiguration(cfg, null);
+        CacheConfiguration ccfg = defaultCacheConfiguration();
 
         cfg.setCacheConfiguration(ccfg);
 
@@ -81,8 +78,7 @@ public class SocketStreamerSelfTest extends GridCommonAbstractTest {
 
     /** {@inheritDoc} */
     @Override protected void beforeTestsStarted() throws Exception {
-        ignite = startGrids(GRID_CNT);
-        ignite.<Integer, String>getOrCreateCache(defaultCacheConfiguration());
+        startGrids(GRID_CNT);
 
         try (ServerSocket sock = new ServerSocket(0)) {
             port = sock.getLocalPort();
@@ -94,11 +90,6 @@ public class SocketStreamerSelfTest extends GridCommonAbstractTest {
         stopAllGrids();
     }
 
-    /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        ignite.cache(null).clear();
-    }
-
     /**
      * @throws Exception If failed.
      */
@@ -235,6 +226,12 @@ public class SocketStreamerSelfTest extends GridCommonAbstractTest {
     {
         SocketStreamer<Tuple, Integer, String> sockStmr = null;
 
+        Ignite ignite = grid(0);
+
+        IgniteCache<Integer, String> cache = ignite.cache(null);
+
+        cache.clear();
+
         try (IgniteDataStreamer<Integer, String> stmr = ignite.dataStreamer(null)) {
 
             stmr.allowOverwrite(true);
@@ -242,8 +239,6 @@ public class SocketStreamerSelfTest extends GridCommonAbstractTest {
 
             sockStmr = new SocketStreamer<>();
 
-            IgniteCache<Integer, String> cache = ignite.cache(null);
-
             sockStmr.setIgnite(ignite);
 
             sockStmr.setStreamer(stmr);
@@ -279,10 +274,10 @@ public class SocketStreamerSelfTest extends GridCommonAbstractTest {
 
             latch.await();
 
-            assertEquals(CNT, cache.size(CachePeekMode.PRIMARY));
-
             for (int i = 0; i < CNT; i++)
                 assertEquals(Integer.toString(i), cache.get(i));
+
+            assertEquals(CNT, cache.size(CachePeekMode.PRIMARY));
         }
         finally {
             if (sockStmr != null)

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/91104a29/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
index e0a1e6e..cc3abb4 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
@@ -49,6 +49,7 @@ public class IgniteBasicTestSuite extends TestSuite {
         suite.addTest(IgniteExternalizableSelfTestSuite.suite());
         suite.addTest(IgniteP2PSelfTestSuite.suite());
         suite.addTest(IgniteCacheP2pUnmarshallingErrorTestSuite.suite());
+        suite.addTest(IgniteStreamSelfTestSuite.suite());
 
         suite.addTest(new TestSuite(GridSelfTest.class));
         suite.addTest(new TestSuite(GridProjectionSelfTest.class));

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/91104a29/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteStreamSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteStreamSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteStreamSelfTestSuite.java
new file mode 100644
index 0000000..a277fc8
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteStreamSelfTestSuite.java
@@ -0,0 +1,39 @@
+/*
+ * 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.testsuites;
+
+import org.apache.ignite.stream.socket.*;
+
+import junit.framework.*;
+
+/**
+ * Stream test suite.
+ */
+public class IgniteStreamSelfTestSuite extends TestSuite {
+    /**
+     * @return Stream tests suite.
+     * @throws Exception If failed.
+     */
+    public static TestSuite suite() throws Exception {
+        TestSuite suite = new TestSuite("Ignite Stream Test Suite");
+
+        suite.addTest(new TestSuite(SocketStreamerSelfTest.class));
+
+        return suite;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/91104a29/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteStreamTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteStreamTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteStreamTestSuite.java
deleted file mode 100644
index 61be976..0000000
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteStreamTestSuite.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.testsuites;
-
-import org.apache.ignite.stream.socket.*;
-
-import junit.framework.*;
-
-/**
- * Stream test suite.
- */
-public class IgniteStreamTestSuite extends TestSuite {
-    /**
-     * @return Stream tests suite.
-     * @throws Exception If failed.
-     */
-    public static TestSuite suite() throws Exception {
-        TestSuite suite = new TestSuite("Ignite Stream Test Suite");
-
-        suite.addTest(new TestSuite(SocketStreamerSelfTest.class));
-
-        return suite;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/91104a29/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteUtilSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteUtilSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteUtilSelfTestSuite.java
index 32cd038..1c75a7f 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteUtilSelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteUtilSelfTestSuite.java
@@ -67,7 +67,7 @@ public class IgniteUtilSelfTestSuite extends TestSuite {
         suite.addTestSuite(GridNioSelfTest.class);
         suite.addTestSuite(GridNioFilterChainSelfTest.class);
         suite.addTestSuite(GridNioSslSelfTest.class);
-        suite.addTestSuite(GridNioDelimitedBufferTest.class);
+        suite.addTestSuite(GridNioDelimitedBufferSelfTest.class);
 
         return suite;
     }


[11/14] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-883_1' into ignite-sprint-5

Posted by se...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-883_1' into ignite-sprint-5


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/e3fe8ce5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e3fe8ce5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e3fe8ce5

Branch: refs/heads/ignite-484-1
Commit: e3fe8ce581b20d3e378876e3c5b94ff6e22baff8
Parents: abeddc9 eb0e2db
Author: sboikov <sb...@gridgain.com>
Authored: Tue Jun 9 13:44:56 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Jun 9 13:44:56 2015 +0300

----------------------------------------------------------------------
 .../processors/affinity/GridAffinityAssignment.java   | 12 ++++++++++++
 .../affinity/GridAffinityAssignmentCache.java         |  4 ++--
 .../dht/atomic/GridNearAtomicUpdateFuture.java        |  6 +++++-
 .../preloader/GridDhtPartitionsExchangeFuture.java    | 14 +++++++++-----
 4 files changed, 28 insertions(+), 8 deletions(-)
----------------------------------------------------------------------



[03/14] incubator-ignite git commit: # ignite-992 Review.

Posted by se...@apache.org.
# ignite-992 Review.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/0eee664c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/0eee664c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/0eee664c

Branch: refs/heads/ignite-484-1
Commit: 0eee664c0e9a2a0376aa840a5aaf52d6f82a38be
Parents: ea12580
Author: Andrey <an...@gridgain.com>
Authored: Tue Jun 9 11:11:32 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Tue Jun 9 11:11:32 2015 +0700

----------------------------------------------------------------------
 .../visor/util/VisorExceptionWrapper.java       | 26 ++++++++++----------
 1 file changed, 13 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0eee664c/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorExceptionWrapper.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorExceptionWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorExceptionWrapper.java
index a2965d7..e253dcf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorExceptionWrapper.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorExceptionWrapper.java
@@ -24,11 +24,11 @@ public class VisorExceptionWrapper extends Throwable {
     /** Detail message string of this throwable */
     private String detailMsg;
 
-    /** Simple class name of original throwable */
-    private String originalName;
+    /** Simple class name of base throwable object. */
+    private String classSimpleName;
 
-    /** Full class name of original throwable */
-    private String fullName;
+    /** Class name of base throwable object. */
+    private String className;
 
     /**
      * Wrap throwable by presented on Visor throwable object.
@@ -38,8 +38,8 @@ public class VisorExceptionWrapper extends Throwable {
     public VisorExceptionWrapper(Throwable cause) {
         assert cause != null;
 
-        originalName = cause.getClass().getSimpleName();
-        fullName = cause.getClass().getName();
+        classSimpleName = cause.getClass().getSimpleName();
+        className = cause.getClass().getName();
 
         detailMsg = cause.getMessage();
 
@@ -53,17 +53,17 @@ public class VisorExceptionWrapper extends Throwable {
     }
 
     /**
-     * @return Simple name of base throwable object.
+     * @return Class simple name of base throwable object.
      */
-    public String getOriginalName() {
-        return originalName;
+    public String getClassSimpleName() {
+        return classSimpleName;
     }
 
     /**
-     * @return Full name of base throwable object.
+     * @return Class name of base throwable object.
      */
-    public String getFullName() {
-        return fullName;
+    public String getClassName() {
+        return className;
     }
 
     /** {@inheritDoc} */
@@ -73,6 +73,6 @@ public class VisorExceptionWrapper extends Throwable {
 
     /** {@inheritDoc} */
     @Override public String toString() {
-        return (detailMsg != null) ? (fullName + ": " + detailMsg) : fullName;
+        return (detailMsg != null) ? (className + ": " + detailMsg) : className;
     }
 }


[13/14] incubator-ignite git commit: ignite-484-1 - partition number fix

Posted by se...@apache.org.
ignite-484-1 - partition number fix


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/b38c2eba
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/b38c2eba
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/b38c2eba

Branch: refs/heads/ignite-484-1
Commit: b38c2eba30324d15f49b2074880101cc9f079654
Parents: 0647999
Author: S.Vladykin <sv...@gridgain.com>
Authored: Wed Jun 10 01:11:36 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Wed Jun 10 01:11:36 2015 +0300

----------------------------------------------------------------------
 .../h2/twostep/GridReduceQueryExecutor.java     | 11 +++----
 .../IgniteCacheQueryNodeRestartSelfTest2.java   | 30 +++++++++++---------
 .../IgniteCacheQuerySelfTestSuite.java          |  1 +
 3 files changed, 24 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b38c2eba/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
index d059d93..03da6d3 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
@@ -631,9 +631,9 @@ public class GridReduceQueryExecutor {
     private Map<ClusterNode, IntArray> partitionLocations(final GridCacheContext<?,?> cctx, List<String> extraSpaces) {
         assert !cctx.isReplicated() && !cctx.isLocal() : cctx.name() + " must be partitioned";
 
-        int maxParts = cctx.affinity().partitions();
+        final int partsCnt = cctx.affinity().partitions();
 
-        if (extraSpaces != null) { // Find max number of partitions for partitioned caches.
+        if (extraSpaces != null) { // Check correct number of partitions for partitioned caches.
             for (String extraSpace : extraSpaces) {
                 GridCacheContext<?,?> extraCctx = cacheContext(extraSpace);
 
@@ -642,12 +642,13 @@ public class GridReduceQueryExecutor {
 
                 int parts = extraCctx.affinity().partitions();
 
-                if (parts > maxParts)
-                    maxParts = parts;
+                if (parts != partsCnt)
+                    throw new CacheException("Number of partitions must be the same for correct collocation in " +
+                        "caches " + cctx.name() + " and " + extraSpace + ".");
             }
         }
 
-        Set<ClusterNode>[] partLocs = new Set[maxParts];
+        Set<ClusterNode>[] partLocs = new Set[partsCnt];
 
         // Fill partition locations for main cache.
         for (int p = 0, parts =  cctx.affinity().partitions(); p < parts; p++) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b38c2eba/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java
index 1f0a6e6..746cc45 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java
@@ -97,7 +97,7 @@ public class IgniteCacheQueryNodeRestartSelfTest2 extends GridCommonAbstractTest
             cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
             cc.setAtomicityMode(TRANSACTIONAL);
             cc.setRebalanceMode(CacheRebalanceMode.SYNC);
-            cc.setAffinity(new RendezvousAffinityFunction(false, name.equals("pe") ? 50 : 60));
+            cc.setAffinity(new RendezvousAffinityFunction(false, 60));
 
             if (name.equals("pe")) {
                 cc.setIndexedTypes(
@@ -178,7 +178,7 @@ public class IgniteCacheQueryNodeRestartSelfTest2 extends GridCommonAbstractTest
     public void testRestarts() throws Exception {
         int duration = 150 * 1000;
         int qryThreadNum = 4;
-        int restartThreadsNum = 1; // 4 + 2 = 6 nodes
+        int restartThreadsNum = 2; // 4 + 2 = 6 nodes
         final int nodeLifeTime = 2 * 1000;
         final int logFreq = 50;
 
@@ -198,13 +198,13 @@ public class IgniteCacheQueryNodeRestartSelfTest2 extends GridCommonAbstractTest
 
         final AtomicInteger qryCnt = new AtomicInteger();
 
-        final AtomicBoolean done = new AtomicBoolean();
+        final AtomicBoolean qrysDone = new AtomicBoolean();
 
         IgniteInternalFuture<?> fut1 = multithreadedAsync(new CAX() {
             @Override public void applyx() throws IgniteCheckedException {
                 GridRandom rnd = new GridRandom();
 
-                while (!done.get()) {
+                while (!qrysDone.get()) {
                     int g;
 
                     do {
@@ -212,16 +212,16 @@ public class IgniteCacheQueryNodeRestartSelfTest2 extends GridCommonAbstractTest
                     }
                     while (!locks.compareAndSet(g, 0, 1));
 
-//                    if (rnd.nextBoolean()) { // Partitioned query.
+                    if (rnd.nextBoolean()) { // Partitioned query.
                         IgniteCache<?,?> cache = grid(g).cache("pu");
 
                         assertEquals(pRes, cache.query(new SqlFieldsQuery(PARTITIONED_QRY)).getAll());
-//                    }
-//                    else { // Replicated query.
-//                        IgniteCache<?,?> cache = grid(g).cache("co");
-//
-//                        assertEquals(rRes, cache.query(new SqlFieldsQuery(REPLICATED_QRY)).getAll());
-//                    }
+                    }
+                    else { // Replicated query.
+                        IgniteCache<?,?> cache = grid(g).cache("co");
+
+                        assertEquals(rRes, cache.query(new SqlFieldsQuery(REPLICATED_QRY)).getAll());
+                    }
 
                     locks.set(g, 0);
 
@@ -235,12 +235,14 @@ public class IgniteCacheQueryNodeRestartSelfTest2 extends GridCommonAbstractTest
 
         final AtomicInteger restartCnt = new AtomicInteger();
 
+        final AtomicBoolean restartsDone = new AtomicBoolean();
+
         IgniteInternalFuture<?> fut2 = multithreadedAsync(new Callable<Object>() {
             @SuppressWarnings({"BusyWait"})
             @Override public Object call() throws Exception {
                 GridRandom rnd = new GridRandom();
 
-                while (!done.get()) {
+                while (!restartsDone.get()) {
                     int g;
 
                     do {
@@ -272,12 +274,14 @@ public class IgniteCacheQueryNodeRestartSelfTest2 extends GridCommonAbstractTest
 
         info("Stopping..");
 
-        done.set(true);
+        restartsDone.set(true);
 
         fut2.get();
 
         info("Restarts stopped.");
 
+        qrysDone.set(true);
+
         fut1.get();
 
         info("Queries stopped.");

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b38c2eba/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
index cfc8f2c..a7523b6 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
@@ -66,6 +66,7 @@ public class IgniteCacheQuerySelfTestSuite extends TestSuite {
         suite.addTestSuite(IgniteCacheSqlQueryMultiThreadedSelfTest.class);
         suite.addTestSuite(IgniteCacheOffheapTieredMultithreadedSelfTest.class);
         suite.addTestSuite(IgniteCacheQueryNodeRestartSelfTest.class);
+        suite.addTestSuite(IgniteCacheQueryNodeRestartSelfTest2.class);
         suite.addTestSuite(GridCacheReduceQueryMultithreadedSelfTest.class);
         suite.addTestSuite(GridCacheCrossCacheQuerySelfTest.class);
         suite.addTestSuite(GridCacheQuerySerializationSelfTest.class);


[10/14] incubator-ignite git commit: Merge branch 'ignite-992' into ignite-sprint-5

Posted by se...@apache.org.
Merge branch 'ignite-992' into ignite-sprint-5


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/abeddc9c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/abeddc9c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/abeddc9c

Branch: refs/heads/ignite-484-1
Commit: abeddc9c49d5e38d26e35dbf2e662bc7a11bfd0c
Parents: 638dd31 8740b6e
Author: AKuznetsov <ak...@gridgain.com>
Authored: Tue Jun 9 16:38:25 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Tue Jun 9 16:38:25 2015 +0700

----------------------------------------------------------------------
 .../visor/node/VisorNodeDataCollectorTask.java  |  9 ++-
 .../node/VisorNodeDataCollectorTaskResult.java  | 17 ++--
 .../node/VisorNodeSuppressedErrorsTask.java     | 12 ++-
 .../internal/visor/query/VisorQueryJob.java     | 11 +--
 .../internal/visor/query/VisorQueryTask.java    |  3 +-
 .../visor/util/VisorExceptionWrapper.java       | 81 ++++++++++++++++++++
 .../internal/visor/util/VisorTaskUtils.java     | 10 +++
 7 files changed, 124 insertions(+), 19 deletions(-)
----------------------------------------------------------------------



[04/14] incubator-ignite git commit: Merge branches 'ignite-992' and 'ignite-sprint-5' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-992

Posted by se...@apache.org.
Merge branches 'ignite-992' and 'ignite-sprint-5' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-992


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/e934bcad
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e934bcad
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e934bcad

Branch: refs/heads/ignite-484-1
Commit: e934bcad4235494986a0dd30352210255beb927e
Parents: 0eee664 0fa2853
Author: AKuznetsov <ak...@gridgain.com>
Authored: Tue Jun 9 12:10:23 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Tue Jun 9 12:10:23 2015 +0700

----------------------------------------------------------------------
 DEVNOTES.txt                                    |  42 +-
 .../apache/ignite/internal/IgniteKernal.java    |  26 +-
 .../org/apache/ignite/internal/IgnitionEx.java  |   8 +-
 .../internal/MarshallerContextAdapter.java      |  36 +-
 .../internal/managers/GridManagerAdapter.java   |   9 +
 .../checkpoint/GridCheckpointManager.java       |  52 +-
 .../discovery/GridDiscoveryManager.java         |  28 +-
 .../processors/cache/GridCacheAdapter.java      |   4 +
 .../GridCachePartitionExchangeManager.java      |  26 +-
 .../processors/cache/GridCacheTtlManager.java   |   9 +-
 .../dht/atomic/GridDhtAtomicCache.java          |  18 +-
 .../dht/preloader/GridDhtForceKeysFuture.java   |  40 +-
 .../GridDhtPartitionsExchangeFuture.java        |  50 +-
 .../cache/transactions/IgniteTxManager.java     |   3 -
 .../datastructures/DataStructuresProcessor.java | 107 +++-
 .../service/GridServiceProcessor.java           |   4 +-
 .../timeout/GridSpiTimeoutObject.java           |  73 +++
 .../timeout/GridTimeoutProcessor.java           | 105 +++-
 .../util/nio/GridCommunicationClient.java       |  30 +-
 .../util/nio/GridNioRecoveryDescriptor.java     |  13 +-
 .../util/nio/GridTcpCommunicationClient.java    | 554 -------------------
 .../util/nio/GridTcpNioCommunicationClient.java |   8 -
 .../org/apache/ignite/spi/IgniteSpiAdapter.java |  27 +-
 .../org/apache/ignite/spi/IgniteSpiContext.java |  10 +
 .../ignite/spi/IgniteSpiTimeoutObject.java      |  44 ++
 .../spi/checkpoint/noop/NoopCheckpointSpi.java  |   3 +-
 .../communication/tcp/TcpCommunicationSpi.java  | 438 ++++-----------
 .../tcp/TcpCommunicationSpiMBean.java           |   2 -
 .../ignite/spi/discovery/tcp/ClientImpl.java    |   3 -
 .../ignite/spi/discovery/tcp/ServerImpl.java    |  10 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      | 156 +-----
 .../IgniteCountDownLatchAbstractSelfTest.java   | 102 ++++
 .../IgniteCacheClientNearCacheExpiryTest.java   | 103 ++++
 .../IgniteCacheExpiryPolicyTestSuite.java       |   2 +
 .../DataStreamerMultinodeCreateCacheTest.java   |  97 ++++
 .../internal/util/nio/GridNioSelfTest.java      |   2 +-
 .../GridTcpCommunicationSpiAbstractTest.java    |   4 +-
 ...mmunicationSpiConcurrentConnectSelfTest.java |   2 +-
 .../GridTcpCommunicationSpiConfigSelfTest.java  |   2 -
 ...cpCommunicationSpiMultithreadedSelfTest.java |   2 +-
 .../discovery/AbstractDiscoverySelfTest.java    |  13 +-
 .../tcp/TcpClientDiscoverySpiSelfTest.java      |  25 +
 .../testframework/GridSpiTestContext.java       |  10 +
 .../ignite/testsuites/IgniteCacheTestSuite.java |   1 +
 44 files changed, 1073 insertions(+), 1230 deletions(-)
----------------------------------------------------------------------



[14/14] incubator-ignite git commit: Merge branches 'ignite-484-1' and 'ignite-sprint-5' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-484-1

Posted by se...@apache.org.
Merge branches 'ignite-484-1' and 'ignite-sprint-5' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-484-1


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/ef50a38b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ef50a38b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ef50a38b

Branch: refs/heads/ignite-484-1
Commit: ef50a38b8627913c31950c0605cd962ea605ef1d
Parents: b38c2eb d48525c 91104a2
Author: S.Vladykin <sv...@gridgain.com>
Authored: Wed Jun 10 01:11:48 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Wed Jun 10 01:11:48 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/internal/IgniteKernal.java    |   2 +-
 .../affinity/GridAffinityAssignment.java        |  12 ++
 .../affinity/GridAffinityAssignmentCache.java   |   4 +-
 .../dht/atomic/GridNearAtomicUpdateFuture.java  |   6 +-
 .../GridDhtPartitionsExchangeFuture.java        |  14 ++-
 .../continuous/GridContinuousProcessor.java     |   2 +
 .../util/nio/GridNioDelimitedBuffer.java        |   2 +-
 .../visor/node/VisorNodeDataCollectorTask.java  |   9 +-
 .../node/VisorNodeDataCollectorTaskResult.java  |  17 +--
 .../node/VisorNodeSuppressedErrorsTask.java     |  12 +-
 .../internal/visor/query/VisorQueryJob.java     |  11 +-
 .../internal/visor/query/VisorQueryTask.java    |   3 +-
 .../visor/util/VisorExceptionWrapper.java       |  81 ++++++++++++++
 .../internal/visor/util/VisorTaskUtils.java     |  10 ++
 .../continuous/GridEventConsumeSelfTest.java    |   7 +-
 .../nio/GridNioDelimitedBufferSelfTest.java     | 112 +++++++++++++++++++
 .../util/nio/GridNioDelimitedBufferTest.java    | 112 -------------------
 .../stream/socket/SocketStreamerSelfTest.java   |  29 ++---
 .../ignite/testsuites/IgniteBasicTestSuite.java |   1 +
 .../testsuites/IgniteStreamSelfTestSuite.java   |  39 +++++++
 .../testsuites/IgniteStreamTestSuite.java       |  39 -------
 .../testsuites/IgniteUtilSelfTestSuite.java     |   2 +-
 .../query/h2/twostep/GridMapQueryExecutor.java  |   2 +-
 .../cache/GridCacheOffheapIndexGetSelfTest.java |  62 +++++++++-
 24 files changed, 388 insertions(+), 202 deletions(-)
----------------------------------------------------------------------



[08/14] incubator-ignite git commit: # ignite-sprint-5 more debug info in test

Posted by se...@apache.org.
# ignite-sprint-5 more debug info in test


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/410c1d79
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/410c1d79
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/410c1d79

Branch: refs/heads/ignite-484-1
Commit: 410c1d7941fd0283bc6c419e3fc54bce89f59e3f
Parents: e7d8b5a
Author: sboikov <sb...@gridgain.com>
Authored: Tue Jun 9 11:43:52 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Jun 9 11:43:52 2015 +0300

----------------------------------------------------------------------
 .../processors/continuous/GridEventConsumeSelfTest.java       | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/410c1d79/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/GridEventConsumeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/GridEventConsumeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/GridEventConsumeSelfTest.java
index 2c9e513..9ffef4b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/GridEventConsumeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/GridEventConsumeSelfTest.java
@@ -114,8 +114,11 @@ public class GridEventConsumeSelfTest extends GridCommonAbstractTest {
                 GridContinuousProcessor proc = grid.context().continuous();
 
                 try {
-                    if (!noAutoUnsubscribe)
-                        assertEquals(0, U.<Map>field(proc, "rmtInfos").size());
+                    if (!noAutoUnsubscribe) {
+                        Map rmtInfos = U.field(proc, "rmtInfos");
+
+                        assertTrue("Unexpected remote infos: " + rmtInfos, rmtInfos.isEmpty());
+                    }
                 }
                 finally {
                     U.<Map>field(proc, "rmtInfos").clear();


[02/14] incubator-ignite git commit: # IGNITE-992 Review.

Posted by se...@apache.org.
# IGNITE-992 Review.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/ea12580d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ea12580d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ea12580d

Branch: refs/heads/ignite-484-1
Commit: ea12580dabd60dc0c2b1a0e86d7112b409366ba7
Parents: 662f733
Author: AKuznetsov <ak...@gridgain.com>
Authored: Tue Jun 9 10:15:41 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Tue Jun 9 10:15:41 2015 +0700

----------------------------------------------------------------------
 .../apache/ignite/internal/util/IgniteExceptionRegistry.java | 2 +-
 .../internal/visor/node/VisorNodeDataCollectorTask.java      | 8 ++++----
 .../apache/ignite/internal/visor/query/VisorQueryJob.java    | 2 +-
 .../ignite/internal/visor/util/VisorExceptionWrapper.java    | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ea12580d/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteExceptionRegistry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteExceptionRegistry.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteExceptionRegistry.java
index a56570a..8ad3348 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteExceptionRegistry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteExceptionRegistry.java
@@ -187,7 +187,7 @@ public class IgniteExceptionRegistry {
          */
         public ExceptionInfo(long order, Throwable error, String msg, long threadId, String threadName, long time) {
             this.order = order;
-            this.error = VisorTaskUtils.wrap(error);
+            this.error = new VisorExceptionWrapper(error);
             this.threadId = threadId;
             this.threadName = threadName;
             this.time = time;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ea12580d/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 7dbfd39..3b2d45c 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
@@ -88,7 +88,7 @@ public class VisorNodeDataCollectorTask extends VisorMultiNodeTask<VisorNodeData
                 else {
                     // Ignore nodes that left topology.
                     if (!(unhandledEx instanceof ClusterGroupEmptyException))
-                        taskRes.unhandledEx().put(nid, VisorTaskUtils.wrap(unhandledEx));
+                        taskRes.unhandledEx().put(nid, new VisorExceptionWrapper(unhandledEx));
                 }
             }
         }
@@ -117,13 +117,13 @@ public class VisorNodeDataCollectorTask extends VisorMultiNodeTask<VisorNodeData
             taskRes.events().addAll(jobRes.events());
 
         if (jobRes.eventsEx() != null)
-            taskRes.eventsEx().put(nid, VisorTaskUtils.wrap(jobRes.eventsEx()));
+            taskRes.eventsEx().put(nid, new VisorExceptionWrapper(jobRes.eventsEx()));
 
         if (!jobRes.caches().isEmpty())
             taskRes.caches().put(nid, jobRes.caches());
 
         if (jobRes.cachesEx() != null)
-            taskRes.cachesEx().put(nid, VisorTaskUtils.wrap(jobRes.cachesEx()));
+            taskRes.cachesEx().put(nid, new VisorExceptionWrapper(jobRes.cachesEx()));
 
         if (!jobRes.igfss().isEmpty())
             taskRes.igfss().put(nid, jobRes.igfss());
@@ -132,6 +132,6 @@ public class VisorNodeDataCollectorTask extends VisorMultiNodeTask<VisorNodeData
             taskRes.igfsEndpoints().put(nid, jobRes.igfsEndpoints());
 
         if (jobRes.igfssEx() != null)
-            taskRes.igfssEx().put(nid, VisorTaskUtils.wrap(jobRes.igfssEx()));
+            taskRes.igfssEx().put(nid, new VisorExceptionWrapper(jobRes.igfssEx()));
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ea12580d/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java
index 82555cc..e977d2e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java
@@ -112,7 +112,7 @@ public class VisorQueryJob extends VisorJob<VisorQueryArg, IgniteBiTuple<? exten
 
                 if (meta == null)
                     return new IgniteBiTuple<>(
-                        VisorTaskUtils.wrap(new SQLException("Fail to execute query. No metadata available.")), null);
+                        new VisorExceptionWrapper(new SQLException("Fail to execute query. No metadata available.")), null);
                 else {
                     List<VisorQueryField> names = new ArrayList<>(meta.size());
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ea12580d/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorExceptionWrapper.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorExceptionWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorExceptionWrapper.java
index be6f63c..a2965d7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorExceptionWrapper.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorExceptionWrapper.java
@@ -18,7 +18,7 @@
 package org.apache.ignite.internal.visor.util;
 
 /**
- * Wrapper of exceptions for transferring to Visor with absent exception classes.
+ * Exception wrapper for safe for transferring to Visor.
  */
 public class VisorExceptionWrapper extends Throwable {
     /** Detail message string of this throwable */