You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/08/18 18:45:58 UTC

[01/11] incubator-ignite git commit: ignite-1241-dev: fixed endless "failure detection threshold" warnings for the case when there is only one server and client nodes in the topology

Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-gg-10606 ddbbffb07 -> 53143f932


ignite-1241-dev: fixed endless "failure detection threshold" warnings for the case when there is only one server and client nodes in the topology


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

Branch: refs/heads/ignite-gg-10606
Commit: 38070b28bdda9e95b125f27706037c9916edeeb6
Parents: 7760847
Author: Denis Magda <dm...@gridgain.com>
Authored: Fri Aug 14 16:20:18 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Fri Aug 14 16:20:18 2015 +0300

----------------------------------------------------------------------
 .../ignite/spi/discovery/tcp/ServerImpl.java    | 26 ++++++++++++++------
 .../spi/discovery/tcp/TcpDiscoveryImpl.java     |  4 +--
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |  4 ---
 .../tcp/internal/TcpDiscoveryNode.java          | 18 +++++++-------
 .../tcp/internal/TcpDiscoveryNodesRing.java     | 23 +++++++++++++++++
 5 files changed, 53 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/38070b28/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index 76144e3..c8c4c50 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -628,9 +628,9 @@ class ServerImpl extends TcpDiscoveryImpl {
     }
 
     /** {@inheritDoc} */
