You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2015/12/28 11:16:39 UTC

[01/13] ignite git commit: ignite-2175

Repository: ignite
Updated Branches:
  refs/heads/ignite-2206 eb14e6875 -> 3a2db6e85


ignite-2175


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

Branch: refs/heads/ignite-2206
Commit: 60eec118428bc06f3107fee3ad55dd9a1c6d5cf3
Parents: 66b33bc
Author: Anton Vinogradov <av...@apache.org>
Authored: Wed Dec 23 13:35:14 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Wed Dec 23 13:35:14 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/processors/query/GridQueryProcessor.java    | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/60eec118/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index 7d1311f..4808e96 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -1076,6 +1076,11 @@ public class GridQueryProcessor extends GridProcessorAdapter {
             clsName = clsName.substring(0, clsName.length() - 2) + "_array";
         }
 
+        int parentEnd = clsName.lastIndexOf('$');
+
+        if (parentEnd >= 0)
+            clsName = clsName.substring(parentEnd + 1);
+
         return clsName;
     }
 


[11/13] ignite git commit: IGNITE-2257: Fixed BinaryContext serialization.

Posted by vo...@apache.org.
IGNITE-2257: Fixed BinaryContext serialization.


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

Branch: refs/heads/ignite-2206
Commit: 18c413c41b51994fb2eeaaebf4cf727049db0c8b
Parents: 49c2988
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Dec 25 09:48:28 2015 +0300
Committer: thatcoach <pp...@list.ru>
Committed: Fri Dec 25 09:48:28 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/binary/BinaryContext.java   | 44 +----------
 .../internal/binary/BinaryEnumObjectImpl.java   |  4 +-
 .../internal/binary/BinaryObjectImpl.java       | 27 ++++---
 .../internal/binary/GridBinaryMarshaller.java   | 82 +++++++++++++++++++-
 4 files changed, 94 insertions(+), 63 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/18c413c4/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
index 5c63fbd..163532d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
@@ -31,10 +31,8 @@ import org.apache.ignite.cache.affinity.AffinityKey;
 import org.apache.ignite.cache.affinity.AffinityKeyMapped;
 import org.apache.ignite.configuration.BinaryConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.IgniteKernal;
 import org.apache.ignite.internal.IgnitionEx;
 import org.apache.ignite.internal.processors.cache.binary.BinaryMetadataKey;
-import org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl;
 import org.apache.ignite.internal.processors.datastructures.CollocatedQueueItemKey;
 import org.apache.ignite.internal.processors.datastructures.CollocatedSetItemKey;
 import org.apache.ignite.internal.util.IgniteUtils;
@@ -51,10 +49,6 @@ import org.jsr166.ConcurrentHashMap8;
 import java.io.Externalizable;
 import java.io.File;
 import java.io.IOException;
-import java.io.InvalidObjectException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.io.ObjectStreamException;
 import java.lang.reflect.Field;
 import java.math.BigDecimal;
 import java.net.URISyntaxException;
@@ -81,10 +75,7 @@ import java.util.jar.JarFile;
 /**
  * Binary context.
  */