-    @Override protected void onDataReceived() {
+    @Override protected void onMessageExchanged() {
         if (spi.failureDetectionTimeoutEnabled() && locNode != null)
-            locNode.lastDataReceivedTime(U.currentTimeMillis());
+            locNode.lastExchangeTime(U.currentTimeMillis());
     }
 
     /**
@@ -1916,9 +1916,13 @@ class ServerImpl extends TcpDiscoveryImpl {
             if (spi.ensured(msg))
                 msgHist.add(msg);
 
-            if (msg.senderNodeId() != null && !msg.senderNodeId().equals(getLocalNodeId()))
-                // Reset the flag.
+            if (msg.senderNodeId() != null && !msg.senderNodeId().equals(getLocalNodeId())) {
+                // Received a message from remote node.
+                onMessageExchanged();
+
+                // Reset the failure flag.
                 failureThresholdReached = false;
+            }
 
             spi.stats.onMessageProcessingFinished(msg);
         }
@@ -2278,6 +2282,8 @@ class ServerImpl extends TcpDiscoveryImpl {
 
                                 int res = spi.readReceipt(sock, timeoutHelper.nextTimeoutChunk(ackTimeout0));
 
+                                onMessageExchanged();
+
                                 if (log.isDebugEnabled())
                                     log.debug("Message has been sent to next node [msg=" + msg +
                                         ", next=" + next.id() +
@@ -4104,9 +4110,12 @@ class ServerImpl extends TcpDiscoveryImpl {
          * Check connection aliveness status.
          */
         private void checkConnection() {
+            Boolean hasRemoteSrvNodes = null;
+
             if (spi.failureDetectionTimeoutEnabled() && !failureThresholdReached &&
-                U.currentTimeMillis() - locNode.lastDataReceivedTime() >= connCheckThreshold &&
-                ring.hasRemoteNodes() && spiStateCopy() == CONNECTED) {
+                U.currentTimeMillis() - locNode.lastExchangeTime() >= connCheckThreshold &&
+                spiStateCopy() == CONNECTED &&
+                (hasRemoteSrvNodes = ring.hasRemoteServerNodes())) {
 
                 log.info("Local node seems to be disconnected from topology (failure detection timeout " +
                     "is reached): [failureDetectionTimeout=" + spi.failureDetectionTimeout() +
@@ -4123,7 +4132,10 @@ class ServerImpl extends TcpDiscoveryImpl {
             if (elapsed > 0)
                 return;
 
-            if (ring.hasRemoteNodes()) {
+            if (hasRemoteSrvNodes == null)
+                hasRemoteSrvNodes = ring.hasRemoteServerNodes();
+
+            if (hasRemoteSrvNodes) {
                 sendMessageAcrossRing(new TcpDiscoveryConnectionCheckMessage(locNode));
 
                 lastTimeConnCheckMsgSent = U.currentTimeMillis();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/38070b28/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryImpl.java
index e25f0b6..14d037d 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryImpl.java
@@ -132,9 +132,9 @@ abstract class TcpDiscoveryImpl {
     }
 
     /**
-     * Called when a chunk of data is received from a remote node.
+     * Called when a local node either received from or sent to a remote node a message.
      */
-    protected void onDataReceived() {
+    protected void onMessageExchanged() {
         // No-op
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/38070b28/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
index 18a540c..74dc36c 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
@@ -1371,8 +1371,6 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
 
             T res = marsh.unmarshal(in == null ? sock.getInputStream() : in, U.gridClassLoader());
 
-            impl.onDataReceived();
-
             return res;
         }
         catch (IOException | IgniteCheckedException e) {
@@ -1414,8 +1412,6 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
             if (res == -1)
                 throw new EOFException();
 
-            impl.onDataReceived();
-
             return res;
         }
         catch (SocketTimeoutException e) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/38070b28/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java
index 44e9006..135dc59 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java
@@ -89,8 +89,8 @@ public class TcpDiscoveryNode extends GridMetadataAwareAdapter implements Cluste
     @GridToStringExclude
     private volatile long lastUpdateTime = U.currentTimeMillis();
 
-    /** The most recent time when a data chunk was received from a node. */
-    private volatile long lastDataReceivedTime = U.currentTimeMillis();
+    /** The most recent time when node exchanged a message with a remote node. */
+    private volatile long lastExchangeTime = U.currentTimeMillis();
 
     /** Metrics provider (transient). */
     @GridToStringExclude
@@ -393,21 +393,21 @@ public class TcpDiscoveryNode extends GridMetadataAwareAdapter implements Cluste
     }
 
     /**
-     * Gets the last time a node received a data chunk from a remote node.
+     * Gets the last time a node exchanged a message with a remote node.
      *
      * @return Time in milliseconds.
      */
-    public long lastDataReceivedTime() {
-        return lastDataReceivedTime;
+    public long lastExchangeTime() {
+        return lastExchangeTime;
     }
 
     /**
-     * Sets the last time a node receive a data chunk from a remote node in a topology.
+     * Sets the last time a node exchanged a message with a remote node.
      *
-     * @param lastDataReceivedTime Time in milliseconds.
+     * @param lastExchangeTime Time in milliseconds.
      */
-    public void lastDataReceivedTime(long lastDataReceivedTime) {
-        this.lastDataReceivedTime = lastDataReceivedTime;
+    public void lastExchangeTime(long lastExchangeTime) {
+        this.lastExchangeTime = lastExchangeTime;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/38070b28/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNodesRing.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNodesRing.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNodesRing.java
index acb479d..2422e14 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNodesRing.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNodesRing.java
@@ -152,6 +152,29 @@ public class TcpDiscoveryNodesRing {
     }
 
     /**
+     * Checks whether the topology has remote server nodes in.
+     *
+     * @return {@code true} if the topology has remote server nodes in.
+     */
+    public boolean hasRemoteServerNodes() {
+        rwLock.readLock().lock();
+
+        try {
+            if (nodes.size() < 2)
+                return false;
+
+            for (TcpDiscoveryNode node : nodes)
+                if (!node.isClient() && !node.id().equals(locNode.id()))
+                    return true;
+
+            return false;
+        }
+        finally {
+            rwLock.readLock().unlock();
+        }
+    }
+
+    /**
      * Adds node to topology, also initializes node last update time with current
      * system time.
      *


[06/11] incubator-ignite git commit: master - index sort fix for merge tables

Posted by sb...@apache.org.
master - index sort fix for merge tables


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

Branch: refs/heads/ignite-gg-10606
Commit: 9c939bec1bfa2c3396051c155ffb06775a329aad
Parents: 952c7fc
Author: S.Vladykin <sv...@gridgain.com>
Authored: Mon Aug 17 21:23:26 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Mon Aug 17 21:23:26 2015 +0300

----------------------------------------------------------------------
 .../internal/processors/query/h2/twostep/GridMergeTable.java  | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9c939bec/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeTable.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeTable.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeTable.java
index 0b335d3..7d2235d 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeTable.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeTable.java
@@ -35,9 +35,6 @@ public class GridMergeTable extends TableBase {
     private final GridKernalContext ctx;
 
     /** */
-    private final ArrayList<Index> idxs = new ArrayList<>(1);
-
-    /** */
     private final GridMergeIndex idx;
 
     /**
@@ -49,8 +46,6 @@ public class GridMergeTable extends TableBase {
 
         this.ctx = ctx;
         idx = new GridMergeIndexUnsorted(this, "merge_scan");
-
-        idxs.add(idx);
     }
 
     /**
@@ -124,7 +119,7 @@ public class GridMergeTable extends TableBase {
 
     /** {@inheritDoc} */
     @Override public ArrayList<Index> getIndexes() {
-        return idxs;
+        return null;
     }
 
     /** {@inheritDoc} */


[03/11] incubator-ignite git commit: Squashed commit for ignite-1239

Posted by sb...@apache.org.
Squashed commit for ignite-1239


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

Branch: refs/heads/ignite-gg-10606
Commit: 45c813af7eb4a11ec59d3477a6a0b68791f1d7f2
Parents: 7635e58
Author: Denis Magda <dm...@gridgain.com>
Authored: Mon Aug 17 16:51:41 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Mon Aug 17 16:51:41 2015 +0300

----------------------------------------------------------------------
 .../GridDhtUnreservedPartitionException.java    | 66 ++++++++++++++
 .../cache/query/GridCacheQueryAdapter.java      | 56 ++++++++++--
 .../cache/query/GridCacheQueryManager.java      | 71 ++++++++++-----
 ...CacheScanPartitionQueryFallbackSelfTest.java | 96 ++++++++++++++++++++
 4 files changed, 261 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/45c813af/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnreservedPartitionException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnreservedPartitionException.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnreservedPartitionException.java
new file mode 100644
index 0000000..d824a47
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnreservedPartitionException.java
@@ -0,0 +1,66 @@
+/*
+ * 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.distributed.dht;
+
+import org.apache.ignite.*;
+import org.apache.ignite.internal.processors.affinity.*;
+
+/**
+ * Exception that is thrown when a partition reservation failed.
+ */
+public class GridDhtUnreservedPartitionException extends IgniteCheckedException {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Partition. */
+    private final int part;
+
+    /** Topology version. */
+    private final AffinityTopologyVersion topVer;
+
+    /**
+     * @param part Partition.
+     * @param topVer Affinity topology version.
+     * @param msg Message.
+     */
+    public GridDhtUnreservedPartitionException(int part, AffinityTopologyVersion topVer, String msg) {
+        super(msg);
+
+        this.part = part;
+        this.topVer = topVer;
+    }
+
+    /**
+     * @return Partition.
+     */
+    public int partition() {
+        return part;
+    }
+
+    /**
+     * @return Affinity topology version.
+     */
+    public AffinityTopologyVersion topologyVersion() {
+        return topVer;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return getClass() + " [part=" + part + ", msg=" + getMessage() + ']';
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/45c813af/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
index 953cb9a..90f9b9e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
@@ -25,6 +25,7 @@ import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.cluster.*;
 import org.apache.ignite.internal.processors.affinity.*;
 import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.internal.processors.cache.distributed.dht.*;
 import org.apache.ignite.internal.processors.query.*;
 import org.apache.ignite.internal.util.future.*;
 import org.apache.ignite.internal.util.typedef.*;
@@ -457,7 +458,7 @@ public class GridCacheQueryAdapter<T> implements CacheQuery<T> {
             return (CacheQueryFuture<R>)(loc ? qryMgr.queryFieldsLocal(bean) :
                 qryMgr.queryFieldsDistributed(bean, nodes));
         else if (type == SCAN && part != null && nodes.size() > 1)
-            return new CacheQueryFallbackFuture<>(nodes, bean, qryMgr);
+            return new CacheQueryFallbackFuture<>(nodes, part, bean, qryMgr, cctx);
         else
             return (CacheQueryFuture<R>)(loc ? qryMgr.queryLocal(bean) : qryMgr.queryDistributed(bean, nodes));
     }
@@ -554,7 +555,13 @@ public class GridCacheQueryAdapter<T> implements CacheQuery<T> {
         private volatile GridCacheQueryFutureAdapter<?, ?, R> fut;
 
         /** Backups. */
-        private final Queue<ClusterNode> nodes;
+        private volatile Queue<ClusterNode> nodes;
+
+        /** Topology version of the last detected {@link GridDhtUnreservedPartitionException}. */
+        private volatile AffinityTopologyVersion unreservedTopVer;
+
+        /** Number of times to retry the query on the nodes failed with {@link GridDhtUnreservedPartitionException}. */
+        private volatile int unreservedNodesRetryCnt = 5;
 
         /** Bean. */
         private final GridCacheQueryBean bean;
@@ -562,16 +569,26 @@ public class GridCacheQueryAdapter<T> implements CacheQuery<T> {
         /** Query manager. */
         private final GridCacheQueryManager qryMgr;
 
+        /** Cache context. */
+        private final GridCacheContext cctx;
+
+        /** Partition. */
+        private final int part;
+
         /**
          * @param nodes Backups.
+         * @param part Partition.
          * @param bean Bean.
          * @param qryMgr Query manager.
+         * @param cctx Cache context.
          */
-        public CacheQueryFallbackFuture(Collection<ClusterNode> nodes, GridCacheQueryBean bean,
-            GridCacheQueryManager qryMgr) {
+        public CacheQueryFallbackFuture(Collection<ClusterNode> nodes, int part, GridCacheQueryBean bean,
+            GridCacheQueryManager qryMgr, GridCacheContext cctx) {
             this.nodes = fallbacks(nodes);
             this.bean = bean;
             this.qryMgr = qryMgr;
+            this.cctx = cctx;
+            this.part = part;
 
             init();
         }
@@ -598,7 +615,7 @@ public class GridCacheQueryAdapter<T> implements CacheQuery<T> {
          */
         @SuppressWarnings("unchecked")
         private void init() {
-            ClusterNode node = nodes.poll();
+            final ClusterNode node = nodes.poll();
 
             GridCacheQueryFutureAdapter<?, ?, R> fut0 = (GridCacheQueryFutureAdapter<?, ?, R>)(node.isLocal() ?
                 qryMgr.queryLocal(bean) :
@@ -613,8 +630,33 @@ public class GridCacheQueryAdapter<T> implements CacheQuery<T> {
                         onDone(e);
                     }
                     catch (IgniteCheckedException e) {
-                        if (F.isEmpty(nodes))
-                            onDone(e);
+                        if (e.hasCause(GridDhtUnreservedPartitionException.class)) {
+                            unreservedTopVer = ((GridDhtUnreservedPartitionException)e.getCause()).topologyVersion();
+
+                            assert unreservedTopVer != null;
+                        }
+
+                        if (F.isEmpty(nodes)) {
+                            final AffinityTopologyVersion topVer = unreservedTopVer;
+
+                            if (topVer != null && --unreservedNodesRetryCnt > 0) {
+                                cctx.affinity().affinityReadyFuture(topVer).listen(
+                                    new IgniteInClosure<IgniteInternalFuture<AffinityTopologyVersion>>() {
+                                        @Override public void apply(
+                                            IgniteInternalFuture<AffinityTopologyVersion> future) {
+
+                                            nodes = fallbacks(cctx.topology().owners(part, topVer));
+
+                                            // Race is impossible here because query retries are executed one by one.
+                                            unreservedTopVer = null;
+
+                                            init();
+                                        }
+                                    });
+                            }
+                            else
+                                onDone(e);
+                        }
                         else
                             init();
                     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/45c813af/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
index 5d3f6a3..bfe5ecc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
@@ -39,6 +39,7 @@ import org.apache.ignite.lang.*;
 import org.apache.ignite.resources.*;
 import org.apache.ignite.spi.*;
 import org.apache.ignite.spi.indexing.*;
+
 import org.jetbrains.annotations.*;
 import org.jsr166.*;
 
@@ -170,7 +171,7 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
     }
 
     /**
-     *  Leaves busy state.
+     * Leaves busy state.
      */
     private void leaveBusy() {
         busyLock.leaveBusy();
@@ -794,7 +795,8 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
                         // double check for owning state
                         if (locPart == null || locPart.state() != OWNING || !locPart.reserve() ||
                             locPart.state() != OWNING)
-                            throw new GridDhtInvalidPartitionException(part, "Partition can't be reserved");
+                            throw new GridDhtUnreservedPartitionException(part,
+                                cctx.affinity().affinityTopologyVersion(), "Partition can not be reserved");
 
                         iter = new Iterator<K>() {
                             private Iterator<KeyCacheObject> iter0 = locPart.keySet().iterator();
@@ -1083,6 +1085,8 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
 
             boolean rmvRes = true;
 
+            FieldsResult res = null;
+
             final boolean statsEnabled = cctx.config().isStatisticsEnabled();
 
             final boolean readEvt = cctx.gridEvents().isRecordable(EVT_CACHE_QUERY_OBJECT_READ);
@@ -1109,7 +1113,7 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
 
                 String taskName = cctx.kernalContext().task().resolveTaskName(qry.taskHash());
 
-                FieldsResult res = qryInfo.local() ?
+                res = qryInfo.local() ?
                     executeFieldsQuery(qry, qryInfo.arguments(), qryInfo.local(), qry.subjectId(), taskName,
                     recipient(qryInfo.senderId(), qryInfo.requestId())) :
                     fieldsQueryResult(qryInfo, taskName);
@@ -1232,7 +1236,19 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
                     throw (Error)e;
             }
             finally {
-                if (rmvRes)
+                if (qryInfo.local()) {
+                    // Don't we need to always remove local iterators?
+                    if (rmvRes && res != null) {
+                        try {
+                            res.closeIfNotShared(recipient(qryInfo.senderId(), qryInfo.requestId()));
+                        }
+                        catch (IgniteCheckedException e) {
+                            U.error(log, "Failed to close local iterator [qry=" + qryInfo + ", node=" +
+                                cctx.nodeId() + "]", e);
+                        }
+                    }
+                }
+                else if (rmvRes)
                     removeFieldsQueryResult(qryInfo.senderId(), qryInfo.requestId());
             }
         }
@@ -1260,6 +1276,8 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
         try {
             boolean loc = qryInfo.local();
 
+            QueryResult<K, V> res = null;
+
             if (log.isDebugEnabled())
                 log.debug("Running query: " + qryInfo);
 
@@ -1286,8 +1304,6 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
                 IgniteSpiCloseableIterator<IgniteBiTuple<K, V>> iter;
                 GridCacheQueryType type;
 
-                QueryResult<K, V> res;
-
                 res = loc ?
                     executeQuery(qry, qryInfo.arguments(), loc, qry.subjectId(), taskName,
                     recipient(qryInfo.senderId(), qryInfo.requestId())) :
@@ -1350,7 +1366,7 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
                         log.debug("Record [key=" + key +
                             ", val=" + val +
                             ", incBackups=" + incBackups +
-                            ", priNode=" + (primaryNode != null ? U.id8(primaryNode.id())  : null) +
+                            ", priNode=" + (primaryNode != null ? U.id8(primaryNode.id()) : null) +
                             ", node=" + U.id8(cctx.localNode().id()) + ']');
                     }
 
@@ -1496,7 +1512,19 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
                     throw (Error)e;
             }
             finally {
-                if (rmvIter)
+                if (loc) {
+                    // Local iterators are always removed.
+                    if (res != null) {
+                        try {
+                            res.closeIfNotShared(recipient(qryInfo.senderId(), qryInfo.requestId()));
+                        }
+                        catch (IgniteCheckedException e) {
+                            U.error(log, "Failed to close local iterator [qry=" + qryInfo + ", node=" +
+                                cctx.nodeId() + "]", e);
+                        }
+                    }
+                }
+                else if (rmvIter)
                     removeQueryResult(qryInfo.senderId(), qryInfo.requestId());
             }
         }
@@ -1552,7 +1580,8 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
      * @return Iterator.
      * @throws IgniteCheckedException In case of error.
      */
-    @SuppressWarnings({"SynchronizationOnLocalVariableOrMethodParameter",
+    @SuppressWarnings({
+        "SynchronizationOnLocalVariableOrMethodParameter",
         "NonPrivateFieldAccessedInSynchronizedContext"})
     private QueryResult<K, V> queryResult(Map<Long, GridFutureAdapter<QueryResult<K, V>>> futs,
         GridCacheQueryInfo qryInfo, String taskName) throws IgniteCheckedException {
@@ -1680,7 +1709,8 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
      * @return Fields query result.
      * @throws IgniteCheckedException In case of error.
      */
-    @SuppressWarnings({"SynchronizationOnLocalVariableOrMethodParameter",
+    @SuppressWarnings({
+        "SynchronizationOnLocalVariableOrMethodParameter",
         "NonPrivateFieldAccessedInSynchronizedContext"})
     private FieldsResult fieldsQueryResult(Map<Long, GridFutureAdapter<FieldsResult>> resMap,
         GridCacheQueryInfo qryInfo, String taskName) throws IgniteCheckedException {
@@ -1868,8 +1898,8 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
     /**
      * @param <K> Key type.
      * @param <V> Value type.
-     * @return Predicate.
      * @param includeBackups Include backups.
+     * @return Predicate.
      */
     @SuppressWarnings("unchecked")
     @Nullable public <K, V> IndexingQueryFilter backupsFilter(boolean includeBackups) {
@@ -1933,7 +1963,7 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
 
         /** {@inheritDoc} */
         @Override public Collection<CacheSqlMetadata> call() {
-            final GridKernalContext ctx = ((IgniteKernal) ignite).context();
+            final GridKernalContext ctx = ((IgniteKernal)ignite).context();
 
             Collection<String> cacheNames = F.viewReadOnly(ctx.cache().caches(),
                 new C1<IgniteInternalCache<?, ?>, String>() {
@@ -2507,7 +2537,7 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
             if (!filter.apply(key, val))
                 return null;
 
-            return new IgniteBiTuple<>(e.key(), (V)cctx.unwrapTemporary(e.value())) ;
+            return new IgniteBiTuple<>(e.key(), (V)cctx.unwrapTemporary(e.value()));
         }
     }
 
@@ -2546,7 +2576,7 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
 
             idx++;
 
-            while(idx < iters.size()) {
+            while (idx < iters.size()) {
                 iter = iters.get(idx);
 
                 if (iter.hasNextX())
@@ -2598,7 +2628,7 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
 
         /** {@inheritDoc} */
         @Override public <T> T unwrap(Class<T> clazz) {
-            if(clazz.isAssignableFrom(getClass()))
+            if (clazz.isAssignableFrom(getClass()))
                 return clazz.cast(this);
 
             throw new IllegalArgumentException();
@@ -2627,7 +2657,6 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
             assert res;
         }
 
-
         /**
          * Close if this result does not have any other recipients.
          *
@@ -2958,8 +2987,8 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
     }
 
     /**
-     * Creates user's full text query, queried class, and query clause.
-     * For more information refer to {@link CacheQuery} documentation.
+     * Creates user's full text query, queried class, and query clause. For more information refer to {@link CacheQuery}
+     * documentation.
      *
      * @param clsName Query class name.
      * @param search Search clause.
@@ -2982,14 +3011,14 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
     }
 
     /**
-     * Creates user's SQL fields query for given clause. For more information refer to
-     * {@link CacheQuery} documentation.
+     * Creates user's SQL fields query for given clause. For more information refer to {@link CacheQuery}
+     * documentation.
      *
      * @param qry Query.
      * @param keepPortable Keep portable flag.
      * @return Created query.
      */
-     public CacheQuery<List<?>> createSqlFieldsQuery(String qry, boolean keepPortable) {
+    public CacheQuery<List<?>> createSqlFieldsQuery(String qry, boolean keepPortable) {
         A.notNull(qry, "qry");
 
         return new GridCacheQueryAdapter<>(cctx,

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/45c813af/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java
index 84ceafd..f422e9c 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java
@@ -19,9 +19,11 @@ package org.apache.ignite.internal.processors.cache;
 
 import org.apache.ignite.*;
 import org.apache.ignite.cache.*;
+import org.apache.ignite.cache.query.*;
 import org.apache.ignite.cluster.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.cluster.*;
 import org.apache.ignite.internal.managers.communication.*;
 import org.apache.ignite.internal.processors.affinity.*;
 import org.apache.ignite.internal.processors.cache.distributed.dht.*;
@@ -157,6 +159,90 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
     }
 
     /**
+     * Scan should activate fallback mechanism when new nodes join topology and rebalancing happens in parallel with
+     * scan query.
+     *
+     * @throws Exception In case of error.
+     */
+    public void testScanFallbackOnRebalancing() throws Exception {
+        cacheMode = CacheMode.PARTITIONED;
+        clientMode = false;
+        backups = 1;
+        commSpiFactory = new TestFallbackOnRebalancingCommunicationSpiFactory();
+
+        try {
+            Ignite ignite = startGrids(GRID_CNT);
+
+            final IgniteCacheProxy<Integer, Integer> cache = fillCache(ignite);
+
+            final AtomicBoolean done = new AtomicBoolean(false);
+
+            final AtomicInteger idx = new AtomicInteger(GRID_CNT);
+
+            IgniteInternalFuture fut1 = multithreadedAsync(
+                new Callable<Object>() {
+                    @Override public Object call() throws Exception {
+                        int id = idx.getAndIncrement();
+
+                        while (!done.get()) {
+                            startGrid(id);
+                            Thread.sleep(3000);
+
+                            stopGrid(id);
+
+                            if (done.get())
+                                return null;
+
+                            Thread.sleep(3000);
+                        }
+
+                        return null;
+                    }
+                }, GRID_CNT);
+
+            final AtomicInteger nodeIdx = new AtomicInteger();
+
+            IgniteInternalFuture fut2 = multithreadedAsync(
+                new Callable<Object>() {
+                    @Override public Object call() throws Exception {
+                        int nodeId = nodeIdx.getAndIncrement();
+
+                        IgniteCacheProxy<Integer, Integer> cache = (IgniteCacheProxy<Integer, Integer>)
+                            grid(nodeId).<Integer, Integer>cache(null);
+
+                        while (!done.get()) {
+                            IgniteBiTuple<Integer, UUID> tup = remotePartition(cache.context());
+
+                            int part = tup.get1();
+
+                            try {
+                                CacheQuery<Map.Entry<Integer, Integer>> qry = cache.context().queries().createScanQuery(
+                                    null, part, false);
+
+                                doTestScanQuery(qry);
+                            }
+                            catch (ClusterGroupEmptyCheckedException e) {
+                                log.warning("Invalid partition: " + part, e);
+                            }
+                        }
+
+                        return null;
+                    }
+                }, GRID_CNT);
+
+            Thread.sleep(60 * 1000); // Test for one minute
+
+            done.set(true);
+
+            fut2.get();
+            fut1.get();
+        }
+        finally {
+            stopAllGrids();
+        }
+    }
+
+    /**
      * Scan should try first remote node and fallbacks to second remote node.
      *
      * @throws Exception If failed.
@@ -408,4 +494,14 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
             };
         }
     }
+
+    /**
+     *
+     */
+    private static class TestFallbackOnRebalancingCommunicationSpiFactory implements CommunicationSpiFactory {
+        /** {@inheritDoc} */
+        @Override public TcpCommunicationSpi create() {
+            return new TcpCommunicationSpi();
+        }
+    }
 }


[02/11] incubator-ignite git commit: Squashed commit of the IGNITE-1229

Posted by sb...@apache.org.
Squashed commit of the IGNITE-1229


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

Branch: refs/heads/ignite-gg-10606
Commit: 7635e5894df6aab477b82253451b729985f632be
Parents: 1f00c70
Author: Denis Magda <dm...@gridgain.com>
Authored: Mon Aug 17 16:41:03 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Mon Aug 17 16:41:03 2015 +0300

----------------------------------------------------------------------
 .../ignite/spi/discovery/tcp/ServerImpl.java    |  57 ++++++-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |  45 ++++--
 .../spi/discovery/tcp/TcpDiscoverySelfTest.java | 152 ++++++++++++++++++-
 .../TcpDiscoverySpiFailureTimeoutSelfTest.java  |   8 +-
 4 files changed, 245 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7635e589/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index 76144e3..40e110f 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -114,7 +114,7 @@ class ServerImpl extends TcpDiscoveryImpl {
     protected TcpDiscoverySpiState spiState = DISCONNECTED;
 
     /** Map with proceeding ping requests. */
-    private final ConcurrentMap<InetSocketAddress, IgniteInternalFuture<IgniteBiTuple<UUID, Boolean>>> pingMap =
+    private final ConcurrentMap<InetSocketAddress, GridPingFutureAdapter<IgniteBiTuple<UUID, Boolean>>> pingMap =
         new ConcurrentHashMap8<>();
 
     /**
@@ -497,9 +497,9 @@ class ServerImpl extends TcpDiscoveryImpl {
             return F.t(getLocalNodeId(), clientPingRes);
         }
 
-        GridFutureAdapter<IgniteBiTuple<UUID, Boolean>> fut = new GridFutureAdapter<>();
+        GridPingFutureAdapter<IgniteBiTuple<UUID, Boolean>> fut = new GridPingFutureAdapter<>();
 
-        IgniteInternalFuture<IgniteBiTuple<UUID, Boolean>> oldFut = pingMap.putIfAbsent(addr, fut);
+        GridPingFutureAdapter<IgniteBiTuple<UUID, Boolean>> oldFut = pingMap.putIfAbsent(addr, fut);
 
         if (oldFut != null)
             return oldFut.get();
@@ -520,7 +520,11 @@ class ServerImpl extends TcpDiscoveryImpl {
 
                         long tstamp = U.currentTimeMillis();
 
-                        sock = spi.openSocket(addr, timeoutHelper);
+                        sock = spi.createSocket();
+
+                        fut.sock = sock;
+
+                        sock = spi.openSocket(sock, addr, timeoutHelper);
 
                         openedSock = true;
 
@@ -597,6 +601,21 @@ class ServerImpl extends TcpDiscoveryImpl {
         }
     }
 
+    /**
+     * Interrupts all existed 'ping' request for the given node.
+     *
+     * @param node Node that may be pinged.
+     */
+    private void interruptPing(TcpDiscoveryNode node) {
+        for (InetSocketAddress addr : spi.getNodeAddresses(node)) {
+            GridPingFutureAdapter fut = pingMap.get(addr);
+
+            if (fut != null && fut.sock != null)
+                // Reference to the socket is not set to null. No need to assign it to a local variable.
+                U.closeQuiet(fut.sock);
+        }
+    }
+
     /** {@inheritDoc} */
     @Override public void disconnect() throws IgniteSpiException {
         spiStop0(true);
@@ -3366,6 +3385,8 @@ class ServerImpl extends TcpDiscoveryImpl {
             if (msg.verified() && !locNodeId.equals(leavingNodeId)) {
                 TcpDiscoveryNode leftNode = ring.removeNode(leavingNodeId);
 
+                interruptPing(leavingNode);
+
                 assert leftNode != null;
 
                 if (log.isDebugEnabled())
@@ -3533,6 +3554,8 @@ class ServerImpl extends TcpDiscoveryImpl {
             if (msg.verified()) {
                 node = ring.removeNode(nodeId);
 
+                interruptPing(node);
+
                 assert node != null;
 
                 long topVer;
@@ -5142,4 +5165,30 @@ class ServerImpl extends TcpDiscoveryImpl {
             spi.writeToSocket(sock, msg, bout, timeout);
         }
     }
+
+    /**
+     *
+     */
+    private static class GridPingFutureAdapter<R> extends GridFutureAdapter<R> {
+        /** Socket. */
+        private volatile Socket sock;
+
+        /**
+         * Returns socket associated with this ping future.
+         *
+         * @return Socket or {@code null} if no socket associated.
+         */
+        public Socket sock() {
+            return sock;
+        }
+
+        /**
+         * Associates socket with this ping future.
+         *
+         * @param sock Socket.
+         */
+        public void sock(Socket sock) {
+            this.sock = sock;
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7635e589/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
index 18a540c..2f3d410 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
@@ -1167,18 +1167,49 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
      * @param timeoutHelper Timeout helper.
      * @return Opened socket.
      * @throws IOException If failed.
+     * @throws IgniteSpiOperationTimeoutException In case of timeout.
      */
     protected Socket openSocket(InetSocketAddress sockAddr, IgniteSpiOperationTimeoutHelper timeoutHelper)
         throws IOException, IgniteSpiOperationTimeoutException {
-        assert sockAddr != null;
+        return openSocket(createSocket(), sockAddr, timeoutHelper);
+    }
 
-        InetSocketAddress resolved = sockAddr.isUnresolved() ?
-            new InetSocketAddress(InetAddress.getByName(sockAddr.getHostName()), sockAddr.getPort()) : sockAddr;
+    /**
+     * Connects to remote address sending {@code U.IGNITE_HEADER} when connection is established.
+     *
+     * @param sock Socket bound to a local host address.
+     * @param remAddr Remote address.
+     * @param timeoutHelper Timeout helper.
+     * @return Connected socket.
+     * @throws IOException If failed.
+     * @throws IgniteSpiOperationTimeoutException In case of timeout.
+     */
+    protected Socket openSocket(Socket sock, InetSocketAddress remAddr, IgniteSpiOperationTimeoutHelper timeoutHelper)
+        throws IOException, IgniteSpiOperationTimeoutException {
+
+        assert remAddr != null;
+
+        InetSocketAddress resolved = remAddr.isUnresolved() ?
+            new InetSocketAddress(InetAddress.getByName(remAddr.getHostName()), remAddr.getPort()) : remAddr;
 
         InetAddress addr = resolved.getAddress();
 
         assert addr != null;
 
+        sock.connect(resolved, (int)timeoutHelper.nextTimeoutChunk(sockTimeout));
+
+        writeToSocket(sock, U.IGNITE_HEADER, timeoutHelper.nextTimeoutChunk(sockTimeout));
+
+        return sock;
+    }
+
+    /**
+     * Creates socket binding it to a local host address. This operation is not blocking.
+     *
+     * @return Created socket.
+     * @throws IOException If failed.
+     */
+    Socket createSocket() throws IOException {
         Socket sock;
 
         if (isSslEnabled())
@@ -1190,10 +1221,6 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
 
         sock.setTcpNoDelay(true);
 
-        sock.connect(resolved, (int)timeoutHelper.nextTimeoutChunk(sockTimeout));
-
-        writeToSocket(sock, U.IGNITE_HEADER, timeoutHelper.nextTimeoutChunk(sockTimeout));
-
         return sock;
     }
 
@@ -1250,8 +1277,8 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
      * @throws IOException If IO failed or write timed out.
      * @throws IgniteCheckedException If marshalling failed.
      */
-    protected void writeToSocket(Socket sock, TcpDiscoveryAbstractMessage msg, long timeout)
-        throws IOException, IgniteCheckedException {
+    protected void writeToSocket(Socket sock, TcpDiscoveryAbstractMessage msg, long timeout) throws IOException,
+        IgniteCheckedException {
         writeToSocket(sock, msg, new GridByteArrayOutputStream(8 * 1024), timeout); // 8K.
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7635e589/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
index 9a44c24..2b404c7 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
@@ -70,7 +70,8 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
     @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(gridName);
 
-        TcpDiscoverySpi spi = new TcpDiscoverySpi();
+        TcpDiscoverySpi spi = gridName.contains("testPingInterruptedOnNodeFailedFailingNode") ?
+            new TestTcpDiscoverySpi() : new TcpDiscoverySpi();
 
         discoMap.put(gridName, spi);
 
@@ -128,6 +129,8 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
             if (U.isMacOs())
                 spi.setLocalAddress(F.first(U.allLocalIps()));
         }
+        else if (gridName.contains("testPingInterruptedOnNodeFailedPingingNode"))
+            cfg.setFailureDetectionTimeout(30_000);
 
         return cfg;
     }
@@ -339,6 +342,153 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
     /**
      * @throws Exception If any error occurs.
      */
+    public void testPingInterruptedOnNodeFailed() throws Exception {
+        try {
+            final Ignite pingingNode = startGrid("testPingInterruptedOnNodeFailedPingingNode");
+            final Ignite failedNode = startGrid("testPingInterruptedOnNodeFailedFailingNode");
+            startGrid("testPingInterruptedOnNodeFailedSimpleNode");
+
+            ((TestTcpDiscoverySpi)failedNode.configuration().getDiscoverySpi()).ignorePingResponse = true;
+
+            final CountDownLatch pingLatch = new CountDownLatch(1);
+
+            final CountDownLatch eventLatch = new CountDownLatch(1);
+
+            final AtomicBoolean pingRes = new AtomicBoolean(true);
+
+            final AtomicBoolean failRes = new AtomicBoolean(false);
+
+            long startTs = System.currentTimeMillis();
+
+            pingingNode.events().localListen(
+                new IgnitePredicate<Event>() {
+                    @Override public boolean apply(Event event) {
+                        if (((DiscoveryEvent)event).eventNode().id().equals(failedNode.cluster().localNode().id())) {
+                            failRes.set(true);
+                            eventLatch.countDown();
+                        }
+
+                        return true;
+                    }
+                },
+                EventType.EVT_NODE_FAILED);
+
+            IgniteInternalFuture<?> pingFut = multithreadedAsync(
+                new Callable<Object>() {
+                    @Override public Object call() throws Exception {
+                        pingLatch.countDown();
+
+                        pingRes.set(pingingNode.configuration().getDiscoverySpi().pingNode(
+                            failedNode.cluster().localNode().id()));
+
+                        return null;
+                    }
+                }, 1);
+
+            IgniteInternalFuture<?> failingFut = multithreadedAsync(
+                new Callable<Object>() {
+                    @Override public Object call() throws Exception {
+                        pingLatch.await();
+
+                        Thread.sleep(3000);
+
+                        ((TestTcpDiscoverySpi)failedNode.configuration().getDiscoverySpi()).simulateNodeFailure();
+
+                        return null;
+                    }
+                }, 1);
+
+            failingFut.get();
+            pingFut.get();
+
+            assertFalse(pingRes.get());
+
+            assertTrue(System.currentTimeMillis() - startTs <
+                pingingNode.configuration().getFailureDetectionTimeout() / 2);
+
+            assertTrue(eventLatch.await(7, TimeUnit.SECONDS));
+            assertTrue(failRes.get());
+        }
+        finally {
+            stopAllGrids();
+        }
+    }
+
+    /**
+     * @throws Exception If any error occurs.
+     */
+    public void testPingInterruptedOnNodeLeft() throws Exception {
+        try {
+            final Ignite pingingNode = startGrid("testPingInterruptedOnNodeFailedPingingNode");
+            final Ignite leftNode = startGrid("testPingInterruptedOnNodeFailedFailingNode");
+            startGrid("testPingInterruptedOnNodeFailedSimpleNode");
+
+            ((TestTcpDiscoverySpi)leftNode.configuration().getDiscoverySpi()).ignorePingResponse = true;
+
+            final CountDownLatch pingLatch = new CountDownLatch(1);
+
+            final AtomicBoolean pingRes = new AtomicBoolean(true);
+
+            long startTs = System.currentTimeMillis();
+
+            IgniteInternalFuture<?> pingFut = multithreadedAsync(
+                new Callable<Object>() {
+                    @Override public Object call() throws Exception {
+                        pingLatch.countDown();
+
+                        pingRes.set(pingingNode.configuration().getDiscoverySpi().pingNode(
+                            leftNode.cluster().localNode().id()));
+
+                        return null;
+                    }
+                }, 1);
+
+            IgniteInternalFuture<?> stoppingFut = multithreadedAsync(
+                new Callable<Object>() {
+                    @Override public Object call() throws Exception {
+                        pingLatch.await();
+
+                        Thread.sleep(3000);
+
+                        stopGrid("testPingInterruptedOnNodeFailedFailingNode");
+
+                        return null;
+                    }
+                }, 1);
+
+            stoppingFut.get();
+            pingFut.get();
+
+            assertFalse(pingRes.get());
+
+            assertTrue(System.currentTimeMillis() - startTs <
+                pingingNode.configuration().getFailureDetectionTimeout() / 2);
+        }
+        finally {
+            stopAllGrids();
+        }
+    }
+
+    /**
+     *
+     */
+    private static class TestTcpDiscoverySpi extends TcpDiscoverySpi {
+        /** */
+        private boolean ignorePingResponse;
+
+        /** {@inheritDoc} */
+        protected void writeToSocket(Socket sock, TcpDiscoveryAbstractMessage msg, long timeout) throws IOException,
+            IgniteCheckedException {
+            if (msg instanceof TcpDiscoveryPingResponse && ignorePingResponse)
+                return;
+            else
+                super.writeToSocket(sock, msg, timeout);
+        }
+    }
+
+    /**
+     * @throws Exception If any error occurs.
+     */
     public void testNodeAdded() throws Exception {
         try {
             final Ignite g1 = startGrid(1);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7635e589/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiFailureTimeoutSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiFailureTimeoutSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiFailureTimeoutSelfTest.java
index fbea187..df36644 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiFailureTimeoutSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiFailureTimeoutSelfTest.java
@@ -305,7 +305,8 @@ public class TcpDiscoverySpiFailureTimeoutSelfTest extends AbstractDiscoverySelf
 
 
         /** {@inheritDoc} */
-        @Override protected Socket openSocket(InetSocketAddress sockAddr, IgniteSpiOperationTimeoutHelper timeoutHelper)
+        @Override protected Socket openSocket(Socket sock, InetSocketAddress sockAddr,
+            IgniteSpiOperationTimeoutHelper timeoutHelper)
             throws IOException, IgniteSpiOperationTimeoutException {
 
             if (openSocketTimeout) {
@@ -330,11 +331,12 @@ public class TcpDiscoverySpiFailureTimeoutSelfTest extends AbstractDiscoverySelf
                 }
             }
 
-            Socket sock = super.openSocket(sockAddr, timeoutHelper);
+            super.openSocket(sock, sockAddr, timeoutHelper);
 
             try {
                 Thread.sleep(1500);
-            } catch (InterruptedException e) {
+            }
+            catch (InterruptedException e) {
                 // Ignore
             }
 


[04/11] incubator-ignite git commit: Merge branch 'ignite-1241-dev' of https://github.com/dmagda/incubator-ignite

Posted by sb...@apache.org.
Merge branch 'ignite-1241-dev' of https://github.com/dmagda/incubator-ignite


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

Branch: refs/heads/ignite-gg-10606
Commit: ad121478b6f6d0d733e8d651a541f03b4fb849f4
Parents: 45c813a 38070b2
Author: Denis Magda <dm...@gridgain.com>
Authored: Mon Aug 17 17:11:54 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Mon Aug 17 17:11:54 2015 +0300

----------------------------------------------------------------------
 .../ignite/spi/discovery/tcp/ServerImpl.java    | 26 ++++++++++++++------
 .../spi/discovery/tcp/TcpDiscoveryImpl.java     |  4 +--
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |  4 ---
 .../tcp/internal/TcpDiscoveryNode.java          | 18 +++++++-------
 .../tcp/internal/TcpDiscoveryNodesRing.java     | 23 +++++++++++++++++
 5 files changed, 53 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ad121478/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ad121478/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------


[09/11] incubator-ignite git commit: Exception handling

Posted by sb...@apache.org.
Exception handling


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

Branch: refs/heads/ignite-gg-10606
Commit: 09da9c2a369b52b06fe9312aafd19f1085ba79d2
Parents: fcd9d61
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Mon Aug 17 23:44:59 2015 -0700
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Mon Aug 17 23:44:59 2015 -0700

----------------------------------------------------------------------
 .../ignite/cache/store/jdbc/CacheJdbcPojoStoreFactory.java       | 2 +-
 .../ignite/internal/util/spring/IgniteSpringHelperImpl.java      | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/09da9c2a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreFactory.java b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreFactory.java
index ac1f4f1..5449433 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreFactory.java
@@ -98,7 +98,7 @@ public class CacheJdbcPojoStoreFactory<K, V> implements Factory<CacheJdbcPojoSto
             }
             catch (Exception e) {
                 throw new IgniteException("Failed to load bean in application context [beanName=" + dataSrcBean +
-                    ", igniteConfig=" + appContext + ']');
+                    ", igniteConfig=" + appContext + ']', e);
             }
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/09da9c2a/modules/spring/src/main/java/org/apache/ignite/internal/util/spring/IgniteSpringHelperImpl.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/main/java/org/apache/ignite/internal/util/spring/IgniteSpringHelperImpl.java b/modules/spring/src/main/java/org/apache/ignite/internal/util/spring/IgniteSpringHelperImpl.java
index 435f522..d65a199 100644
--- a/modules/spring/src/main/java/org/apache/ignite/internal/util/spring/IgniteSpringHelperImpl.java
+++ b/modules/spring/src/main/java/org/apache/ignite/internal/util/spring/IgniteSpringHelperImpl.java
@@ -201,11 +201,11 @@ public class IgniteSpringHelperImpl implements IgniteSpringHelper {
         }
         catch (NoSuchBeanDefinitionException e) {
             throw new IgniteCheckedException("Spring bean with provided name doesn't exist " +
-                    ", beanName=" + beanName + ']');
+                ", beanName=" + beanName + ']');
         }
         catch (BeansException e) {
             throw new IgniteCheckedException("Failed to load Spring bean with provided name " +
-                    ", beanName=" + beanName + ']', e);
+                ", beanName=" + beanName + ']', e);
         }
     }
 


[07/11] incubator-ignite git commit: master - OFFSET clause fix IGNITE-1259

Posted by sb...@apache.org.
master - OFFSET clause fix IGNITE-1259


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

Branch: refs/heads/ignite-gg-10606
Commit: d31c8c6477e03563bf73db3cf216250b9c22b562
Parents: 9c939be
Author: S.Vladykin <sv...@gridgain.com>
Authored: Mon Aug 17 21:25:25 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Mon Aug 17 21:25:25 2015 +0300

----------------------------------------------------------------------
 .../query/h2/sql/GridSqlQuerySplitter.java      |   3 +
 .../query/IgniteSqlSplitterSelfTest.java        | 152 +++++++++++++++++++
 .../IgniteCacheQuerySelfTestSuite.java          |   2 +
 3 files changed, 157 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d31c8c64/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
index 2f8bcdd..34aef87 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
@@ -205,6 +205,9 @@ public class GridSqlQuerySplitter {
         if (mapQry.offset() != null) {
             rdcQry.offset(mapQry.offset());
 
+            if (mapQry.limit() != null) // LIMIT off + lim
+                mapQry.limit(op(GridSqlOperationType.PLUS, mapQry.offset(), mapQry.limit()));
+
             mapQry.offset(null);
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d31c8c64/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
new file mode 100644
index 0000000..6ec6bb3
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
@@ -0,0 +1,152 @@
+/*
+ * 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.query;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.cache.query.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.util.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.ignite.testframework.junits.common.*;
+
+import java.util.*;
+
+/**
+ * Tests for correct distributed partitioned queries.
+ */
+@SuppressWarnings("unchecked")
+public class IgniteSqlSplitterSelfTest extends GridCommonAbstractTest {
+    /** */
+    private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration() throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration();
+
+        cfg.setPeerClassLoadingEnabled(false);
+
+        TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+        disco.setIpFinder(ipFinder);
+
+        cfg.setDiscoverySpi(disco);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        startGridsMultiThreaded(3, false);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids();
+    }
+
+    /**
+     * @param name Cache name.
+     * @param partitioned Partition or replicated cache.
+     * @param idxTypes Indexed types.
+     * @return Cache configuration.
+     */
+    private static CacheConfiguration cacheConfig(String name, boolean partitioned, Class<?>... idxTypes) {
+        return new CacheConfiguration()
+            .setName(name)
+            .setCacheMode(partitioned ? CacheMode.PARTITIONED : CacheMode.REPLICATED)
+            .setAtomicityMode(CacheAtomicityMode.ATOMIC)
+            .setBackups(1)
+            .setIndexedTypes(idxTypes);
+    }
+
+    /**
+     * Tests offset and limit clauses for query.
+     * @throws Exception If failed.
+     */
+    public void testOffsetLimit() throws Exception {
+        IgniteCache<Integer, Integer> c = ignite(0).getOrCreateCache(cacheConfig("ints", true,
+            Integer.class, Integer.class));
+
+        try {
+            List<Integer> res = new ArrayList<>();
+
+            Random rnd = new GridRandom();
+
+            for (int i = 0; i < 10; i++) {
+                int val = rnd.nextInt(100);
+
+                c.put(i, val);
+                res.add(val);
+            }
+
+            Collections.sort(res);
+
+            String qry = "select _val from Integer order by _val ";
+
+            assertEqualsCollections(res,
+                column(0, c.query(new SqlFieldsQuery(qry)).getAll()));
+
+            assertEqualsCollections(res.subList(0, 0),
+                column(0, c.query(new SqlFieldsQuery(qry + "limit ?").setArgs(0)).getAll()));
+
+            assertEqualsCollections(res.subList(0, 3),
+                column(0, c.query(new SqlFieldsQuery(qry + "limit ?").setArgs(3)).getAll()));
+
+            assertEqualsCollections(res.subList(0, 9),
+                column(0, c.query(new SqlFieldsQuery(qry + "limit ? offset ?").setArgs(9, 0)).getAll()));
+
+            assertEqualsCollections(res.subList(3, 7),
+                column(0, c.query(new SqlFieldsQuery(qry + "limit ? offset ?").setArgs(4, 3)).getAll()));
+
+            assertEqualsCollections(res.subList(7, 9),
+                column(0, c.query(new SqlFieldsQuery(qry + "limit ? offset ?").setArgs(2, 7)).getAll()));
+
+            assertEqualsCollections(res.subList(8, 10),
+                column(0, c.query(new SqlFieldsQuery(qry + "limit ? offset ?").setArgs(2, 8)).getAll()));
+
+            assertEqualsCollections(res.subList(9, 10),
+                column(0, c.query(new SqlFieldsQuery(qry + "limit ? offset ?").setArgs(1, 9)).getAll()));
+
+            assertEqualsCollections(res.subList(10, 10),
+                column(0, c.query(new SqlFieldsQuery(qry + "limit ? offset ?").setArgs(1, 10)).getAll()));
+
+            assertEqualsCollections(res.subList(9, 10),
+                column(0, c.query(new SqlFieldsQuery(qry + "limit ? offset abs(-(4 + ?))").setArgs(1, 5)).getAll()));
+        }
+        finally {
+            c.destroy();
+        }
+    }
+
+    /**
+     * @param idx Column index.
+     * @param rows Rows.
+     * @return Column as list.
+     */
+    private static List<?> column(int idx, List<List<?>> rows) {
+        List res = new ArrayList<>(rows.size());
+
+        for (List<?> row : rows)
+            res.add(row.get(idx));
+
+        return res;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d31c8c64/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 a3849d7..730c79f 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
@@ -25,6 +25,7 @@ import org.apache.ignite.internal.processors.cache.local.*;
 import org.apache.ignite.internal.processors.cache.query.*;
 import org.apache.ignite.internal.processors.cache.query.continuous.*;
 import org.apache.ignite.internal.processors.cache.reducefields.*;
+import org.apache.ignite.internal.processors.query.*;
 import org.apache.ignite.internal.processors.query.h2.sql.*;
 import org.apache.ignite.spi.communication.tcp.*;
 
@@ -43,6 +44,7 @@ public class IgniteCacheQuerySelfTestSuite extends TestSuite {
         suite.addTestSuite(GridQueryParsingTest.class);
 
         // Queries tests.
+        suite.addTestSuite(IgniteSqlSplitterSelfTest.class);
         suite.addTestSuite(GridCacheQueryIndexDisabledSelfTest.class);
         suite.addTestSuite(IgniteCacheQueryLoadSelfTest.class);
         suite.addTestSuite(IgniteCacheLocalQuerySelfTest.class);


[08/11] incubator-ignite git commit: Deprecated IgniteConfiguration.setNodeId()

Posted by sb...@apache.org.
Deprecated IgniteConfiguration.setNodeId()


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

Branch: refs/heads/ignite-gg-10606
Commit: fcd9d611503592ef3104feee42d82b3956aae42d
Parents: d31c8c6
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Mon Aug 17 21:24:55 2015 -0700
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Mon Aug 17 21:24:55 2015 -0700

----------------------------------------------------------------------
 .../org/apache/ignite/configuration/IgniteConfiguration.java    | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fcd9d611/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
index 546c382..b670398 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
@@ -60,8 +60,8 @@ import javax.cache.expiry.*;
 import javax.cache.integration.*;
 import javax.cache.processor.*;
 import javax.management.*;
-import java.io.*;
 import javax.net.ssl.*;
+import java.io.*;
 import java.lang.management.*;
 import java.util.*;
 
@@ -970,6 +970,7 @@ public class IgniteConfiguration {
      *
      * @return Unique identifier for this node within grid.
      */
+    @Deprecated
     public UUID getNodeId() {
         return nodeId;
     }
@@ -980,7 +981,9 @@ public class IgniteConfiguration {
      * @param nodeId Unique identifier for local node.
      * @see IgniteConfiguration#getNodeId()
      * @return {@code this} for chaining.
+     * @deprecated Use {@link #setConsistentId(Serializable)} instead.
      */
+    @Deprecated
     public IgniteConfiguration setNodeId(UUID nodeId) {
         this.nodeId = nodeId;
 


[11/11] incubator-ignite git commit: # GG-10606: small correction.

Posted by sb...@apache.org.
# GG-10606: small correction.


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

Branch: refs/heads/ignite-gg-10606
Commit: 53143f9326f5a3b86846dda4ecf073fc01776d62
Parents: c232395
Author: iveselovskiy <iv...@gridgain.com>
Authored: Tue Aug 18 19:45:30 2015 +0300
Committer: iveselovskiy <iv...@gridgain.com>
Committed: Tue Aug 18 19:45:30 2015 +0300

----------------------------------------------------------------------
 .../test/java/org/apache/ignite/testframework/GridTestUtils.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/53143f93/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
index 964f680..d840312 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
@@ -1353,7 +1353,7 @@ public final class GridTestUtils {
             U.resolveIgnitePath(GridTestProperties.getProperty("ssl.keystore.path")).getAbsolutePath());
         factory.setKeyStorePassword(GridTestProperties.getProperty("ssl.keystore.password").toCharArray());
 
-        factory.setTrustManagers(GridSslBasicContextFactory.getDisabledTrustManager());
+        factory.setTrustManagers(SslContextFactory.getDisabledTrustManager());
 
         return factory;
     }


[10/11] incubator-ignite git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-gg-10606

Posted by sb...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-gg-10606


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

Branch: refs/heads/ignite-gg-10606
Commit: c232395db35d4fe9cf296a384b96ea27998a389b
Parents: ddbbffb 09da9c2
Author: iveselovskiy <iv...@gridgain.com>
Authored: Tue Aug 18 19:44:53 2015 +0300
Committer: iveselovskiy <iv...@gridgain.com>
Committed: Tue Aug 18 19:44:53 2015 +0300

----------------------------------------------------------------------
 .../store/jdbc/CacheJdbcPojoStoreFactory.java   |   2 +-
 .../configuration/IgniteConfiguration.java      |   5 +-
 .../GridDhtUnreservedPartitionException.java    |  66 ++++++++
 .../cache/query/GridCacheQueryAdapter.java      |  56 ++++++-
 .../cache/query/GridCacheQueryManager.java      |  71 ++++++---
 .../ignite/spi/discovery/tcp/ServerImpl.java    |  83 ++++++++--
 .../spi/discovery/tcp/TcpDiscoveryImpl.java     |   4 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |  49 ++++--
 .../tcp/internal/TcpDiscoveryNode.java          |  18 +--
 .../tcp/internal/TcpDiscoveryNodesRing.java     |  23 +++
 .../spi/discovery/tcp/TcpDiscoverySelfTest.java | 152 ++++++++++++++++++-
 .../TcpDiscoverySpiFailureTimeoutSelfTest.java  |   8 +-
 .../query/h2/sql/GridSqlQuerySplitter.java      |   3 +
 .../query/h2/twostep/GridMergeTable.java        |   7 +-
 .../query/h2/twostep/GridThreadLocalTable.java  |  22 ++-
 ...CacheScanPartitionQueryFallbackSelfTest.java |  96 ++++++++++++
 .../query/IgniteSqlSplitterSelfTest.java        | 152 +++++++++++++++++++
 .../IgniteCacheQuerySelfTestSuite.java          |   2 +
 .../util/spring/IgniteSpringHelperImpl.java     |   4 +-
 19 files changed, 739 insertions(+), 84 deletions(-)
----------------------------------------------------------------------



[05/11] incubator-ignite git commit: master - schema drop fix for TL tables

Posted by sb...@apache.org.
master - schema drop fix for TL tables


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

Branch: refs/heads/ignite-gg-10606
Commit: 952c7fc99d63b5af0d5a3fe7df4b610f8baf9001
Parents: ad12147
Author: S.Vladykin <sv...@gridgain.com>
Authored: Mon Aug 17 21:22:50 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Mon Aug 17 21:22:50 2015 +0300

----------------------------------------------------------------------
 .../query/h2/twostep/GridThreadLocalTable.java  | 22 +++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/952c7fc9/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridThreadLocalTable.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridThreadLocalTable.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridThreadLocalTable.java
index c468371..f6735b5 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridThreadLocalTable.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridThreadLocalTable.java
@@ -21,6 +21,7 @@ import org.h2.api.*;
 import org.h2.command.ddl.*;
 import org.h2.engine.*;
 import org.h2.index.*;
+import org.h2.message.*;
 import org.h2.result.*;
 import org.h2.schema.*;
 import org.h2.table.*;
@@ -154,7 +155,7 @@ public class GridThreadLocalTable extends Table {
 
     /** {@inheritDoc} */
     @Override public String getTableType() {
-        return tbl.get().getTableType();
+        return EXTERNAL_TABLE_ENGINE;
     }
 
     /** {@inheritDoc} */
@@ -179,7 +180,7 @@ public class GridThreadLocalTable extends Table {
 
     /** {@inheritDoc} */
     @Override public long getMaxDataModificationId() {
-        return tbl.get().getMaxDataModificationId();
+        return 0;
     }
 
     /** {@inheritDoc} */
@@ -194,7 +195,7 @@ public class GridThreadLocalTable extends Table {
 
     /** {@inheritDoc} */
     @Override public boolean canDrop() {
-        return tbl.get().canDrop();
+        return false;
     }
 
     /** {@inheritDoc} */
@@ -204,12 +205,14 @@ public class GridThreadLocalTable extends Table {
 
     /** {@inheritDoc} */
     @Override public long getRowCountApproximation() {
-        return tbl.get().getRowCountApproximation();
+        Table t = tbl.get();
+
+        return t == null ? 0 : t.getRowCountApproximation();
     }
 
     /** {@inheritDoc} */
     @Override public long getDiskSpaceUsed() {
-        return tbl.get().getDiskSpaceUsed();
+        return 0;
     }
 
     /** {@inheritDoc} */
@@ -219,12 +222,17 @@ public class GridThreadLocalTable extends Table {
 
     /** {@inheritDoc} */
     @Override public String getDropSQL() {
-        return tbl.get().getDropSQL();
+        return "";
+    }
+
+    /** {@inheritDoc} */
+    @Override public void addDependencies(HashSet<DbObject> dependencies) {
+        // No-op. We should not have any dependencies to add.
     }
 
     /** {@inheritDoc} */
     @Override public void checkRename() {
-        tbl.get().checkRename();
+        throw DbException.getUnsupportedException("rename");
     }
 
     /**