-public class BinaryContext implements Externalizable {
-    /** */
-    private static final long serialVersionUID = 0L;
-
+public class BinaryContext {
     /** */
     private static final ClassLoader dfltLdr = U.gridClassLoader();
 
@@ -125,9 +116,6 @@ public class BinaryContext implements Externalizable {
     private MarshallerContext marshCtx;
 
     /** */
-    private String gridName;
-
-    /** */
     private IgniteConfiguration igniteCfg;
 
     /** Logger. */
@@ -162,8 +150,6 @@ public class BinaryContext implements Externalizable {
         this.igniteCfg = igniteCfg;
         this.log = log;
 
-        gridName = igniteCfg.getGridName();
-
         colTypes.put(ArrayList.class, GridBinaryMarshaller.ARR_LIST);
         colTypes.put(LinkedList.class, GridBinaryMarshaller.LINKED_LIST);
         colTypes.put(HashSet.class, GridBinaryMarshaller.HASH_SET);
@@ -727,34 +713,6 @@ public class BinaryContext implements Externalizable {
         return null;
     }
 
-    /** {@inheritDoc} */
-    @Override public void writeExternal(ObjectOutput out) throws IOException {
-        U.writeString(out, igniteCfg.getGridName());
-    }
-
-    /** {@inheritDoc} */
-    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        gridName = U.readString(in);
-    }
-
-    /**
-     * @return Binary context.
-     * @throws ObjectStreamException In case of error.
-     */
-    protected Object readResolve() throws ObjectStreamException {
-        try {
-            IgniteKernal g = IgnitionEx.gridx(gridName);
-
-            if (g == null)
-                throw new IllegalStateException("Failed to find grid for name: " + gridName);
-
-            return ((CacheObjectBinaryProcessorImpl)g.context().cacheObjects()).binaryContext();
-        }
-        catch (IllegalStateException e) {
-            throw U.withCause(new InvalidObjectException(e.getMessage()), e);
-        }
-    }
-
     /**
      * @param cls Class.
      * @param id Type ID.

http://git-wip-us.apache.org/repos/asf/ignite/blob/18c413c4/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
index 001d2d7..536c582 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
@@ -183,8 +183,6 @@ public class BinaryEnumObjectImpl implements BinaryObjectEx, Externalizable, Cac
 
     /** {@inheritDoc} */
     @Override public void writeExternal(ObjectOutput out) throws IOException {
-        out.writeObject(ctx);
-
         out.writeInt(typeId);
         out.writeObject(clsName);
         out.writeInt(ord);
@@ -192,7 +190,7 @@ public class BinaryEnumObjectImpl implements BinaryObjectEx, Externalizable, Cac
 
     /** {@inheritDoc} */
     @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        ctx = (BinaryContext)in.readObject();
+        ctx = GridBinaryMarshaller.threadLocalContext();
 
         typeId = in.readInt();
         clsName = (String)in.readObject();

http://git-wip-us.apache.org/repos/asf/ignite/blob/18c413c4/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
index fca8955..44c7a08 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
@@ -17,16 +17,6 @@
 
 package org.apache.ignite.internal.binary;
 
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.nio.ByteBuffer;
-import java.sql.Timestamp;
-import java.util.Date;
-import java.util.UUID;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.binary.BinaryObject;
 import org.apache.ignite.binary.BinaryObjectException;
@@ -43,7 +33,18 @@ import org.apache.ignite.plugin.extensions.communication.MessageReader;
 import org.apache.ignite.plugin.extensions.communication.MessageWriter;
 import org.jetbrains.annotations.Nullable;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.nio.ByteBuffer;
+import java.sql.Timestamp;
+import java.util.Date;
+import java.util.UUID;
+
+import static java.nio.charset.StandardCharsets.*;
 
 /**
  * Binary object implementation.
@@ -427,8 +428,6 @@ public final class BinaryObjectImpl extends BinaryObjectExImpl implements Extern
 
     /** {@inheritDoc} */
     @Override public void writeExternal(ObjectOutput out) throws IOException {
-        out.writeObject(ctx);
-
         if (detachAllowed) {
             int len = length();
 
@@ -445,7 +444,7 @@ public final class BinaryObjectImpl extends BinaryObjectExImpl implements Extern
 
     /** {@inheritDoc} */
     @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        ctx = (BinaryContext)in.readObject();
+        ctx = GridBinaryMarshaller.threadLocalContext();
 
         arr = new byte[in.readInt()];
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/18c413c4/modules/core/src/main/java/org/apache/ignite/internal/binary/GridBinaryMarshaller.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/GridBinaryMarshaller.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/GridBinaryMarshaller.java
index 71ca018..b4f4291 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/GridBinaryMarshaller.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/GridBinaryMarshaller.java
@@ -17,10 +17,15 @@
 
 package org.apache.ignite.internal.binary;
 
+import org.apache.ignite.IgniteIllegalStateException;
+import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.IgnitionEx;
 import org.apache.ignite.internal.binary.streams.BinaryHeapInputStream;
 import org.apache.ignite.internal.binary.streams.BinaryInputStream;
 import org.apache.ignite.internal.binary.streams.BinaryOutputStream;
 import org.apache.ignite.binary.BinaryObjectException;
+import org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl;
+import org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessor;
 import org.jetbrains.annotations.Nullable;
 
 /**
@@ -34,6 +39,9 @@ public class GridBinaryMarshaller {
         }
     };
 
+    /** Binary context in TLS store. */
+    private static final ThreadLocal<BinaryContext> BINARY_CTX = new ThreadLocal<>();
+
     /** */
     static final byte OPTM_MARSH = -2;
 
@@ -237,7 +245,14 @@ public class GridBinaryMarshaller {
     @Nullable public <T> T unmarshal(byte[] bytes, @Nullable ClassLoader clsLdr) throws BinaryObjectException {
         assert bytes != null;
 
-        return (T)BinaryUtils.unmarshal(BinaryHeapInputStream.create(bytes, 0), ctx, clsLdr);
+        BinaryContext oldCtx = pushContext(ctx);
+
+        try {
+            return (T) BinaryUtils.unmarshal(BinaryHeapInputStream.create(bytes, 0), ctx, clsLdr);
+        }
+        finally {
+            popContext(oldCtx);
+        }
     }
 
     /**
@@ -247,7 +262,14 @@ public class GridBinaryMarshaller {
      */
     @SuppressWarnings("unchecked")
     @Nullable public <T> T unmarshal(BinaryInputStream in) throws BinaryObjectException {
-        return (T)BinaryUtils.unmarshal(in, ctx, null);
+        BinaryContext oldCtx = pushContext(ctx);
+
+        try {
+            return (T)BinaryUtils.unmarshal(in, ctx, null);
+        }
+        finally {
+            popContext(oldCtx);
+        }
     }
 
     /**
@@ -264,7 +286,40 @@ public class GridBinaryMarshaller {
         if (arr[0] == NULL)
             return null;
 
-        return (T)new BinaryReaderExImpl(ctx, BinaryHeapInputStream.create(arr, 0), ldr).deserialize();
+        BinaryContext oldCtx = pushContext(ctx);
+
+        try {
+            return (T)new BinaryReaderExImpl(ctx, BinaryHeapInputStream.create(arr, 0), ldr).deserialize();
+        }
+        finally {
+            popContext(oldCtx);
+        }
+    }
+
+    /**
+     * Push binary context and return the old one.
+     *
+     * @param ctx Binary context.
+     * @return Old binary context.
+     */
+    @Nullable private static BinaryContext pushContext(BinaryContext ctx) {
+        BinaryContext old = BINARY_CTX.get();
+
+        BINARY_CTX.set(ctx);
+
+        return old;
+    }
+
+    /**
+     * Pop binary context and restore the old one.
+     *
+     * @param oldCtx Old binary context.
+     */
+    private static void popContext(@Nullable BinaryContext oldCtx) {
+        if (oldCtx == null)
+            BINARY_CTX.remove();
+        else
+            BINARY_CTX.set(oldCtx);
     }
 
     /**
@@ -293,4 +348,25 @@ public class GridBinaryMarshaller {
     public BinaryContext context() {
         return ctx;
     }
+
+    /**
+     * @return Thread-bound context.
+     */
+    public static BinaryContext threadLocalContext() {
+        BinaryContext ctx = GridBinaryMarshaller.BINARY_CTX.get();
+
+        if (ctx == null) {
+            IgniteKernal ignite = IgnitionEx.localIgnite();
+
+            IgniteCacheObjectProcessor proc = ignite.context().cacheObjects();
+
+            if (proc instanceof CacheObjectBinaryProcessorImpl)
+                return ((CacheObjectBinaryProcessorImpl)proc).binaryContext();
+            else
+                throw new IgniteIllegalStateException("Ignite instance must be started with " +
+                    BinaryMarshaller.class.getName() + " [name=" + ignite.name() + ']');
+        }
+
+        return ctx;
+    }
 }


[10/13] ignite git commit: ignite-1.5 Fixed test.

Posted by vo...@apache.org.
ignite-1.5 Fixed test.


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

Branch: refs/heads/ignite-2206
Commit: 49c298866b7c113aa62af4fe0587d6d39edd9f50
Parents: debe34d
Author: sboikov <sb...@gridgain.com>
Authored: Thu Dec 24 15:52:59 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Dec 24 15:52:59 2015 +0300

----------------------------------------------------------------------
 .../util/nio/GridNioRecoveryDescriptor.java     |   7 -
 .../ignite/internal/util/nio/GridNioServer.java |   7 +
 .../communication/tcp/TcpCommunicationSpi.java  |  12 +-
 .../internal/util/nio/GridNioSelfTest.java      | 127 ++++++++++++-------
 ...dTcpCommunicationSpiRecoveryAckSelfTest.java |  14 ++
 .../GridUriDeploymentFileProcessorSelfTest.java |  19 ++-
 6 files changed, 120 insertions(+), 66 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/49c29886/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java
index 5647239..429f990 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioRecoveryDescriptor.java
@@ -134,13 +134,6 @@ public class GridNioRecoveryDescriptor {
     }
 
     /**
-     * @return Received messages count.
-     */
-    public long receivedCount() {
-        return rcvCnt;
-    }
-
-    /**
      * @return Maximum size of unacknowledged messages queue.
      */
     public int queueLimit() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/49c29886/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
index be28c30..17a0b8f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
@@ -309,6 +309,13 @@ public class GridNioServer<T> {
     }
 
     /**
+     * @return Configured port.
+     */
+    public int port() {
+        return locAddr != null ? locAddr.getPort() : -1;
+    }
+
+    /**
      * Creates and returns a builder for a new instance of this class.
      *
      * @return Builder for new instance.

http://git-wip-us.apache.org/repos/asf/ignite/blob/49c29886/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
index bf6e869..6cdfe9a 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
@@ -620,7 +620,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
                 nioSrvr.resend(ses);
 
                 if (sndRes)
-                    nioSrvr.sendSystem(ses, new RecoveryLastReceivedMessage(recovery.receivedCount()));
+                    nioSrvr.sendSystem(ses, new RecoveryLastReceivedMessage(recovery.received()));
 
                 recovery.connected();
 
@@ -714,7 +714,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
                             }
                         };
 
-                        nioSrvr.sendSystem(ses, new RecoveryLastReceivedMessage(recoveryDesc.receivedCount()), lsnr);
+                        nioSrvr.sendSystem(ses, new RecoveryLastReceivedMessage(recoveryDesc.received()), lsnr);
                     }
                     else {
                         try {
@@ -2587,16 +2587,16 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
                     else
                         ch.write(ByteBuffer.wrap(U.IGNITE_HEADER));
 
-                    ClusterNode localNode = getLocalNode();
+                    ClusterNode locNode = getLocalNode();
 
-                    if (localNode == null)
+                    if (locNode == null)
                         throw new IgniteCheckedException("Local node has not been started or " +
                             "fully initialized [isStopping=" + getSpiContext().isStopping() + ']');
 
                     if (recovery != null) {
-                        HandshakeMessage msg = new HandshakeMessage(localNode.id(),
+                        HandshakeMessage msg = new HandshakeMessage(locNode.id(),
                             recovery.incrementConnectCount(),
-                            recovery.receivedCount());
+                            recovery.received());
 
                         if (log.isDebugEnabled())
                             log.debug("Write handshake message [rmtNode=" + rmtNodeId + ", msg=" + msg + ']');

http://git-wip-us.apache.org/repos/asf/ignite/blob/49c29886/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioSelfTest.java
index 594e3c2..6089795 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/nio/GridNioSelfTest.java
@@ -23,6 +23,7 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.Serializable;
 import java.lang.reflect.Field;
+import java.net.BindException;
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
 import java.net.Socket;
@@ -61,6 +62,9 @@ public class GridNioSelfTest extends GridCommonAbstractTest {
     /** Message count in test without reconnect. */
     private static final int MSG_CNT = 2000;
 
+    /** */
+    private static final int START_PORT = 55443;
+
     /** Message id provider. */
     private static final AtomicInteger idProvider = new AtomicInteger(1);
 
@@ -80,13 +84,15 @@ public class GridNioSelfTest extends GridCommonAbstractTest {
     private static volatile Marshaller marsh;
 
     /** Test port. */
-    private int port = 55443;
+    private static int port;
 
     /** {@inheritDoc} */
     @Override protected void beforeTestsStarted() throws Exception {
         getTestResources().startThreads(true);
 
         marsh = getTestResources().getMarshaller();
+
+        port = START_PORT;
     }
 
     /** {@inheritDoc} */
@@ -94,13 +100,6 @@ public class GridNioSelfTest extends GridCommonAbstractTest {
         getTestResources().stopThreads();
     }
 
-    /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        super.beforeTest();
-
-        port++;
-    }
-
     /**
      * @throws Exception If failed.
      */
@@ -127,19 +126,18 @@ public class GridNioSelfTest extends GridCommonAbstractTest {
             }
         };
 
-        GridNioServer<?> srvr = startServer(port, new GridPlainParser(), lsnr);
+        final GridNioServer<?> srvr = startServer(new GridPlainParser(), lsnr);
 
         try {
             IgniteInternalFuture<?> fut = multithreadedAsync(new Runnable() {
-                @Override
-                public void run() {
+                @Override public void run() {
                     byte[] msg = new byte[MSG_SIZE];
 
                     for (int i = 0; i < msg.length; i++)
                         msg[i] = (byte) (i ^ (i * i - 1)); // Some data
 
                     for (int i = 0; i < RECONNECT_MSG_CNT; i++)
-                        validateSendMessage(msg);
+                        validateSendMessage(srvr.port(), msg);
                 }
             }, THREAD_CNT);
 
@@ -177,11 +175,11 @@ public class GridNioSelfTest extends GridCommonAbstractTest {
             }
         };
 
-        GridNioServer<?> srvr = startServer(port, new GridPlainParser(), lsnr);
+        GridNioServer<?> srvr = startServer(new GridPlainParser(), lsnr);
 
         Socket s = createSocket();
 
-        s.connect(new InetSocketAddress(U.getLocalHost(), port), 1000);
+        s.connect(new InetSocketAddress(U.getLocalHost(), srvr.port()), 1000);
 
         try {
             byte[] msg = new byte[MSG_SIZE];
@@ -235,12 +233,12 @@ public class GridNioSelfTest extends GridCommonAbstractTest {
             }
         };
 
-        GridNioServer<?> srvr = startServer(port, new GridPlainParser(), lsnr);
+        GridNioServer<?> srvr = startServer(new GridPlainParser(), lsnr);
 
         try {
             Socket s = createSocket();
 
-            s.connect(new InetSocketAddress(U.getLocalHost(), port), 1000);
+            s.connect(new InetSocketAddress(U.getLocalHost(), srvr.port()), 1000);
 
             if (!(s instanceof SSLSocket)) {
                 // These methods are not supported by SSL sockets.
@@ -277,7 +275,7 @@ public class GridNioSelfTest extends GridCommonAbstractTest {
             }
         };
 
-        GridNioServer<?> srvr = startServer(port, new GridPlainParser(), lsnr);
+        final GridNioServer<?> srvr = startServer(new GridPlainParser(), lsnr);
 
         final AtomicLong cnt = new AtomicLong();
 
@@ -285,8 +283,7 @@ public class GridNioSelfTest extends GridCommonAbstractTest {
 
         try {
             IgniteInternalFuture<?> fut = multithreadedAsync(new Runnable() {
-                @Override
-                public void run() {
+                @Override public void run() {
                     try {
                         byte[] msg = new byte[MSG_SIZE];
 
@@ -294,7 +291,7 @@ public class GridNioSelfTest extends GridCommonAbstractTest {
                             msg[i] = (byte) (i ^ (i * i - 1)); // Some data
 
                         try (Socket s = createSocket()) {
-                            s.connect(new InetSocketAddress(U.getLocalHost(), port), 1000);
+                            s.connect(new InetSocketAddress(U.getLocalHost(), srvr.port()), 1000);
 
                             OutputStream out = s.getOutputStream();
 
@@ -369,12 +366,12 @@ public class GridNioSelfTest extends GridCommonAbstractTest {
             }
         };
 
-        GridNioServer<?> srvr = startServer(port, new GridPlainParser(), lsnr);
+        GridNioServer<?> srvr = startServer(new GridPlainParser(), lsnr);
 
         try {
             Socket s = createSocket();
 
-            s.connect(new InetSocketAddress(U.getLocalHost(), port), 1000);
+            s.connect(new InetSocketAddress(U.getLocalHost(), srvr.port()), 1000);
 
             // This is needed for SSL to begin handshake.
             s.getOutputStream().write(new byte[1]);
@@ -439,16 +436,12 @@ public class GridNioSelfTest extends GridCommonAbstractTest {
             }
         };
 
-        GridNioServer.Builder<?> builder = serverBuilder(port, new GridPlainParser(), lsnr);
-
-        GridNioServer<?> srvr = builder.sendQueueLimit(5).build();
-
-        srvr.start();
+        GridNioServer<?> srvr = startServer(new GridPlainParser(), lsnr, 5);
 
         try {
             Socket s = createSocket();
 
-            s.connect(new InetSocketAddress(U.getLocalHost(), port), 1000);
+            s.connect(new InetSocketAddress(U.getLocalHost(), srvr.port()), 1000);
 
             s.getOutputStream().write(new byte[1]);
 
@@ -473,9 +466,10 @@ public class GridNioSelfTest extends GridCommonAbstractTest {
     /**
      * Sends message and validates reply.
      *
+     * @param port Port.
      * @param msg Message to send.
      */
-    private void validateSendMessage(byte[] msg) {
+    private void validateSendMessage(int port, byte[] msg) {
         try {
             Socket s = createSocket();
 
@@ -552,19 +546,54 @@ public class GridNioSelfTest extends GridCommonAbstractTest {
     /**
      * Starts server with specified arguments.
      *
-     * @param port Port to listen.
      * @param parser Parser to use.
      * @param lsnr Listener.
      * @return Started server.
      * @throws Exception If failed.
      */
-    protected final GridNioServer<?> startServer(int port, GridNioParser parser, GridNioServerListener lsnr)
+    protected final GridNioServer<?> startServer(GridNioParser parser, GridNioServerListener lsnr)
         throws Exception {
-        GridNioServer<?> srvr = serverBuilder(port, parser, lsnr).build();
+        return startServer(parser, lsnr, null);
+    }
+
+    /**
+     * Starts server with specified arguments.
+     *
+     * @param parser Parser to use.
+     * @param lsnr Listener.
+     * @param queueLimit Optional send queue limit.
+     * @return Started server.
+     * @throws Exception If failed.
+     */
+    protected final GridNioServer<?> startServer(GridNioParser parser,
+        GridNioServerListener lsnr,
+        @Nullable Integer queueLimit) throws Exception {
+        for (int i = 0; i < 10; i++) {
+            try {
+                int srvPort = port++;
+
+                GridNioServer.Builder<?> builder = serverBuilder(srvPort, parser, lsnr);
+
+                if (queueLimit != null)
+                    builder.sendQueueLimit(queueLimit);
+
+                GridNioServer<?> srvr = builder.build();
+
+                srvr.start();
+
+                return srvr;
+            }
+            catch (IgniteCheckedException e) {
+                if (i < 9 && e.hasCause(BindException.class))
+                    log.error("Failed to start server, will try another port: " + e);
+                else
+                    throw e;
+            }
+        }
 
-        srvr.start();
+        fail("Failed to start server.");
 
-        return srvr;
+        return null;
     }
 
     /**
@@ -604,13 +633,13 @@ public class GridNioSelfTest extends GridCommonAbstractTest {
 
         NioListener lsnr = new NioListener(latch);
 
-        GridNioServer<?> srvr = startServer(port, new GridBufferedParser(true, ByteOrder.nativeOrder()), lsnr);
+        GridNioServer<?> srvr = startServer(new GridBufferedParser(true, ByteOrder.nativeOrder()), lsnr);
 
         TestClient client = null;
 
         try {
             for (int i = 0; i < 5; i++) {
-                client = createClient(U.getLocalHost(), port, U.getLocalHost());
+                client = createClient(U.getLocalHost(), srvr.port(), U.getLocalHost());
 
                 client.sendMessage(createMessage(), MSG_SIZE);
                 client.sendMessage(createMessage(), MSG_SIZE);
@@ -638,13 +667,13 @@ public class GridNioSelfTest extends GridCommonAbstractTest {
 
         NioListener lsnr = new NioListener(latch);
 
-        GridNioServer<?> srvr1 = startServer(port, new BufferedParser(false), lsnr);
-        GridNioServer<?> srvr2 = startServer(port + 1, new BufferedParser(false), lsnr);
+        GridNioServer<?> srvr1 = startServer(new BufferedParser(false), lsnr);
+        GridNioServer<?> srvr2 = startServer(new BufferedParser(false), lsnr);
 
         GridNioSession ses = null;
 
         try {
-            SocketChannel ch = SocketChannel.open(new InetSocketAddress(U.getLocalHost(), port + 1));
+            SocketChannel ch = SocketChannel.open(new InetSocketAddress(U.getLocalHost(), srvr2.port()));
 
             GridNioFuture<GridNioSession> fut = srvr1.createSession(ch, null);
 
@@ -676,7 +705,7 @@ public class GridNioSelfTest extends GridCommonAbstractTest {
 
         NioListener lsnr = new NioListener(latch);
 
-        GridNioServer<?> srvr = startServer(port, new GridBufferedParser(true, ByteOrder.nativeOrder()), lsnr);
+        final GridNioServer<?> srvr = startServer(new GridBufferedParser(true, ByteOrder.nativeOrder()), lsnr);
 
         try {
             final byte[] data = createMessage();
@@ -686,7 +715,7 @@ public class GridNioSelfTest extends GridCommonAbstractTest {
                     TestClient client = null;
 
                     try {
-                        client = createClient(U.getLocalHost(), port, U.getLocalHost());
+                        client = createClient(U.getLocalHost(), srvr.port(), U.getLocalHost());
 
                         for (int i = 0; i < MSG_CNT; i++)
                             client.sendMessage(data, data.length);
@@ -722,7 +751,7 @@ public class GridNioSelfTest extends GridCommonAbstractTest {
 
         final AtomicReference<Exception> err = new AtomicReference<>();
 
-        GridNioServer<?> srvr = startServer(port, new GridBufferedParser(true, ByteOrder.nativeOrder()),
+        final GridNioServer<?> srvr = startServer(new GridBufferedParser(true, ByteOrder.nativeOrder()),
             new EchoListener());
 
         try {
@@ -734,7 +763,7 @@ public class GridNioSelfTest extends GridCommonAbstractTest {
                             TestClient client = null;
 
                             try {
-                                client = createClient(U.getLocalHost(), port, U.getLocalHost());
+                                client = createClient(U.getLocalHost(), srvr.port(), U.getLocalHost());
 
                                 MessageWithId msg = new MessageWithId(idProvider.getAndIncrement());
 
@@ -827,7 +856,7 @@ public class GridNioSelfTest extends GridCommonAbstractTest {
 
         final AtomicLong cntr = new AtomicLong();
 
-        GridNioServer<?> srvr = startServer(port, new GridBufferedParser(true, ByteOrder.nativeOrder()), lsnr);
+        final GridNioServer<?> srvr = startServer(new GridBufferedParser(true, ByteOrder.nativeOrder()), lsnr);
 
         try {
             multithreaded(new Runnable() {
@@ -835,7 +864,7 @@ public class GridNioSelfTest extends GridCommonAbstractTest {
                     TestClient client = null;
 
                     try {
-                        client = createClient(U.getLocalHost(), port, U.getLocalHost());
+                        client = createClient(U.getLocalHost(), srvr.port(), U.getLocalHost());
 
                         while (cntr.getAndIncrement() < MSG_CNT * THREAD_CNT) {
                             MessageWithId msg = new MessageWithId(idProvider.getAndIncrement());
@@ -908,14 +937,14 @@ public class GridNioSelfTest extends GridCommonAbstractTest {
             }
         };
 
-        GridNioServer<?> srvr = startServer(port, new GridBufferedParser(true, ByteOrder.nativeOrder()), lsnr);
+        final GridNioServer<?> srvr = startServer(new GridBufferedParser(true, ByteOrder.nativeOrder()), lsnr);
 
         srvr.idleTimeout(1000);
 
         try {
             multithreaded(new Runnable() {
                 @Override public void run() {
-                    try (TestClient ignored = createClient(U.getLocalHost(), port, U.getLocalHost())) {
+                    try (TestClient ignored = createClient(U.getLocalHost(), srvr.port(), U.getLocalHost())) {
                         info("Before sleep.");
 
                         U.sleep(4000);
@@ -976,7 +1005,7 @@ public class GridNioSelfTest extends GridCommonAbstractTest {
             }
         };
 
-        GridNioServer<?> srvr = startServer(port, new GridBufferedParser(true, ByteOrder.nativeOrder()), lsnr);
+        final GridNioServer<?> srvr = startServer(new GridBufferedParser(true, ByteOrder.nativeOrder()), lsnr);
 
         // Set flag using reflection.
         Field f = srvr.getClass().getDeclaredField("skipWrite");
@@ -990,7 +1019,7 @@ public class GridNioSelfTest extends GridCommonAbstractTest {
         try {
             multithreaded(new Runnable() {
                 @Override public void run() {
-                    try (TestClient ignored = createClient(U.getLocalHost(), port, U.getLocalHost())) {
+                    try (TestClient ignored = createClient(U.getLocalHost(), srvr.port(), U.getLocalHost())) {
                         info("Before sleep.");
 
                         U.sleep(4000);

http://git-wip-us.apache.org/repos/asf/ignite/blob/49c29886/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java
index 9e78fb9..d07a1e6 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java
@@ -149,6 +149,8 @@ public class GridTcpCommunicationSpiRecoveryAckSelfTest<T extends CommunicationS
 
             int expMsgs = 0;
 
+            long totAcked = 0;
+
             for (int i = 0; i < 5; i++) {
                 info("Iteration: " + i);
 
@@ -160,6 +162,8 @@ public class GridTcpCommunicationSpiRecoveryAckSelfTest<T extends CommunicationS
 
                 expMsgs += msgPerIter;
 
+                final long totAcked0 = totAcked;
+
                 for (TcpCommunicationSpi spi : spis) {
                     GridNioServer srv = U.field(spi, "nioSrvr");
 
@@ -177,6 +181,14 @@ public class GridTcpCommunicationSpiRecoveryAckSelfTest<T extends CommunicationS
 
                             GridTestUtils.waitForCondition(new GridAbsPredicate() {
                                 @Override public boolean apply() {
+                                    long acked = GridTestUtils.getFieldValue(recoveryDesc, "acked");
+
+                                    return acked > totAcked0;
+                                }
+                            }, 5000);
+
+                            GridTestUtils.waitForCondition(new GridAbsPredicate() {
+                                @Override public boolean apply() {
                                     return recoveryDesc.messagesFutures().isEmpty();
                                 }
                             }, 10_000);
@@ -204,6 +216,8 @@ public class GridTcpCommunicationSpiRecoveryAckSelfTest<T extends CommunicationS
 
                     assertEquals(expMsgs, lsnr.rcvCnt.get());
                 }
+
+                totAcked += msgPerIter;
             }
         }
         finally {

http://git-wip-us.apache.org/repos/asf/ignite/blob/49c29886/modules/urideploy/src/test/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentFileProcessorSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/urideploy/src/test/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentFileProcessorSelfTest.java b/modules/urideploy/src/test/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentFileProcessorSelfTest.java
index b87551d..cbcac9c 100644
--- a/modules/urideploy/src/test/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentFileProcessorSelfTest.java
+++ b/modules/urideploy/src/test/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentFileProcessorSelfTest.java
@@ -20,7 +20,11 @@ package org.apache.ignite.spi.deployment.uri;
 import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.util.lang.GridAbsPredicate;
+import org.apache.ignite.internal.util.lang.GridAbsPredicateX;
 import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.config.GridTestProperties;
 import org.apache.ignite.testframework.junits.spi.GridSpiTest;
 import org.apache.ignite.testframework.junits.spi.GridSpiTestConfig;
@@ -69,7 +73,7 @@ public class GridUriDeploymentFileProcessorSelfTest extends GridUriDeploymentAbs
      *      if {@code false} then it should be undeployed.
      * @throws Exception If failed.
      */
-    private void proceedTest(String garFileName, String garDescFileName, String taskId, boolean deployed)
+    private void proceedTest(String garFileName, String garDescFileName, final String taskId, final boolean deployed)
         throws Exception {
         info("This test checks broken tasks. All exceptions that might happen are the part of the test.");
 
@@ -123,10 +127,17 @@ public class GridUriDeploymentFileProcessorSelfTest extends GridUriDeploymentAbs
         // Copy to deployment directory.
         U.copy(garFile, destDir, true);
 
-        // Wait for SPI
-        Thread.sleep(1000);
-
         try {
+            // Wait for SPI
+            GridTestUtils.waitForCondition(new GridAbsPredicateX() {
+                @Override public boolean applyx() throws IgniteCheckedException {
+                    if (deployed)
+                        return getSpi().findResource(taskId) != null;
+                    else
+                        return getSpi().findResource(taskId) == null;
+                }
+            }, 5000);
+
             if (deployed)
                 assert getSpi().findResource(taskId) != null;
             else


[08/13] ignite git commit: ignite-1.5 Corrected fix for hang on metadata update. Fix for ignite-647 (issues with dynamic cache start when fair affinity is used).

Posted by vo...@apache.org.
ignite-1.5 Corrected fix for hang on metadata update. Fix for ignite-647 (issues with dynamic cache start when fair affinity is used).


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

Branch: refs/heads/ignite-2206
Commit: 383f317d03aca8903aeaa00da903366911103cef
Parents: fe14099
Author: sboikov <sb...@gridgain.com>
Authored: Thu Dec 24 13:12:23 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Dec 24 13:12:23 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheProcessor.java    |  3 +-
 .../binary/CacheObjectBinaryProcessorImpl.java  |  3 +
 .../dht/atomic/GridDhtAtomicCache.java          | 89 ++++++++----------
 .../GridDhtPartitionsExchangeFuture.java        | 20 +++-
 ...ridNearOptimisticTxPrepareFutureAdapter.java | 10 +-
 .../ignite/IgniteCacheAffinitySelfTest.java     |  7 --
 .../fair/FairAffinityDynamicCacheSelfTest.java  | 17 +---
 .../cache/CrossCacheTxRandomOperationsTest.java |  2 -
 ...yMetadataUpdateChangingTopologySelfTest.java | 97 +++++++++++++-------
 ...dTcpCommunicationSpiRecoveryAckSelfTest.java |  3 +-
 .../TcpDiscoveryMulticastIpFinderSelfTest.java  | 21 ++++-
 .../IgniteCacheRestartTestSuite2.java           |  3 +
 .../stream/mqtt/IgniteMqttStreamerTest.java     | 33 ++++---
 13 files changed, 173 insertions(+), 135 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/383f317d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index 380c163..ff02e70 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -1961,7 +1961,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
                             if (req.initiatingNodeId() == null)
                                 desc.staticallyConfigured(true);
 
-                            desc.receivedOnDiscovery(true);
+                            if (joiningNodeId.equals(ctx.localNodeId()))
+                                desc.receivedOnDiscovery(true);
 
                             DynamicCacheDescriptor old = registeredCaches.put(maskNull(req.cacheName()), desc);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/383f317d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
index 7586a42..bcc2ab7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
@@ -491,6 +491,9 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
 
             AffinityTopologyVersion topVer = ctx.cache().context().lockedTopologyVersion(null);
 
+            if (topVer == null)
+                topVer = ctx.cache().context().exchange().readyAffinityVersion();
+
             BinaryObjectException err = metaDataCache.invoke(topVer, key, new MetadataProcessor(mergedMeta));
 
             if (err != null)

http://git-wip-us.apache.org/repos/asf/ignite/blob/383f317d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index 634a9ea..393413e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -1290,59 +1290,48 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
 
                         GridCacheReturn retVal = null;
 
-                        IgniteTxManager tm = ctx.tm();
+                        if (keys.size() > 1 &&                             // Several keys ...
+                            writeThrough() && !req.skipStore() &&          // and store is enabled ...
+                            !ctx.store().isLocal() &&                      // and this is not local store ...
+                            !ctx.dr().receiveEnabled()                     // and no DR.
+                            ) {
+                            // This method can only be used when there are no replicated entries in the batch.
+                            UpdateBatchResult updRes = updateWithBatch(node,
+                                hasNear,
+                                req,
+                                res,
+                                locked,
+                                ver,
+                                dhtFut,
+                                completionCb,
+                                ctx.isDrEnabled(),
+                                taskName,
+                                expiry,
+                                sndPrevVal);
 
-                        // Needed for metadata cache transaction.
-                        boolean set = tm.setTxTopologyHint(req.topologyVersion());
+                            deleted = updRes.deleted();
+                            dhtFut = updRes.dhtFuture();
 
-                        try {
-                            if (keys.size() > 1 &&                             // Several keys ...
-                                writeThrough() && !req.skipStore() &&          // and store is enabled ...
-                                !ctx.store().isLocal() &&                      // and this is not local store ...
-                                !ctx.dr().receiveEnabled()                     // and no DR.
-                                ) {
-                                // This method can only be used when there are no replicated entries in the batch.
-                                UpdateBatchResult updRes = updateWithBatch(node,
-                                    hasNear,
-                                    req,
-                                    res,
-                                    locked,
-                                    ver,
-                                    dhtFut,
-                                    completionCb,
-                                    ctx.isDrEnabled(),
-                                    taskName,
-                                    expiry,
-                                    sndPrevVal);
-
-                                deleted = updRes.deleted();
-                                dhtFut = updRes.dhtFuture();
-
-                                if (req.operation() == TRANSFORM)
-                                    retVal = updRes.invokeResults();
-                            }
-                            else {
-                                UpdateSingleResult updRes = updateSingle(node,
-                                    hasNear,
-                                    req,
-                                    res,
-                                    locked,
-                                    ver,
-                                    dhtFut,
-                                    completionCb,
-                                    ctx.isDrEnabled(),
-                                    taskName,
-                                    expiry,
-                                    sndPrevVal);
-
-                                retVal = updRes.returnValue();
-                                deleted = updRes.deleted();
-                                dhtFut = updRes.dhtFuture();
-                            }
+                            if (req.operation() == TRANSFORM)
+                                retVal = updRes.invokeResults();
                         }
-                        finally {
-                            if (set)
-                                tm.setTxTopologyHint(null);
+                        else {
+                            UpdateSingleResult updRes = updateSingle(node,
+                                hasNear,
+                                req,
+                                res,
+                                locked,
+                                ver,
+                                dhtFut,
+                                completionCb,
+                                ctx.isDrEnabled(),
+                                taskName,
+                                expiry,
+                                sndPrevVal);
+
+                            retVal = updRes.returnValue();
+                            deleted = updRes.deleted();
+                            dhtFut = updRes.dhtFuture();
                         }
 
                         if (retVal == null)

http://git-wip-us.apache.org/repos/asf/ignite/blob/383f317d/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 854726f..a10294f 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
@@ -329,6 +329,19 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
      * @return {@code True} if cache was added during this exchange.
      */
     public boolean isCacheAdded(int cacheId, AffinityTopologyVersion topVer) {
+        if (cacheStarted(cacheId))
+            return true;
+
+        GridCacheContext<?, ?> cacheCtx = cctx.cacheContext(cacheId);
+
+        return cacheCtx != null && F.eq(cacheCtx.startTopologyVersion(), topVer);
+    }
+
+    /**
+     * @param cacheId Cache ID.
+     * @return {@code True} if non-client cache was added during this exchange.
+     */
+    private boolean cacheStarted(int cacheId) {
         if (!F.isEmpty(reqs)) {
             for (DynamicCacheChangeRequest req : reqs) {
                 if (req.start() && !req.clientStartOnly()) {
@@ -338,9 +351,7 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
             }
         }
 
-        GridCacheContext<?, ?> cacheCtx = cctx.cacheContext(cacheId);
-
-        return cacheCtx != null && F.eq(cacheCtx.startTopologyVersion(), topVer);
+        return false;
     }
 
     /**
@@ -419,7 +430,8 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
         // If local node did not initiate exchange or local node is the only cache node in grid.
         Collection<ClusterNode> affNodes = CU.affinityNodes(cacheCtx, exchId.topologyVersion());
 
-        return !exchId.nodeId().equals(cctx.localNodeId()) ||
+        return cacheStarted(cacheCtx.cacheId()) ||
+            !exchId.nodeId().equals(cctx.localNodeId()) ||
             (affNodes.size() == 1 && affNodes.contains(cctx.localNode()));
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/383f317d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFutureAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFutureAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFutureAdapter.java
index fa7020b..fe6180a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFutureAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFutureAdapter.java
@@ -52,10 +52,16 @@ public abstract class GridNearOptimisticTxPrepareFutureAdapter extends GridNearT
         // Obtain the topology version to use.
         long threadId = Thread.currentThread().getId();
 
-        AffinityTopologyVersion topVer = cctx.mvcc().lastExplicitLockTopologyVersion(threadId);
+        AffinityTopologyVersion topVer = null;
+
+        if (tx.system())
+            topVer = tx.topologyVersionSnapshot();
+
+        if (topVer == null)
+            topVer = cctx.mvcc().lastExplicitLockTopologyVersion(threadId);
 
         // If there is another system transaction in progress, use it's topology version to prevent deadlock.
-        if (topVer == null && tx != null && tx.system())
+        if (topVer == null && tx.system())
             topVer = cctx.tm().lockedTopologyVersion(threadId, tx);
 
         if (topVer != null) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/383f317d/modules/core/src/test/java/org/apache/ignite/IgniteCacheAffinitySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/IgniteCacheAffinitySelfTest.java b/modules/core/src/test/java/org/apache/ignite/IgniteCacheAffinitySelfTest.java
index 3d76268..5b08f62 100644
--- a/modules/core/src/test/java/org/apache/ignite/IgniteCacheAffinitySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/IgniteCacheAffinitySelfTest.java
@@ -92,17 +92,10 @@ public class IgniteCacheAffinitySelfTest extends IgniteCacheAbstractTest {
         return new NearCacheConfiguration();
     }
 
-    /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        fail("Enable when https://issues.apache.org/jira/browse/IGNITE-647 is fixed.");
-    }
-
     /**
      * @throws Exception if failed.
      */
     public void testAffinity() throws Exception {
-        fail("Enable when https://issues.apache.org/jira/browse/IGNITE-647 is fixed.");
-
         checkAffinity();
 
         stopGrid(gridCount() - 1);

http://git-wip-us.apache.org/repos/asf/ignite/blob/383f317d/modules/core/src/test/java/org/apache/ignite/cache/affinity/fair/FairAffinityDynamicCacheSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/affinity/fair/FairAffinityDynamicCacheSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/affinity/fair/FairAffinityDynamicCacheSelfTest.java
index ef67495..4299935 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/affinity/fair/FairAffinityDynamicCacheSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/affinity/fair/FairAffinityDynamicCacheSelfTest.java
@@ -37,22 +37,11 @@ public class FairAffinityDynamicCacheSelfTest extends GridCommonAbstractTest {
     /** */
     private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
 
-    /** */
-    public FairAffinityDynamicCacheSelfTest(){
-        super(false);
-    }
-
     /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(gridName);
 
-        TcpDiscoverySpi disco = new TcpDiscoverySpi();
-
-        disco.setIpFinder(IP_FINDER);
-
-        cfg.getTransactionConfiguration().setTxSerializableEnabled(true);
-
-        cfg.setDiscoverySpi(disco);
+        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
 
         return cfg;
     }
@@ -71,8 +60,6 @@ public class FairAffinityDynamicCacheSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testStartStopCache() throws Exception {
-        fail("https://issues.apache.org/jira/browse/IGNITE-647");
-
         CacheConfiguration<Integer, Integer> cacheCfg = new CacheConfiguration<>();
 
         cacheCfg.setCacheMode(CacheMode.PARTITIONED);
@@ -94,6 +81,6 @@ public class FairAffinityDynamicCacheSelfTest extends GridCommonAbstractTest {
             }
         });
 
-        destFut.get(2000L);
+        destFut.get(5000L);
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/383f317d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheTxRandomOperationsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheTxRandomOperationsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheTxRandomOperationsTest.java
index d88f12f..2577d93 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheTxRandomOperationsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheTxRandomOperationsTest.java
@@ -126,8 +126,6 @@ public class CrossCacheTxRandomOperationsTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testCrossCacheTxOperationsFairAffinity() throws Exception {
-        fail("https://issues.apache.org/jira/browse/IGNITE-647");
-
         txOperations(PARTITIONED, FULL_SYNC, true, true);
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/383f317d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteBinaryMetadataUpdateChangingTopologySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteBinaryMetadataUpdateChangingTopologySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteBinaryMetadataUpdateChangingTopologySelfTest.java
index c95c586..9eaa848 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteBinaryMetadataUpdateChangingTopologySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteBinaryMetadataUpdateChangingTopologySelfTest.java
@@ -25,10 +25,12 @@ import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
 import java.util.concurrent.Callable;
+import javax.cache.processor.MutableEntry;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheEntryProcessor;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
@@ -48,7 +50,6 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.jetbrains.annotations.Nullable;
 
 /**
  * Tests specific scenario when binary metadata should be updated from a system thread
@@ -105,7 +106,7 @@ public class IgniteBinaryMetadataUpdateChangingTopologySelfTest extends GridComm
 
         IgniteCache<Object, Object> cache = ignite(0).cache("cache").withAsync();
 
-        cache.putAll(F.asMap(key1, "val1", key2, new TestValue()));
+        cache.putAll(F.asMap(key1, "val1", key2, new TestValue1()));
 
         try {
             Thread.sleep(500);
@@ -118,8 +119,47 @@ public class IgniteBinaryMetadataUpdateChangingTopologySelfTest extends GridComm
                 }
             });
 
+            Thread.sleep(1000);
+
+            spi.stopBlock();
+
+            cache.future().get();
+
+            fut.get();
+        }
+        finally {
+            stopGrid(4);
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testNoDeadlockInvoke() throws Exception {
+        int key1 = primaryKey(ignite(1).cache("cache"));
+        int key2 = primaryKey(ignite(2).cache("cache"));
+
+        TestCommunicationSpi spi = (TestCommunicationSpi)ignite(1).configuration().getCommunicationSpi();
+
+        spi.blockMessages(GridNearTxPrepareResponse.class, ignite(0).cluster().localNode().id());
+
+        IgniteCache<Object, Object> cache = ignite(0).cache("cache").withAsync();
+
+        cache.invokeAll(F.asSet(key1, key2), new TestEntryProcessor());
+
+        try {
             Thread.sleep(500);
 
+            IgniteInternalFuture<Void> fut = GridTestUtils.runAsync(new Callable<Void>() {
+                @Override public Void call() throws Exception {
+                    startGrid(4);
+
+                    return null;
+                }
+            });
+
+            Thread.sleep(1000);
+
             spi.stopBlock();
 
             cache.future().get();
@@ -145,12 +185,6 @@ public class IgniteBinaryMetadataUpdateChangingTopologySelfTest extends GridComm
         /** */
         private Map<Class<?>, Set<UUID>> blockCls = new HashMap<>();
 
-        /** */
-        private Class<?> recordCls;
-
-        /** */
-        private List<Object> recordedMsgs = new ArrayList<>();
-
         /** {@inheritDoc} */
         @Override public void sendMessage(ClusterNode node, Message msg, IgniteInClosure<IgniteException> ackC)
             throws IgniteSpiException {
@@ -158,9 +192,6 @@ public class IgniteBinaryMetadataUpdateChangingTopologySelfTest extends GridComm
                 Object msg0 = ((GridIoMessage)msg).message();
 
                 synchronized (this) {
-                    if (recordCls != null && msg0.getClass().equals(recordCls))
-                        recordedMsgs.add(msg0);
-
                     Set<UUID> blockNodes = blockCls.get(msg0.getClass());
 
                     if (F.contains(blockNodes, node.id())) {
@@ -178,28 +209,6 @@ public class IgniteBinaryMetadataUpdateChangingTopologySelfTest extends GridComm
         }
 
         /**
-         * @param recordCls Message class to record.
-         */
-        void record(@Nullable Class<?> recordCls) {
-            synchronized (this) {
-                this.recordCls = recordCls;
-            }
-        }
-
-        /**
-         * @return Recorded messages.
-         */
-        List<Object> recordedMessages() {
-            synchronized (this) {
-                List<Object> msgs = recordedMsgs;
-
-                recordedMsgs = new ArrayList<>();
-
-                return msgs;
-            }
-        }
-
-        /**
          * @param cls Message class.
          * @param nodeId Node ID.
          */
@@ -241,7 +250,27 @@ public class IgniteBinaryMetadataUpdateChangingTopologySelfTest extends GridComm
     /**
      *
      */
-    private static class TestValue {
+    static class TestEntryProcessor implements CacheEntryProcessor<Object, Object, Object> {
+        /** {@inheritDoc} */
+        @Override public Object process(MutableEntry<Object, Object> e, Object... arguments) {
+            e.setValue(new TestValue2());
+
+            return null;
+        }
+    }
+
+    /**
+     *
+     */
+    private static class TestValue1 {
+        /** Field1. */
+        private String field1;
+    }
+
+    /**
+     *
+     */
+    private static class TestValue2 {
         /** Field1. */
         private String field1;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/383f317d/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java
index 38e3d98..9e78fb9 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java
@@ -179,8 +179,7 @@ public class GridTcpCommunicationSpiRecoveryAckSelfTest<T extends CommunicationS
                                 @Override public boolean apply() {
                                     return recoveryDesc.messagesFutures().isEmpty();
                                 }
-                            }, spi.failureDetectionTimeoutEnabled() ? spi.failureDetectionTimeout() + 7000 :
-                                10_000);
+                            }, 10_000);
 
                             assertEquals("Unexpected messages: " + recoveryDesc.messagesFutures(), 0,
                                 recoveryDesc.messagesFutures().size());

http://git-wip-us.apache.org/repos/asf/ignite/blob/383f317d/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinderSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinderSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinderSelfTest.java
index b39be56..90fdb0a 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinderSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinderSelfTest.java
@@ -101,11 +101,11 @@ public class TcpDiscoveryMulticastIpFinderSelfTest
 
             assertEquals(1, addrs1.size());
             assertEquals(2, addrs2.size());
-            assertEquals(3, addrs3.size());
+            assertTrue("Unexpected number of addresses: " + addrs3, addrs3.size() == 2 || addrs3.size() == 3);
 
-            assertEquals(3, ipFinder1.getRegisteredAddresses().size());
-            assertEquals(3, ipFinder2.getRegisteredAddresses().size());
-            assertEquals(3, ipFinder3.getRegisteredAddresses().size());
+            checkRequestAddresses(ipFinder1, 3);
+            checkRequestAddresses(ipFinder2, 3);
+            checkRequestAddresses(ipFinder3, 3);
         }
         finally {
             if (ipFinder1 != null)
@@ -118,4 +118,17 @@ public class TcpDiscoveryMulticastIpFinderSelfTest
                 ipFinder3.close();
         }
     }
+
+    /**
+     * @param ipFinder IP finder.
+     * @param exp Expected number of addresses.
+     */
+    private void checkRequestAddresses(TcpDiscoveryMulticastIpFinder ipFinder, int exp) {
+        for (int i = 0; i < 10; i++) {
+            if (ipFinder.getRegisteredAddresses().size() == exp)
+                return;
+        }
+
+        assertEquals(exp, ipFinder.getRegisteredAddresses().size());
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/383f317d/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite2.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite2.java
index c9e9467..de87e99 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite2.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite2.java
@@ -21,6 +21,7 @@ import junit.framework.TestSuite;
 import org.apache.ignite.internal.processors.cache.GridCachePutAllFailoverSelfTest;
 import org.apache.ignite.internal.processors.cache.IgniteCacheAtomicPutAllFailoverSelfTest;
 import org.apache.ignite.internal.processors.cache.IgniteCachePutAllRestartTest;
+import org.apache.ignite.internal.processors.cache.distributed.IgniteBinaryMetadataUpdateNodeRestartTest;
 import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheAtomicNodeRestartTest;
 import org.apache.ignite.internal.processors.cache.distributed.replicated.IgniteCacheAtomicReplicatedNodeRestartSelfTest;
 
@@ -42,6 +43,8 @@ public class IgniteCacheRestartTestSuite2 extends TestSuite {
         suite.addTestSuite(IgniteCachePutAllRestartTest.class);
         suite.addTestSuite(GridCachePutAllFailoverSelfTest.class);
 
+        suite.addTestSuite(IgniteBinaryMetadataUpdateNodeRestartTest.class);
+
         return suite;
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/383f317d/modules/mqtt/src/test/java/org/apache/ignite/stream/mqtt/IgniteMqttStreamerTest.java
----------------------------------------------------------------------
diff --git a/modules/mqtt/src/test/java/org/apache/ignite/stream/mqtt/IgniteMqttStreamerTest.java b/modules/mqtt/src/test/java/org/apache/ignite/stream/mqtt/IgniteMqttStreamerTest.java
index 891866d..92a530d 100644
--- a/modules/mqtt/src/test/java/org/apache/ignite/stream/mqtt/IgniteMqttStreamerTest.java
+++ b/modules/mqtt/src/test/java/org/apache/ignite/stream/mqtt/IgniteMqttStreamerTest.java
@@ -87,7 +87,7 @@ public class IgniteMqttStreamerTest extends GridCommonAbstractTest {
     private MqttStreamer<Integer, String> streamer;
 
     /** The UUID of the currently active remote listener. */
-    private UUID remoteListener;
+    private UUID remoteLsnr;
 
     /** The Ignite data streamer. */
     private IgniteDataStreamer<Integer, String> dataStreamer;
@@ -105,7 +105,8 @@ public class IgniteMqttStreamerTest extends GridCommonAbstractTest {
     /**
      * @throws Exception If failed.
      */
-    @Before @SuppressWarnings("unchecked")
+    @Before
+    @SuppressWarnings("unchecked")
     public void beforeTest() throws Exception {
         grid().<Integer, String>getOrCreateCache(defaultCacheConfiguration());
 
@@ -121,13 +122,13 @@ public class IgniteMqttStreamerTest extends GridCommonAbstractTest {
         broker.setPersistenceAdapter(null);
         broker.setPersistenceFactory(null);
 
-        PolicyMap policyMap = new PolicyMap();
-        PolicyEntry policy = new PolicyEntry();
+        PolicyMap plcMap = new PolicyMap();
+        PolicyEntry plc = new PolicyEntry();
 
-        policy.setQueuePrefetch(1);
+        plc.setQueuePrefetch(1);
 
-        broker.setDestinationPolicy(policyMap);
-        broker.getDestinationPolicy().setDefaultEntry(policy);
+        broker.setDestinationPolicy(plcMap);
+        broker.getDestinationPolicy().setDefaultEntry(plc);
         broker.setSchedulerSupport(false);
 
         // add the MQTT transport connector to the broker
@@ -194,7 +195,9 @@ public class IgniteMqttStreamerTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testConnectionStatusWithBrokerDisconnection() throws Exception {
-        // configure streamer
+        fail("https://issues.apache.org/jira/browse/IGNITE-2255");
+
+        // Configure streamer.
         streamer.setSingleTupleExtractor(singleTupleExtractor());
         streamer.setTopic(SINGLE_TOPIC_NAME);
         streamer.setBlockUntilConnected(true);
@@ -202,8 +205,10 @@ public class IgniteMqttStreamerTest extends GridCommonAbstractTest {
 
         streamer.start();
 
-        // action time: repeat 5 times; make sure the connection state is kept correctly every time
+        // Action time: repeat 5 times; make sure the connection state is kept correctly every time.
         for (int i = 0; i < 5; i++) {
+            log.info("Iteration: " + i);
+
             assertTrue(streamer.isConnected());
 
             broker.stop();
@@ -355,7 +360,7 @@ public class IgniteMqttStreamerTest extends GridCommonAbstractTest {
     }
 
     /**
-     * @throws Exception
+     * @throws Exception If failed.
      */
     public void testSingleTopic_NoQoS_Reconnect() throws Exception {
         // configure streamer
@@ -557,7 +562,7 @@ public class IgniteMqttStreamerTest extends GridCommonAbstractTest {
         // Listen to cache PUT events and expect as many as messages as test data items
         final CountDownLatch latch = new CountDownLatch(expect);
 
-        IgniteBiPredicate<UUID, CacheEvent> callback = new IgniteBiPredicate<UUID, CacheEvent>() {
+        IgniteBiPredicate<UUID, CacheEvent> cb = new IgniteBiPredicate<UUID, CacheEvent>() {
             @Override public boolean apply(UUID uuid, CacheEvent evt) {
                 latch.countDown();
 
@@ -565,8 +570,8 @@ public class IgniteMqttStreamerTest extends GridCommonAbstractTest {
             }
         };
 
-        remoteListener = ignite.events(ignite.cluster().forCacheNodes(null))
-            .remoteListen(callback, null, EVT_CACHE_OBJECT_PUT);
+        remoteLsnr = ignite.events(ignite.cluster().forCacheNodes(null))
+            .remoteListen(cb, null, EVT_CACHE_OBJECT_PUT);
 
         return latch;
     }
@@ -586,7 +591,7 @@ public class IgniteMqttStreamerTest extends GridCommonAbstractTest {
         assertEquals(cnt, cache.size(CachePeekMode.ALL));
 
         // remove the event listener
-        grid().events(grid().cluster().forCacheNodes(null)).stopRemoteListen(remoteListener);
+        grid().events(grid().cluster().forCacheNodes(null)).stopRemoteListen(remoteLsnr);
     }
 
     /**


[05/13] ignite git commit: ignite-1.5 Implemented start of local node with specified configuration and custom environment variables.

Posted by vo...@apache.org.
ignite-1.5 Implemented start of local node with specified configuration and custom environment variables.


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

Branch: refs/heads/ignite-2206
Commit: 8f5445ab934c0133f45a87b220b5d4841c9bca43
Parents: 77e77e4
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Thu Dec 24 14:41:18 2015 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Thu Dec 24 14:41:18 2015 +0700

----------------------------------------------------------------------
 .../internal/visor/util/VisorTaskUtils.java     | 122 ++++++++++++++++++-
 1 file changed, 118 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/8f5445ab/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 579f50c..83dbda0 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
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.visor.util;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileFilter;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.RandomAccessFile;
 import java.net.InetAddress;
@@ -36,6 +37,7 @@ import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.SortedMap;
@@ -101,6 +103,9 @@ public class VisorTaskUtils {
     /** Log files count limit */
     public static final int LOG_FILES_COUNT_LIMIT = 5000;
 
+    /** */
+    private static final int DFLT_BUFFER_SIZE = 4096;
+
     /** Only task event types that Visor should collect. */
     public static final int[] VISOR_TASK_EVTS = {
         EVT_JOB_STARTED,
@@ -558,7 +563,7 @@ public class VisorTaskUtils {
         try (RandomAccessFile raf = new RandomAccessFile(f, "r")) {
             FileChannel ch = raf.getChannel();
 
-            ByteBuffer buf = ByteBuffer.allocate(4096);
+            ByteBuffer buf = ByteBuffer.allocate(DFLT_BUFFER_SIZE);
 
             ch.read(buf);
 
@@ -823,6 +828,85 @@ public class VisorTaskUtils {
     }
 
     /**
+     * Start local node in terminal.
+     *
+     * @param log Logger.
+     * @param cfgPath Path to node configuration to start with.
+     * @param nodesToStart Number of nodes to start.
+     * @param quite If {@code true} then start node in quiet mode.
+     * @param envVars Optional map with environment variables.
+     * @return List of started processes.
+     * @throws IOException If failed to start.
+     */
+    public static List<Process> startLocalNode(@Nullable IgniteLogger log, String cfgPath, int nodesToStart,
+        boolean quite, Map<String, String> envVars) throws IOException {
+        String quitePar = quite ? "" : "-v";
+
+        String cmdFile = new File("bin", U.isWindows() ? "ignite.bat" : "ignite.sh").getPath();
+
+        File cmdFilePath = U.resolveIgnitePath(cmdFile);
+
+        if (cmdFilePath == null || !cmdFilePath.exists())
+            throw new FileNotFoundException(String.format("File not found: %s", cmdFile));
+
+        String ignite = cmdFilePath.getCanonicalPath();
+
+        File nodesCfgPath = U.resolveIgnitePath(cfgPath);
+
+        if (nodesCfgPath == null || !nodesCfgPath.exists())
+            throw new FileNotFoundException(String.format("File not found: %s", cfgPath));
+
+        String nodeCfg = nodesCfgPath.getCanonicalPath();
+
+        log(log, String.format("Starting %s local %s with '%s' config", nodesToStart, nodesToStart > 1 ? "nodes" : "node", nodeCfg));
+
+        List<Process> run = new ArrayList<>();
+
+        try {
+            for (int i = 0; i < nodesToStart; i++) {
+                if (U.isMacOs()) {
+                    StringBuilder envs = new StringBuilder();
+
+                    Map<String, String> macEnv = new HashMap<>(System.getenv());
+
+                    if (envVars != null) {
+                        for (Map.Entry<String, String> ent : envVars.entrySet())
+                            if (macEnv.containsKey(ent.getKey())) {
+                                String old = macEnv.get(ent.getKey());
+
+                                if (old == null || old.isEmpty())
+                                    macEnv.put(ent.getKey(), ent.getValue());
+                                else
+                                    macEnv.put(ent.getKey(), old + ':' + ent.getValue());
+                            }
+                            else
+                                macEnv.put(ent.getKey(), ent.getValue());
+                    }
+
+                    for (Map.Entry<String, String> entry : macEnv.entrySet()) {
+                        String val = entry.getValue();
+
+                        if (val.indexOf(';') < 0 && val.indexOf('\'') < 0)
+                            envs.append(String.format("export %s='%s'; ",
+                                    entry.getKey(), val.replace('\n', ' ').replace("'", "\'")));
+                    }
+
+                    run.add(openInConsole(envs.toString(), ignite, quitePar, nodeCfg));
+                } else
+                    run.add(openInConsole(null, envVars, ignite, quitePar, nodeCfg));
+            }
+
+            return run;
+        }
+        catch (Exception e) {
+            for (Process proc: run)
+                proc.destroy();
+
+            throw e;
+        }
+    }
+
+    /**
      * Run command in separated console.
      *
      * @param args A string array containing the program and its arguments.
@@ -839,9 +923,22 @@ public class VisorTaskUtils {
      * @param workFolder Work folder for command.
      * @param args A string array containing the program and its arguments.
      * @return Started process.
+     * @throws IOException in case of error.
+     */
+    public static Process openInConsole(@Nullable File workFolder, String... args) throws IOException {
+        return openInConsole(workFolder, null, args);
+    }
+
+    /**
+     * Run command in separated console.
+     *
+     * @param workFolder Work folder for command.
+     * @param envVars Optional map with environment variables.
+     * @param args A string array containing the program and its arguments.
+     * @return Started process.
      * @throws IOException If failed to start process.
      */
-    public static Process openInConsole(@Nullable File workFolder, String... args)
+    public static Process openInConsole(@Nullable File workFolder, Map<String, String> envVars, String... args)
         throws IOException {
         String[] commands = args;
 
@@ -862,6 +959,23 @@ public class VisorTaskUtils {
         if (workFolder != null)
             pb.directory(workFolder);
 
+        if (envVars != null) {
+            String sep = U.isWindows() ? ";" : ":";
+
+            Map<String, String> goalVars = pb.environment();
+
+            for (Map.Entry<String, String> var: envVars.entrySet()) {
+                String envVar = goalVars.get(var.getKey());
+
+                if (envVar == null || envVar.isEmpty())
+                    envVar = var.getValue();
+                else
+                    envVar += sep + var.getValue();
+
+                goalVars.put(var.getKey(), envVar);
+            }
+        }
+
         return pb.start();
     }
 
@@ -873,7 +987,7 @@ public class VisorTaskUtils {
      * @throws IOException If failed.
      */
     public static byte[] zipBytes(byte[] input) throws IOException {
-        return zipBytes(input, 4096);
+        return zipBytes(input, DFLT_BUFFER_SIZE);
     }
 
     /**
@@ -904,4 +1018,4 @@ public class VisorTaskUtils {
 
         return bos.toByteArray();
     }
-}
\ No newline at end of file
+}


[13/13] ignite git commit: IGNITE-2206-debug: Dirty fix.

Posted by vo...@apache.org.
IGNITE-2206-debug: Dirty fix.


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

Branch: refs/heads/ignite-2206
Commit: 3a2db6e85a3b75ce2791a30a73c6aa6fa36fb856
Parents: 40d2291
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Mon Dec 28 13:17:33 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Mon Dec 28 13:17:33 2015 +0300

----------------------------------------------------------------------
 .../internal/processors/igfs/IgfsPaths.java     |  23 ++--
 .../hadoop/fs/v1/IgniteHadoopFileSystem.java    |   7 +-
 .../processors/hadoop/HadoopClassLoader.java    |  15 +++
 .../internal/processors/hadoop/TestMain.java    | 110 +++++++++++++++++++
 4 files changed, 137 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/3a2db6e8/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPaths.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPaths.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPaths.java
index 0bb581b..86f00cc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPaths.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPaths.java
@@ -33,6 +33,7 @@ import org.apache.ignite.igfs.IgfsMode;
 import org.apache.ignite.igfs.IgfsPath;
 import org.apache.ignite.internal.util.typedef.T2;
 import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.marshaller.jdk.JdkMarshaller;
 import org.jetbrains.annotations.Nullable;
 
 /**
@@ -74,16 +75,11 @@ public class IgfsPaths implements Externalizable {
         if (payload == null)
             payloadBytes = null;
         else {
-            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            ByteArrayOutputStream out = new ByteArrayOutputStream();
 
-            try (ObjectOutput oo = new ObjectOutputStream(baos)) {
-                oo.writeObject(payload);
-            }
-            catch (IOException e) {
-                throw new IgniteCheckedException("Failed to serialize secondary file system factory: " + payload, e);
-            }
+            new JdkMarshaller().marshal(payload, out);
 
-            payloadBytes = baos.toByteArray();
+            payloadBytes = out.toByteArray();
         }
     }
 
@@ -106,16 +102,13 @@ public class IgfsPaths implements Externalizable {
      *
      * @throws IgniteCheckedException If failed to deserialize the payload.
      */
-    @Nullable public Object getPayload() throws IgniteCheckedException {
+    @Nullable public Object getPayload(ClassLoader clsLdr) throws IgniteCheckedException {
         if (payloadBytes == null)
             return null;
         else {
-            try (ObjectInput oi = new ObjectInputStream(new ByteArrayInputStream(payloadBytes))) {
-                return oi.readObject();
-            }
-            catch (IOException | ClassNotFoundException e) {
-                throw new IgniteCheckedException("Failed to deserialize secondary file system factory. ", e);
-            }
+            ByteArrayInputStream in = new ByteArrayInputStream(payloadBytes);
+
+            return new JdkMarshaller().unmarshal(in, clsLdr);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/3a2db6e8/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java
index 14b6294..cd83630 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java
@@ -330,7 +330,9 @@ public class IgniteHadoopFileSystem extends FileSystem {
 
             if (initSecondary) {
                 try {
-                    factory = (HadoopFileSystemFactory) paths.getPayload();
+                    Object payload0 = paths.getPayload(getClass().getClassLoader());
+
+                    factory = (HadoopFileSystemFactory) paths.getPayload(getClass().getClassLoader());
                 }
                 catch (IgniteCheckedException e) {
                     throw new IOException("Failed to get secondary file system factory.", e);
@@ -505,8 +507,7 @@ public class IgniteHadoopFileSystem extends FileSystem {
                 }
 
                 secondaryFs.setOwner(toSecondary(p), username, grpName);
-            }
-            else if (rmtClient.update(convert(p), F.asMap(PROP_USER_NAME, username, PROP_GROUP_NAME, grpName)) == null)
+            } else if (rmtClient.update(convert(p), F.asMap(PROP_USER_NAME, username, PROP_GROUP_NAME, grpName)) == null)
                 throw new IOException("Failed to set file permission (file not found?)" +
                     " [path=" + p + ", userName=" + username + ", groupName=" + grpName + ']');
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/3a2db6e8/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopClassLoader.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopClassLoader.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopClassLoader.java
index f12af46..5d883ab 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopClassLoader.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopClassLoader.java
@@ -270,6 +270,15 @@ public class HadoopClassLoader extends URLClassLoader {
      * @return {@code true} If the class has external dependencies.
      */
     boolean hasExternalDependencies(final String clsName, final Set<String> visited) {
+        if (clsName.equals("org.apache.ignite.hadoop.fs.HadoopFileSystemFactory"))
+            return true;
+
+        if (clsName.contains("BasicHadoopFileSystemFactory"))
+            return true;
+
+        if (clsName.contains("CachingHadoopFileSystemFactory"))
+            return true;
+
         if (isHadoop(clsName)) // Hadoop must not be in classpath but Idea sucks, so filtering explicitly as external.
             return true;
 
@@ -361,6 +370,9 @@ public class HadoopClassLoader extends URLClassLoader {
             };
 
             void onClass(String depCls) {
+                if (clsName.equals("org.apache.ignite.hadoop.fs.HadoopFileSystemFactory"))
+                    System.out.println("ON_CLASS: " + depCls);
+
                 assert validateClassName(depCls) : depCls;
 
                 if (depCls.startsWith("java.")) // Filter out platform classes.
@@ -429,6 +441,9 @@ public class HadoopClassLoader extends URLClassLoader {
 
             @Override public MethodVisitor visitMethod(int i, String name, String desc, String signature,
                 String[] exceptions) {
+                if (clsName.equals("org.apache.ignite.hadoop.fs.HadoopFileSystemFactory"))
+                    System.out.println("VISIT_METHOD: " + name);
+
                 if (exceptions != null) {
                     for (String e : exceptions)
                         onType(e);

http://git-wip-us.apache.org/repos/asf/ignite/blob/3a2db6e8/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/TestMain.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/TestMain.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/TestMain.java
new file mode 100644
index 0000000..0cbdbac
--- /dev/null
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/TestMain.java
@@ -0,0 +1,110 @@
+package org.apache.ignite.internal.processors.hadoop;
+
+import org.objectweb.asm.Opcodes;
+import org.objectweb.asm.signature.SignatureReader;
+import org.objectweb.asm.signature.SignatureVisitor;
+
+/**
+ * Created by vozerov on 12/28/2015.
+ */
+public class TestMain {
+
+    public static void main(String[] args) {
+
+        String desc = "(Ljava/lang/String;)Lorg/apache/hadoop/fs/FileSystem;";
+
+        SignatureReader reader = new SignatureReader(desc);
+
+        reader.accept(new SignatureVisitor(Opcodes.ASM4) {
+            @Override
+            public void visitFormalTypeParameter(String name) {
+                System.out.println("visitFormalTypeParameter: " + name);
+
+                super.visitFormalTypeParameter(name);
+            }
+
+            @Override
+            public SignatureVisitor visitClassBound() {
+                return super.visitClassBound();
+            }
+
+            @Override
+            public SignatureVisitor visitInterfaceBound() {
+                return super.visitInterfaceBound();
+            }
+
+            @Override
+            public SignatureVisitor visitSuperclass() {
+                return super.visitSuperclass();
+            }
+
+            @Override
+            public SignatureVisitor visitInterface() {
+                return super.visitInterface();
+            }
+
+            @Override
+            public SignatureVisitor visitParameterType() {
+                return super.visitParameterType();
+            }
+
+            @Override
+            public SignatureVisitor visitReturnType() {
+                return super.visitReturnType();
+            }
+
+            @Override
+            public SignatureVisitor visitExceptionType() {
+                return super.visitExceptionType();
+            }
+
+            @Override
+            public void visitBaseType(char descriptor) {
+                super.visitBaseType(descriptor);
+            }
+
+            @Override
+            public void visitTypeVariable(String name) {
+                System.out.println("visitTypeVariable: " + name);
+
+                super.visitTypeVariable(name);
+            }
+
+            @Override
+            public SignatureVisitor visitArrayType() {
+                return super.visitArrayType();
+            }
+
+            @Override
+            public void visitClassType(String name) {
+                System.out.println("visitClassType: " + name);
+
+                super.visitClassType(name);
+            }
+
+            @Override
+            public void visitInnerClassType(String name) {
+                System.out.println("visitInnerClassType: " + name);
+
+                super.visitInnerClassType(name);
+            }
+
+            @Override
+            public void visitTypeArgument() {
+                super.visitTypeArgument();
+            }
+
+            @Override
+            public SignatureVisitor visitTypeArgument(char wildcard) {
+                System.out.println("visitTypeArgument: " + wildcard);
+
+                return super.visitTypeArgument(wildcard);
+            }
+
+            @Override
+            public void visitEnd() {
+                super.visitEnd();
+            }
+        });
+    }
+}


[07/13] ignite git commit: ignite-1.5 Fixed links.

Posted by vo...@apache.org.
ignite-1.5 Fixed links.


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

Branch: refs/heads/ignite-2206
Commit: fe140992581d196fd2abe9702c3a6ac28ee9ba47
Parents: 61c072e
Author: sboikov <sb...@gridgain.com>
Authored: Thu Dec 24 12:14:18 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Dec 24 12:14:18 2015 +0300

----------------------------------------------------------------------
 README.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/fe140992/README.txt
----------------------------------------------------------------------
diff --git a/README.txt b/README.txt
index f66f9ee..9133f2c 100644
--- a/README.txt
+++ b/README.txt
@@ -17,9 +17,9 @@ The main feature set of Ignite In-Memory Data Fabric includes:
 
 For information on how to get started with Apache Ignite please visit:
 
-    http://apacheignite.readme.io/v1.0/docs/getting-started
+    http://apacheignite.readme.io/docs/getting-started
 
 
 You can find Apache Ignite documentation here:
 
-    http://apacheignite.readme.io/v1.0/docs/getting-started
+    http://apacheignite.readme.io/docs


[04/13] ignite git commit: ignite-1.5 Fixed test.

Posted by vo...@apache.org.
ignite-1.5 Fixed test.


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

Branch: refs/heads/ignite-2206
Commit: 77e77e40fb9463ba3bccd01ddf3231ff9ef6f327
Parents: bd05fa9
Author: sboikov <sb...@gridgain.com>
Authored: Thu Dec 24 10:25:23 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Dec 24 10:25:23 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/internal/binary/BinaryMarshallerSelfTest.java | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/77e77e40/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java
index 9f7beb8..20b2258 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java
@@ -2532,11 +2532,10 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest {
 
             assertNull(bVal);
 
-            for (NonSerializableA a : bArr) {
+            for (NonSerializableA a : bArr)
                 a.checkAfterUnmarshalled();
-            }
 
-            assertEquals(floatVal, 567.89F);
+            assertEquals(floatVal, 567.89F, 0);
         }
     }
 


[02/13] ignite git commit: Merge branch 'ignite-2175' into ignite-1.5

Posted by vo...@apache.org.
Merge branch 'ignite-2175' into ignite-1.5


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

Branch: refs/heads/ignite-2206
Commit: 29c47784eb6d07c20d4d72000522668dd381c175
Parents: 9db05f5 60eec11
Author: Anton Vinogradov <av...@apache.org>
Authored: Wed Dec 23 17:32:28 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Wed Dec 23 17:32:28 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/processors/query/GridQueryProcessor.java    | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------



[09/13] ignite git commit: IGNITE-2252 Added support for cache sql schema in REST topology command - Fixes #374.

Posted by vo...@apache.org.
IGNITE-2252 Added support for cache sql schema in REST topology command - Fixes #374.

Signed-off-by: Andrey <an...@gridgain.com>


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

Branch: refs/heads/ignite-2206
Commit: debe34de1881f5a1268993ae584db70f16a761cf
Parents: 383f317
Author: Andrey <an...@gridgain.com>
Authored: Thu Dec 24 17:49:02 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Thu Dec 24 17:49:02 2015 +0700

----------------------------------------------------------------------
 .../JettyRestProcessorAbstractSelfTest.java     |  25 +++-
 .../connection/GridClientNioTcpConnection.java  |  17 +--
 .../client/message/GridClientCacheBean.java     | 139 +++++++++++++++++++
 .../rest/client/message/GridClientNodeBean.java |  70 ++++++----
 .../top/GridTopologyCommandHandler.java         |  38 +++--
 5 files changed, 230 insertions(+), 59 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/debe34de/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
index 4c73f78..4b1d47c 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
@@ -35,6 +35,7 @@ import java.util.regex.Pattern;
 import net.sf.json.JSONNull;
 import net.sf.json.JSONObject;
 import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.cache.CachePeekMode;
 import org.apache.ignite.cache.query.SqlQuery;
 import org.apache.ignite.cache.query.annotations.QuerySqlField;
@@ -45,7 +46,6 @@ import org.apache.ignite.internal.processors.cache.query.GridCacheSqlIndexMetada
 import org.apache.ignite.internal.processors.cache.query.GridCacheSqlMetadata;
 import org.apache.ignite.internal.processors.rest.handlers.GridRestCommandHandler;
 import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.internal.util.typedef.P1;
 import org.apache.ignite.lang.IgniteBiPredicate;
@@ -1054,11 +1054,28 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
             assertEquals(JSONNull.getInstance(), node.get("attributes"));
             assertEquals(JSONNull.getInstance(), node.get("metrics"));
 
-            assertEquals("PARTITIONED", node.get("defaultCacheMode"));
+            Collection<Map> caches = (Collection)node.get("caches");
 
-            Map caches = (Map)node.get("caches");
+            Collection<IgniteCacheProxy<?, ?>> publicCaches = grid(0).context().cache().publicCaches();
 
-            assertEquals(F.asMap("person", "PARTITIONED"), caches);
+            assertNotNull(caches);
+            assertEquals(publicCaches.size(), caches.size());
+
+            for (Map cache : caches) {
+                final String cacheName = cache.get("name").equals("") ? null : (String)cache.get("name");
+
+                IgniteCacheProxy<?, ?> publicCache = F.find(publicCaches, null, new P1<IgniteCacheProxy<?, ?>>() {
+                    @Override public boolean apply(IgniteCacheProxy<?, ?> c) {
+                        return F.eq(c.getName(), cacheName);
+                    }
+                });
+
+                assertNotNull(publicCache);
+
+                CacheMode cacheMode = CacheMode.valueOf((String)cache.get("mode"));
+
+                assertEquals(publicCache.getConfiguration(CacheConfiguration.class).getCacheMode(),cacheMode);
+            }
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/debe34de/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java b/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java
index 576df3a..cfcb07f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java
@@ -60,6 +60,7 @@ import org.apache.ignite.internal.processors.rest.client.message.GridClientCache
 import org.apache.ignite.internal.processors.rest.client.message.GridClientHandshakeRequest;
 import org.apache.ignite.internal.processors.rest.client.message.GridClientMessage;
 import org.apache.ignite.internal.processors.rest.client.message.GridClientNodeBean;
+import org.apache.ignite.internal.processors.rest.client.message.GridClientCacheBean;
 import org.apache.ignite.internal.processors.rest.client.message.GridClientNodeMetricsBean;
 import org.apache.ignite.internal.processors.rest.client.message.GridClientPingPacket;
 import org.apache.ignite.internal.processors.rest.client.message.GridClientResponse;
@@ -926,27 +927,17 @@ public class GridClientNioTcpConnection extends GridClientConnection {
         Map<String, GridClientCacheMode> caches = new HashMap<>();
 
         if (nodeBean.getCaches() != null) {
-            for (Map.Entry<String, String> e : nodeBean.getCaches().entrySet()) {
+            for (GridClientCacheBean cacheBean : nodeBean.getCaches()) {
                 try {
-                    caches.put(e.getKey(), GridClientCacheMode.valueOf(e.getValue()));
+                    caches.put(cacheBean.getName(), cacheBean.getMode());
                 }
                 catch (IllegalArgumentException ignored) {
                     log.warning("Invalid cache mode received from remote node (will ignore) [srv=" + serverAddress() +
-                        ", cacheName=" + e.getKey() + ", cacheMode=" + e.getValue() + ']');
+                        ", cacheName=" + cacheBean.getName() + ", cacheMode=" + cacheBean.getMode() + ']');
                 }
             }
         }
 
-        if (nodeBean.getDefaultCacheMode() != null) {
-            try {
-                caches.put(null, GridClientCacheMode.valueOf(nodeBean.getDefaultCacheMode()));
-            }
-            catch (IllegalArgumentException ignored) {
-                log.warning("Invalid cache mode received for default cache from remote node (will ignore) [srv="
-                    + serverAddress() + ", cacheMode=" + nodeBean.getDefaultCacheMode() + ']');
-            }
-        }
-
         if (!caches.isEmpty())
             nodeBuilder.caches(caches);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/debe34de/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientCacheBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientCacheBean.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientCacheBean.java
new file mode 100644
index 0000000..e055ec3
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientCacheBean.java
@@ -0,0 +1,139 @@
+/*
+ * 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.processors.rest.client.message;
+
+import java.io.Serializable;
+import org.apache.ignite.internal.client.GridClientCacheMode;
+
+/**
+ * Cache bean.
+ */
+public class GridClientCacheBean implements Serializable {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /**
+     * Cache name
+     */
+    private String name;
+
+    /**
+     * Cache mode
+     */
+    private GridClientCacheMode mode;
+
+    /**
+     * Custom name of the sql schema.
+     */
+    private String sqlSchema;
+
+    public GridClientCacheBean() {
+    }
+
+    public GridClientCacheBean(String name, GridClientCacheMode mode, String sqlSchema) {
+        this.name = name;
+        this.mode = mode;
+        this.sqlSchema = sqlSchema;
+    }
+
+    /**
+     * Gets cache name.
+     *
+     * @return Cache name.
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Sets cache name.
+     *
+     * @param name Cache name.
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * Gets cache mode.
+     *
+     * @return Cache mode.
+     */
+    public GridClientCacheMode getMode() {
+        return mode;
+    }
+
+    /**
+     * Sets cache mode.
+     *
+     * @param mode Cache mode.
+     */
+    public void setMode(GridClientCacheMode mode) {
+        this.mode = mode;
+    }
+
+    /**
+     * Gets custom name of the sql schema.
+     *
+     * @return Custom name of the sql schema.
+     */
+    public String getSqlSchema() {
+        return sqlSchema;
+    }
+
+    /**
+     * Sets custom name of the sql schema.
+     *
+     * @param sqlSchema Custom name of the sql schema.
+     */
+    public void setSqlSchema(String sqlSchema) {
+        this.sqlSchema = sqlSchema;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int hashCode() {
+        return name != null ? name.hashCode() : 0;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+
+        if (obj == null || getClass() != obj.getClass())
+            return false;
+
+        GridClientCacheBean other = (GridClientCacheBean) obj;
+
+        return name == null ? other.name == null : name.equals(other.name);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        return "GridClientCacheBean [name=" + name + ", mode=" + mode + ']';
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/debe34de/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientNodeBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientNodeBean.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientNodeBean.java
index 2a34c80..8ba6eb5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientNodeBean.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientNodeBean.java
@@ -21,10 +21,12 @@ import java.io.Externalizable;
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Map;
 import java.util.UUID;
+import org.apache.ignite.internal.client.GridClientCacheMode;
 import org.apache.ignite.internal.util.typedef.internal.U;
 
 /**
@@ -55,11 +57,8 @@ public class GridClientNodeBean implements Externalizable {
     /** Node attributes. */
     private Map<String, Object> attrs;
 
-    /** Mode for cache with {@code null} name. */
-    private String dfltCacheMode;
-
     /** Node caches. */
-    private Map<String, String> caches;
+    private Collection<GridClientCacheBean> caches;
 
     /**
      * Gets node ID.
@@ -177,40 +176,22 @@ public class GridClientNodeBean implements Externalizable {
     /**
      * Gets configured node caches.
      *
-     * @return Map where key is cache name and value is cache mode ("LOCAL", "REPLICATED", "PARTITIONED").
+     * @return Configured node caches.
      */
-    public Map<String, String> getCaches() {
+    public Collection<GridClientCacheBean> getCaches() {
         return caches;
     }
 
     /**
      * Sets configured node caches.
      *
-     * @param caches Map where key is cache name and value is cache mode ("LOCAL", "REPLICATED", "PARTITIONED").
+     * @param caches Configured node caches.
      */
-    public void setCaches(Map<String, String> caches) {
+    public void setCaches(Collection<GridClientCacheBean> caches) {
         this.caches = caches;
     }
 
     /**
-     * Gets mode for cache with null name.
-     *
-     * @return Default cache mode.
-     */
-    public String getDefaultCacheMode() {
-        return dfltCacheMode;
-    }
-
-    /**
-     * Sets mode for default cache.
-     *
-     * @param dfltCacheMode Default cache mode.
-     */
-    public void setDefaultCacheMode(String dfltCacheMode) {
-        this.dfltCacheMode = dfltCacheMode;
-    }
-
-    /**
      * Sets REST binary protocol port.
      *
      * @param tcpPort Port on which REST binary protocol is bound.
@@ -242,10 +223,25 @@ public class GridClientNodeBean implements Externalizable {
         out.writeInt(tcpPort);
         out.writeInt(0); // Jetty port.
 
+        String dfltCacheMode = null;
+
+        Map<String, String> cacheMap = null;
+
+        if (caches != null) {
+            cacheMap = U.newHashMap(caches.size());
+
+            for (GridClientCacheBean cacheBean : caches) {
+                if (cacheBean.getName() == null)
+                    dfltCacheMode = cacheBean.getMode().toString();
+                else
+                    cacheMap.put(cacheBean.getName(), cacheBean.getMode().toString());
+            }
+        }
+
         U.writeString(out, dfltCacheMode);
 
         U.writeMap(out, attrs);
-        U.writeMap(out, caches);
+        U.writeMap(out, cacheMap);
 
         U.writeCollection(out, tcpAddrs);
         U.writeCollection(out, tcpHostNames);
@@ -263,10 +259,24 @@ public class GridClientNodeBean implements Externalizable {
         tcpPort = in.readInt();
         in.readInt(); // Jetty port.
 
-        dfltCacheMode = U.readString(in);
+        String dfltCacheMode = U.readString(in);
 
         attrs = U.readMap(in);
-        caches = U.readMap(in);
+
+        Map<String, String> cacheMap = U.readMap(in);
+
+        if (cacheMap == null && dfltCacheMode != null) {
+            cacheMap = U.newHashMap(1);
+
+            cacheMap.put(null, dfltCacheMode);
+        }
+
+        if (cacheMap != null) {
+            caches = new ArrayList<>(cacheMap.size());
+
+            for (Map.Entry<String, String> e : cacheMap.entrySet())
+                caches.add(new GridClientCacheBean(e.getKey(), GridClientCacheMode.valueOf(e.getValue()), null));
+        }
 
         tcpAddrs = U.readCollection(in);
         tcpHostNames = U.readCollection(in);
@@ -283,4 +293,4 @@ public class GridClientNodeBean implements Externalizable {
     @Override public String toString() {
         return "GridClientNodeBean [id=" + nodeId + ']';
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/debe34de/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/top/GridTopologyCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/top/GridTopologyCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/top/GridTopologyCommandHandler.java
index f950ac2..297785e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/top/GridTopologyCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/top/GridTopologyCommandHandler.java
@@ -30,13 +30,17 @@ import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.cluster.ClusterMetrics;
 import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.internal.GridKernalContext;
 import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.client.GridClientCacheMode;
+import org.apache.ignite.internal.processors.cache.GridCacheProcessor;
 import org.apache.ignite.internal.processors.port.GridPortRecord;
 import org.apache.ignite.internal.processors.rest.GridRestCommand;
 import org.apache.ignite.internal.processors.rest.GridRestProtocol;
 import org.apache.ignite.internal.processors.rest.GridRestResponse;
 import org.apache.ignite.internal.processors.rest.client.message.GridClientNodeBean;
+import org.apache.ignite.internal.processors.rest.client.message.GridClientCacheBean;
 import org.apache.ignite.internal.processors.rest.client.message.GridClientNodeMetricsBean;
 import org.apache.ignite.internal.processors.rest.handlers.GridRestCommandHandlerAdapter;
 import org.apache.ignite.internal.processors.rest.request.GridRestRequest;
@@ -175,6 +179,22 @@ public class GridTopologyCommandHandler extends GridRestCommandHandlerAdapter {
     }
 
     /**
+     * Creates cache bean.
+     *
+     * @param ccfg Cache configuration.
+     * @return Cache bean.
+     */
+    public GridClientCacheBean createCacheBean(CacheConfiguration ccfg) {
+        GridClientCacheBean cacheBean = new GridClientCacheBean();
+
+        cacheBean.setName(ccfg.getName());
+        cacheBean.setMode(GridClientCacheMode.valueOf(ccfg.getCacheMode().toString()));
+        cacheBean.setSqlSchema(ccfg.getSqlSchema());
+
+        return cacheBean;
+    }
+
+    /**
      * Creates node bean out of grid node. Notice that cache attribute is handled separately.
      *
      * @param node Grid node.
@@ -194,22 +214,16 @@ public class GridTopologyCommandHandler extends GridRestCommandHandlerAdapter {
         nodeBean.setTcpAddresses(nonEmptyList(node.<Collection<String>>attribute(ATTR_REST_TCP_ADDRS)));
         nodeBean.setTcpHostNames(nonEmptyList(node.<Collection<String>>attribute(ATTR_REST_TCP_HOST_NAMES)));
 
-        Map<String, CacheMode> nodeCaches = ctx.discovery().nodeCaches(node);
-
-        Map<String, String> cacheMap = U.newHashMap(nodeCaches.size());
+        GridCacheProcessor cacheProc = ctx.cache();
 
-        for (Map.Entry<String, CacheMode> cache : nodeCaches.entrySet()) {
-            String cacheName = cache.getKey();
+        Map<String, CacheMode> nodeCaches = ctx.discovery().nodeCaches(node);
 
-            String mode = cache.getValue().toString();
+        Collection<GridClientCacheBean> caches = new ArrayList<>(nodeCaches.size());
 
-            if (cacheName != null)
-                cacheMap.put(cacheName, mode);
-            else
-                nodeBean.setDefaultCacheMode(mode);
-        }
+        for (String cacheName : nodeCaches.keySet())
+            caches.add(createCacheBean(cacheProc.cacheConfiguration(cacheName)));
 
-        nodeBean.setCaches(cacheMap);
+        nodeBean.setCaches(caches);
 
         if (mtr) {
             ClusterMetrics metrics = node.metrics();


[06/13] ignite git commit: ignite-1.5 Reverted BinaryContext.readResolve since it does not work from user thread and breaks tests

Posted by vo...@apache.org.
ignite-1.5 Reverted BinaryContext.readResolve since it does not work from user thread and breaks tests


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

Branch: refs/heads/ignite-2206
Commit: 61c072e51b16f6776e3e73252bfd5d7f09c0f21e
Parents: 8f5445a
Author: sboikov <sb...@gridgain.com>
Authored: Thu Dec 24 10:47:50 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Dec 24 10:47:50 2015 +0300

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


http://git-wip-us.apache.org/repos/asf/ignite/blob/61c072e5/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
index a27a3d0..5c63fbd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
@@ -743,7 +743,7 @@ public class BinaryContext implements Externalizable {
      */
     protected Object readResolve() throws ObjectStreamException {
         try {
-            IgniteKernal g = IgnitionEx.localIgnite();
+            IgniteKernal g = IgnitionEx.gridx(gridName);
 
             if (g == null)
                 throw new IllegalStateException("Failed to find grid for name: " + gridName);


[03/13] ignite git commit: ignite-2175

Posted by vo...@apache.org.
ignite-2175


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

Branch: refs/heads/ignite-2206
Commit: bd05fa90b1d04c8c488717302d55558d84fb02e1
Parents: 29c4778
Author: Anton Vinogradov <av...@apache.org>
Authored: Wed Dec 23 18:05:06 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Wed Dec 23 18:05:06 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/binary/BinaryContext.java   |   2 +-
 .../internal/binary/BinaryObjectImpl.java       |   2 +-
 .../ignite/tests/p2p/cache/PersonWrapper.java   | 121 +++++++++++++++++++
 .../processors/query/h2/IgniteH2Indexing.java   |   2 +-
 .../IgniteBinaryObjectFieldsQuerySelfTest.java  |  16 ++-
 ...eBinaryWrappedObjectFieldsQuerySelfTest.java |  28 +++++
 .../IgniteBinaryCacheQueryTestSuite.java        |   4 +
 .../IgniteCacheQuerySelfTestSuite.java          |   4 +
 8 files changed, 171 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/bd05fa90/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
index 5c63fbd..a27a3d0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
@@ -743,7 +743,7 @@ public class BinaryContext implements Externalizable {
      */
     protected Object readResolve() throws ObjectStreamException {
         try {
-            IgniteKernal g = IgnitionEx.gridx(gridName);
+            IgniteKernal g = IgnitionEx.localIgnite();
 
             if (g == null)
                 throw new IllegalStateException("Failed to find grid for name: " + gridName);

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd05fa90/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
index d712eb8..fca8955 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
@@ -533,7 +533,7 @@ public final class BinaryObjectImpl extends BinaryObjectExImpl implements Extern
      */
     private Object deserializeValue(@Nullable CacheObjectContext coCtx) {
         BinaryReaderExImpl reader = reader(null,
-            coCtx != null ? coCtx.kernalContext().config().getClassLoader() : null);
+            coCtx != null ? coCtx.kernalContext().config().getClassLoader() : ctx.configuration().getClassLoader());
 
         Object obj0 = reader.deserialize();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd05fa90/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/cache/PersonWrapper.java
----------------------------------------------------------------------
diff --git a/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/cache/PersonWrapper.java b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/cache/PersonWrapper.java
new file mode 100644
index 0000000..2655e39
--- /dev/null
+++ b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/cache/PersonWrapper.java
@@ -0,0 +1,121 @@
+/*
+ *  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.tests.p2p.cache;
+
+import java.io.Serializable;
+import org.apache.ignite.cache.query.annotations.QuerySqlField;
+
+/**
+ * Wraps Person class.
+ */
+public class PersonWrapper {
+    public static class Person implements Serializable {
+        /** */
+        @QuerySqlField
+        private String name;
+
+        /** */
+        @QuerySqlField(index = true)
+        private int id;
+
+        /** */
+        @QuerySqlField
+        private String lastName;
+
+        /** */
+        @QuerySqlField
+        private double salary;
+
+        /**
+         *
+         */
+        public Person() {
+            // No-op.
+        }
+
+        /**
+         * @param name Name.
+         */
+        public Person(String name) {
+            this.name = name;
+        }
+
+        /**
+         * @return Name.
+         */
+        public String name() {
+            return name;
+        }
+
+        /**
+         * @return Name.
+         */
+        public String getName() {
+            return name;
+        }
+
+        /**
+         * @param name Name.
+         */
+        public void setName(String name) {
+            this.name = name;
+        }
+
+        /**
+         * @return ID.
+         */
+        public int getId() {
+            return id;
+        }
+
+        /**
+         * @param id ID.
+         */
+        public void setId(int id) {
+            this.id = id;
+        }
+
+        /**
+         * @return Last name.
+         */
+        public String getLastName() {
+            return lastName;
+        }
+
+        /**
+         * @param lastName Last name.
+         */
+        public void setLastName(String lastName) {
+            this.lastName = lastName;
+        }
+
+        /**
+         * @return Salary.
+         */
+        public double getSalary() {
+            return salary;
+        }
+
+        /**
+         * @param salary Salary.
+         */
+        public void setSalary(double salary) {
+            this.salary = salary;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd05fa90/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index dead526..be72888 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -1584,7 +1584,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
         Schema rmv = schemas.remove(schema);
 
         if (rmv != null) {
-            space2schema.remove(rmv.spaceName);
+            space2schema.remove(emptyIfNull(rmv.spaceName));
             mapQryExec.onCacheStop(ccfg.getName());
 
             try {

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd05fa90/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectFieldsQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectFieldsQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectFieldsQuerySelfTest.java
index 5c1e578..fb53b8a 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectFieldsQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectFieldsQuerySelfTest.java
@@ -45,9 +45,6 @@ public class IgniteBinaryObjectFieldsQuerySelfTest extends GridCommonAbstractTes
     /** */
     public static final String PERSON_KEY_CLS_NAME = "org.apache.ignite.tests.p2p.cache.PersonKey";
 
-    /** */
-    public static final String PERSON_CLS_NAME = "org.apache.ignite.tests.p2p.cache.Person";
-
     /** IP finder. */
     private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
 
@@ -57,6 +54,14 @@ public class IgniteBinaryObjectFieldsQuerySelfTest extends GridCommonAbstractTes
     /** */
     private static ClassLoader extClassLoader;
 
+    /**
+     * Gets Person class name.
+     * @return class name.
+     */
+    protected String getPersonClassName(){
+        return "org.apache.ignite.tests.p2p.cache.Person";
+    }
+
     /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(gridName);
@@ -91,7 +96,8 @@ public class IgniteBinaryObjectFieldsQuerySelfTest extends GridCommonAbstractTes
         cache.setCacheMode(cacheMode);
         cache.setAtomicityMode(atomicity);
 
-        cache.setIndexedTypes(extClassLoader.loadClass(PERSON_KEY_CLS_NAME), extClassLoader.loadClass(PERSON_CLS_NAME));
+        cache.setIndexedTypes(extClassLoader.loadClass(PERSON_KEY_CLS_NAME),
+            extClassLoader.loadClass(getPersonClassName()));
 
         return cache;
     }
@@ -251,7 +257,7 @@ public class IgniteBinaryObjectFieldsQuerySelfTest extends GridCommonAbstractTes
      */
     private void populate(IgniteCache<Object, Object> cache) throws Exception {
         Class<?> keyCls = extClassLoader.loadClass(PERSON_KEY_CLS_NAME);
-        Class<?> cls = extClassLoader.loadClass(PERSON_CLS_NAME);
+        Class<?> cls = extClassLoader.loadClass(getPersonClassName());
 
         for (int i = 0; i < 100; i++) {
             Object key = keyCls.newInstance();

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd05fa90/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryWrappedObjectFieldsQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryWrappedObjectFieldsQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryWrappedObjectFieldsQuerySelfTest.java
new file mode 100644
index 0000000..923d601
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryWrappedObjectFieldsQuerySelfTest.java
@@ -0,0 +1,28 @@
+/*
+ *  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.processors.cache;
+
+/**
+ * Tests that server nodes do not need class definitions to execute queries.
+ * Used internal class.
+ */
+public class IgniteBinaryWrappedObjectFieldsQuerySelfTest extends IgniteBinaryObjectFieldsQuerySelfTest {
+    /** {@inheritDoc} */
+    protected String getPersonClassName() {
+        return "org.apache.ignite.tests.p2p.cache.PersonWrapper$Person";
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd05fa90/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheQueryTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheQueryTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheQueryTestSuite.java
index b145a90..eddfcf4 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheQueryTestSuite.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheQueryTestSuite.java
@@ -33,6 +33,8 @@ import org.apache.ignite.internal.processors.cache.GridCacheQueryIndexingDisable
 import org.apache.ignite.internal.processors.cache.GridCacheQueryInternalKeysSelfTest;
 import org.apache.ignite.internal.processors.cache.GridCacheQuerySerializationSelfTest;
 import org.apache.ignite.internal.processors.cache.GridCacheReduceQueryMultithreadedSelfTest;
+import org.apache.ignite.internal.processors.cache.IgniteBinaryObjectFieldsQuerySelfTest;
+import org.apache.ignite.internal.processors.cache.IgniteBinaryWrappedObjectFieldsQuerySelfTest;
 import org.apache.ignite.internal.processors.cache.IgniteCacheBinaryObjectsScanSelfTest;
 import org.apache.ignite.internal.processors.cache.IgniteCacheCollocatedQuerySelfTest;
 import org.apache.ignite.internal.processors.cache.IgniteCacheDuplicateEntityConfigurationSelfTest;
@@ -160,6 +162,8 @@ public class IgniteBinaryCacheQueryTestSuite extends TestSuite {
         suite.addTestSuite(GridCacheCrossCacheQuerySelfTest.class);
         suite.addTestSuite(GridCacheQuerySerializationSelfTest.class);
         suite.addTestSuite(IgniteCacheBinaryObjectsScanSelfTest.class);
+        suite.addTestSuite(IgniteBinaryObjectFieldsQuerySelfTest.class);
+        suite.addTestSuite(IgniteBinaryWrappedObjectFieldsQuerySelfTest.class);
 
         // Scan queries.
         suite.addTestSuite(CacheScanPartitionQueryFallbackSelfTest.class);

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd05fa90/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 7c8d1d7..4b1eafa 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
@@ -30,6 +30,8 @@ import org.apache.ignite.internal.processors.cache.GridCacheQueryIndexingDisable
 import org.apache.ignite.internal.processors.cache.GridCacheQueryInternalKeysSelfTest;
 import org.apache.ignite.internal.processors.cache.GridCacheQuerySerializationSelfTest;
 import org.apache.ignite.internal.processors.cache.GridCacheReduceQueryMultithreadedSelfTest;
+import org.apache.ignite.internal.processors.cache.IgniteBinaryObjectFieldsQuerySelfTest;
+import org.apache.ignite.internal.processors.cache.IgniteBinaryWrappedObjectFieldsQuerySelfTest;
 import org.apache.ignite.internal.processors.cache.IgniteCacheCollocatedQuerySelfTest;
 import org.apache.ignite.internal.processors.cache.IgniteCacheDuplicateEntityConfigurationSelfTest;
 import org.apache.ignite.internal.processors.cache.IgniteCacheFieldsQueryNoDataSelfTest;
@@ -149,6 +151,8 @@ public class IgniteCacheQuerySelfTestSuite extends TestSuite {
         suite.addTestSuite(GridCacheReduceQueryMultithreadedSelfTest.class);
         suite.addTestSuite(GridCacheCrossCacheQuerySelfTest.class);
         suite.addTestSuite(GridCacheQuerySerializationSelfTest.class);
+        suite.addTestSuite(IgniteBinaryObjectFieldsQuerySelfTest.class);
+        suite.addTestSuite(IgniteBinaryWrappedObjectFieldsQuerySelfTest.class);
 
         // Scan queries.
         suite.addTestSuite(CacheScanPartitionQueryFallbackSelfTest.class);


[12/13] ignite git commit: Merge branch 'ignite-1.5' into ignite-2206

Posted by vo...@apache.org.
Merge branch 'ignite-1.5' into ignite-2206


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

Branch: refs/heads/ignite-2206
Commit: 40d2291a5a0cd565884d01bf5783b77b565e6742
Parents: eb14e68 18c413c
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Sat Dec 26 16:31:57 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Sat Dec 26 16:31:57 2015 +0300

----------------------------------------------------------------------
 README.txt                                      |   4 +-
 .../JettyRestProcessorAbstractSelfTest.java     |  25 +++-
 .../ignite/internal/binary/BinaryContext.java   |  44 +-----
 .../internal/binary/BinaryEnumObjectImpl.java   |   4 +-
 .../internal/binary/BinaryObjectImpl.java       |  29 ++--
 .../internal/binary/GridBinaryMarshaller.java   |  82 ++++++++++-
 .../connection/GridClientNioTcpConnection.java  |  17 +--
 .../processors/cache/GridCacheProcessor.java    |   3 +-
 .../binary/CacheObjectBinaryProcessorImpl.java  |   3 +
 .../dht/atomic/GridDhtAtomicCache.java          |  89 ++++++------
 .../GridDhtPartitionsExchangeFuture.java        |  20 ++-
 ...ridNearOptimisticTxPrepareFutureAdapter.java |  10 +-
 .../processors/query/GridQueryProcessor.java    |   5 +
 .../client/message/GridClientCacheBean.java     | 139 +++++++++++++++++++
 .../rest/client/message/GridClientNodeBean.java |  70 ++++++----
 .../top/GridTopologyCommandHandler.java         |  38 +++--
 .../util/nio/GridNioRecoveryDescriptor.java     |   7 -
 .../ignite/internal/util/nio/GridNioServer.java |   7 +
 .../internal/visor/util/VisorTaskUtils.java     | 122 +++++++++++++++-
 .../communication/tcp/TcpCommunicationSpi.java  |  12 +-
 .../ignite/IgniteCacheAffinitySelfTest.java     |   7 -
 .../fair/FairAffinityDynamicCacheSelfTest.java  |  17 +--
 .../binary/BinaryMarshallerSelfTest.java        |   5 +-
 .../cache/CrossCacheTxRandomOperationsTest.java |   2 -
 ...yMetadataUpdateChangingTopologySelfTest.java |  97 ++++++++-----
 .../internal/util/nio/GridNioSelfTest.java      | 127 ++++++++++-------
 ...dTcpCommunicationSpiRecoveryAckSelfTest.java |  17 ++-
 .../TcpDiscoveryMulticastIpFinderSelfTest.java  |  21 ++-
 .../IgniteCacheRestartTestSuite2.java           |   3 +
 .../ignite/tests/p2p/cache/PersonWrapper.java   | 121 ++++++++++++++++
 .../processors/query/h2/IgniteH2Indexing.java   |   2 +-
 .../IgniteBinaryObjectFieldsQuerySelfTest.java  |  16 ++-
 ...eBinaryWrappedObjectFieldsQuerySelfTest.java |  28 ++++
 .../IgniteBinaryCacheQueryTestSuite.java        |   4 +
 .../IgniteCacheQuerySelfTestSuite.java          |   4 +
 .../stream/mqtt/IgniteMqttStreamerTest.java     |  33 +++--
 .../GridUriDeploymentFileProcessorSelfTest.java |  19 ++-
 37 files changed, 914 insertions(+), 339 deletions(-)
----------------------------------------------------------------------