You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by iv...@apache.org on 2015/07/31 13:56:06 UTC
[1/8] incubator-ignite git commit: #ignite-gg-10610: Security hole if
DataStreamer is used for populating the cache
Repository: incubator-ignite
Updated Branches:
refs/heads/ignite-1161 c92efc3fc -> 0f7816def
#ignite-gg-10610: Security hole if DataStreamer is used for populating the cache
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/5288b2d8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/5288b2d8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/5288b2d8
Branch: refs/heads/ignite-1161
Commit: 5288b2d8b882bbb86d69e1019821d51803685861
Parents: a127756
Author: ivasilinets <iv...@gridgain.com>
Authored: Wed Jul 29 15:27:31 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Wed Jul 29 15:27:31 2015 +0300
----------------------------------------------------------------------
.../datastreamer/DataStreamerImpl.java | 22 ++++++++++++++++++++
.../datastreamer/DataStreamerUpdateJob.java | 20 +++++++++++++++++-
2 files changed, 41 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5288b2d8/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
index 605f478..5fae676 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
@@ -39,6 +39,7 @@ import org.apache.ignite.internal.util.tostring.*;
import org.apache.ignite.internal.util.typedef.*;
import org.apache.ignite.internal.util.typedef.internal.*;
import org.apache.ignite.lang.*;
+import org.apache.ignite.plugin.security.*;
import org.apache.ignite.stream.*;
import org.jetbrains.annotations.*;
import org.jsr166.*;
@@ -413,6 +414,8 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
@Override public IgniteFuture<?> addData(Collection<? extends Map.Entry<K, V>> entries) {
A.notEmpty(entries, "entries");
+ checkSecurityPermission(SecurityPermission.CACHE_PUT);
+
enterBusy();
try {
@@ -520,6 +523,11 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
@Override public IgniteFuture<?> addData(K key, V val) {
A.notNull(key, "key");
+ if (val == null)
+ checkSecurityPermission(SecurityPermission.CACHE_REMOVE);
+ else
+ checkSecurityPermission(SecurityPermission.CACHE_PUT);
+
KeyCacheObject key0 = cacheObjProc.toCacheKeyObject(cacheObjCtx, key, true);
CacheObject val0 = cacheObjProc.toCacheObject(cacheObjCtx, val, true);
@@ -980,6 +988,20 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
}
/**
+ * Check permissions for streaming.
+ *
+ * @param perm Security permission.
+ * @throws org.apache.ignite.plugin.security.SecurityException If permissions are not enough for streaming.
+ */
+ private void checkSecurityPermission(SecurityPermission perm)
+ throws org.apache.ignite.plugin.security.SecurityException{
+ if (!ctx.security().enabled())
+ return;
+
+ ctx.security().authorize(cacheName, perm, null);
+ }
+
+ /**
*
*/
private class Buffer {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5288b2d8/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerUpdateJob.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerUpdateJob.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerUpdateJob.java
index 21ba3ac..9e0703a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerUpdateJob.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerUpdateJob.java
@@ -22,6 +22,7 @@ import org.apache.ignite.internal.*;
import org.apache.ignite.internal.processors.cache.*;
import org.apache.ignite.internal.util.lang.*;
import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.plugin.security.*;
import org.apache.ignite.stream.*;
import org.jetbrains.annotations.*;
@@ -106,8 +107,13 @@ class DataStreamerUpdateJob implements GridPlainCallable<Object> {
CacheObject val = e.getValue();
- if (val != null)
+ if (val != null) {
+ checkSecurityPermission(SecurityPermission.CACHE_PUT);
+
val.finishUnmarshal(cctx.cacheObjectContext(), cctx.deploy().globalLoader());
+ }
+ else
+ checkSecurityPermission(SecurityPermission.CACHE_REMOVE);
}
if (unwrapEntries()) {
@@ -139,4 +145,16 @@ class DataStreamerUpdateJob implements GridPlainCallable<Object> {
private boolean unwrapEntries() {
return !(rcvr instanceof DataStreamerCacheUpdaters.InternalUpdater);
}
+
+ /**
+ * @param perm Security permission.
+ * @throws org.apache.ignite.plugin.security.SecurityException If permission is not enough.
+ */
+ private void checkSecurityPermission(SecurityPermission perm)
+ throws org.apache.ignite.plugin.security.SecurityException {
+ if (!ctx.security().enabled())
+ return;
+
+ ctx.security().authorize(cacheName, perm, null);
+ }
}
[7/8] incubator-ignite git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/incubator-ignite
Posted by iv...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/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/aec97640
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/aec97640
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/aec97640
Branch: refs/heads/ignite-1161
Commit: aec97640713ecd808440cc48825910d574815cb7
Parents: 6b0552c 271550f
Author: ivasilinets <iv...@gridgain.com>
Authored: Fri Jul 31 14:36:01 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Fri Jul 31 14:36:01 2015 +0300
----------------------------------------------------------------------
.../GridDhtPartitionsExchangeFuture.java | 20 +++++----
.../communication/tcp/TcpCommunicationSpi.java | 41 +++++++++++++++---
.../ignite/spi/discovery/tcp/ServerImpl.java | 45 +++++++++++---------
.../spi/discovery/tcp/TcpDiscoverySpi.java | 2 +-
.../tcp/TcpDiscoveryMultiThreadedTest.java | 8 ++--
5 files changed, 77 insertions(+), 39 deletions(-)
----------------------------------------------------------------------
[5/8] incubator-ignite git commit: Squashed commit of the following:
Posted by iv...@apache.org.
Squashed commit of the following:
commit ed8dac68bb008c17246ecea5169b34a55b860869
Merge: 6f915db a127756
Author: Denis Magda <dm...@gridgain.com>
Date: Mon Jul 27 16:56:39 2015 +0300
Merge remote-tracking branch 'remotes/origin/master' into ignite-1139
commit 6f915db1890c81af035984f07a7195da9048a67f
Author: Denis Magda <dm...@gridgain.com>
Date: Mon Jul 27 09:50:53 2015 +0300
ignite-1139: uncommented tests
commit aadbdda1dab5e1c350afb0ac5e7f1182095ecd70
Author: Denis Magda <dm...@gridgain.com>
Date: Mon Jul 27 09:30:50 2015 +0300
ignite-1139: set cancel to true when stopping a client node
commit 86c6f6a8df6e828e5cc3c606c334925e948dee7a
Author: Denis Magda <dm...@gridgain.com>
Date: Mon Jul 27 09:06:49 2015 +0300
ignite-1139: temporaly disable some SPI tests
commit e6a2d88063a1c32478f3ee1dea80c2ffe2ee19af
Author: Denis Magda <dm...@gridgain.com>
Date: Mon Jul 27 08:51:51 2015 +0300
ignite-
commit f39086536e3afd031ed158e9cd2d65afb71a32bf
Merge: 14ee9df 84f8b95
Author: Denis Magda <dm...@gridgain.com>
Date: Mon Jul 27 08:42:28 2015 +0300
Merge branch 'ignite-1139' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-1139
commit 14ee9df2251716d1a3913742ce05154e2e958b56
Merge: fd6b0e3 0341759
Author: Denis Magda <dm...@gridgain.com>
Date: Mon Jul 27 08:39:31 2015 +0300
Merge remote-tracking branch 'remotes/origin/master' into ignite-1139
commit 84f8b956e40ae88d11e0ef125442203a497b8c4b
Author: dmagda <ma...@gmail.com>
Date: Fri Jul 24 13:35:32 2015 +0300
ignite-1139:
- fixed race in GridDhtPartitionsExchangeFuture
- fixed NPE in TcpCommunicationSpi when this SPI was not in the fully initialized state
commit 89da409d5e6a62e744c4030475bbbfcb822a103c
Merge: fd6b0e3 ed5d3ed
Author: dmagda <ma...@gmail.com>
Date: Fri Jul 24 08:55:26 2015 +0300
Merge remote-tracking branch 'remotes/origin/master' into ignite-1139
commit fd6b0e3684df97875947c7864487b658ac599fce
Author: Denis Magda <dm...@gridgain.com>
Date: Thu Jul 23 16:08:21 2015 +0300
ignite-1139: unmuted test
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/271550fe
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/271550fe
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/271550fe
Branch: refs/heads/ignite-1161
Commit: 271550fed7662c5032f9e4fb49cd135f3a55a46e
Parents: abb2cef
Author: Denis Magda <dm...@gridgain.com>
Authored: Fri Jul 31 13:49:08 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Fri Jul 31 13:49:08 2015 +0300
----------------------------------------------------------------------
.../GridDhtPartitionsExchangeFuture.java | 20 +++++-----
.../communication/tcp/TcpCommunicationSpi.java | 41 +++++++++++++++++---
.../tcp/TcpDiscoveryMultiThreadedTest.java | 8 ++--
3 files changed, 50 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/271550fe/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 3664220..cbf6b40 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
@@ -583,7 +583,7 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
onDone(exchId.topologyVersion());
}
else
- sendPartitions();
+ sendPartitions(oldest);
}
else {
rmtIds = Collections.emptyList();
@@ -816,9 +816,11 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
if (log.isDebugEnabled())
log.debug("Initialized future: " + this);
+ ClusterNode oldest = oldestNode.get();
+
// If this node is not oldest.
- if (!oldestNode.get().id().equals(cctx.localNodeId()))
- sendPartitions();
+ if (!oldest.id().equals(cctx.localNodeId()))
+ sendPartitions(oldest);
else {
boolean allReceived = allReceived();
@@ -948,11 +950,9 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
}
/**
- *
+ * @param oldestNode Oldest node.
*/
- private void sendPartitions() {
- ClusterNode oldestNode = this.oldestNode.get();
-
+ private void sendPartitions(ClusterNode oldestNode) {
try {
sendLocalPartitions(oldestNode, exchId);
}
@@ -1402,8 +1402,10 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
*
*/
private void recheck() {
+ ClusterNode oldest = oldestNode.get();
+
// If this is the oldest node.
- if (oldestNode.get().id().equals(cctx.localNodeId())) {
+ if (oldest.id().equals(cctx.localNodeId())) {
Collection<UUID> remaining = remaining();
if (!remaining.isEmpty()) {
@@ -1423,7 +1425,7 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
}
}
else
- sendPartitions();
+ sendPartitions(oldest);
// Schedule another send.
scheduleRecheck();
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/271550fe/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 f76025d..1c74d59 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
@@ -1791,7 +1791,13 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
if (log.isTraceEnabled())
log.trace("Sending message to node [node=" + node + ", msg=" + msg + ']');
- if (node.id().equals(getLocalNode().id()))
+ ClusterNode localNode = getLocalNode();
+
+ if (localNode == null)
+ throw new IgniteSpiException("Local node has not been started or fully initialized " +
+ "[isStopping=" + getSpiContext().isStopping() + ']');
+
+ if (node.id().equals(localNode.id()))
notifyListener(node.id(), msg, NOOP);
else {
GridCommunicationClient client = null;
@@ -1804,7 +1810,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
UUID nodeId = null;
- if (!client.async() && !getSpiContext().localNode().version().equals(node.version()))
+ if (!client.async() && !localNode.version().equals(node.version()))
nodeId = node.id();
retry = client.sendMessage(nodeId, msg);
@@ -2435,8 +2441,14 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
else
ch.write(ByteBuffer.wrap(U.IGNITE_HEADER));
+ ClusterNode localNode = getLocalNode();
+
+ if (localNode == null)
+ throw new IgniteCheckedException("Local node has not been started or " +
+ "fully initialized [isStopping=" + getSpiContext().isStopping() + ']');
+
if (recovery != null) {
- HandshakeMessage msg = new HandshakeMessage(getLocalNode().id(),
+ HandshakeMessage msg = new HandshakeMessage(localNode.id(),
recovery.incrementConnectCount(),
recovery.receivedCount());
@@ -2629,7 +2641,20 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
* @return Node ID message.
*/
private NodeIdMessage nodeIdMessage() {
- return new NodeIdMessage(getLocalNode().id());
+ ClusterNode localNode = getLocalNode();
+
+ UUID id;
+
+ if (localNode == null) {
+ U.warn(log, "Local node is not started or fully initialized [isStopping=" +
+ getSpiContext().isStopping() + ']');
+
+ id = new UUID(0, 0);
+ }
+ else
+ id = localNode.id();
+
+ return new NodeIdMessage(id);
}
/** {@inheritDoc} */
@@ -3145,7 +3170,13 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
}
try {
- UUID id = getLocalNode().id();
+ ClusterNode localNode = getLocalNode();
+
+ if (localNode == null)
+ throw new IgniteSpiException("Local node has not been started or fully initialized " +
+ "[isStopping=" + getSpiContext().isStopping() + ']');
+
+ UUID id = localNode.id();
NodeIdMessage msg = new NodeIdMessage(id);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/271550fe/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
index 69dd538..f7c73b6 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
@@ -88,9 +88,9 @@ public class TcpDiscoveryMultiThreadedTest extends GridCommonAbstractTest {
/** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
- super.afterTest();
-
stopAllGrids();
+
+ super.afterTest();
}
/** {@inheritDoc} */
@@ -102,8 +102,6 @@ public class TcpDiscoveryMultiThreadedTest extends GridCommonAbstractTest {
* @throws Exception If any error occurs.
*/
public void testMultiThreadedClientsRestart() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-1139");
-
clientFlagGlobal = false;
info("Test timeout: " + (getTestTimeout() / (60 * 1000)) + " min.");
@@ -126,7 +124,7 @@ public class TcpDiscoveryMultiThreadedTest extends GridCommonAbstractTest {
int idx = clientIdx.getAndIncrement();
while (!done.get()) {
- stopGrid(idx);
+ stopGrid(idx, true);
startGrid(idx);
}
[6/8] incubator-ignite git commit: #ignite-1170: rename psz rest
query parameter to pageSize
Posted by iv...@apache.org.
#ignite-1170: rename psz rest query parameter to pageSize
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/6b0552cd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/6b0552cd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/6b0552cd
Branch: refs/heads/ignite-1161
Commit: 6b0552cdedffbbd1855461fbcc988fb36f354ac4
Parents: 7ed4d15
Author: ivasilinets <iv...@gridgain.com>
Authored: Fri Jul 31 14:35:37 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Fri Jul 31 14:35:37 2015 +0300
----------------------------------------------------------------------
.../rest/JettyRestProcessorAbstractSelfTest.java | 14 +++++++-------
.../rest/handlers/query/QueryCommandHandler.java | 6 +++---
.../protocols/http/jetty/GridJettyRestHandler.java | 12 ++++++------
3 files changed, 16 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6b0552cd/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 8ce070f..090e030 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
@@ -1018,7 +1018,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
Map<String, String> params = new HashMap<>();
params.put("cmd", GridRestCommand.EXECUTE_SQL_QUERY.key());
params.put("type", "Person");
- params.put("psz", "10");
+ params.put("pageSize", "10");
params.put("cacheName", "person");
params.put("qry", URLEncoder.encode(qry));
params.put("arg1", "1000");
@@ -1049,7 +1049,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
Map<String, String> params = new HashMap<>();
params.put("cmd", GridRestCommand.EXECUTE_SQL_QUERY.key());
params.put("type", "String");
- params.put("psz", "1");
+ params.put("pageSize", "1");
params.put("qry", URLEncoder.encode("select * from String"));
String ret = content(params);
@@ -1064,7 +1064,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
assertNotNull(qryId);
ret = content(F.asMap("cmd", GridRestCommand.FETCH_SQL_QUERY.key(),
- "psz", "1", "qryId", String.valueOf(qryId)));
+ "pageSize", "1", "qryId", String.valueOf(qryId)));
json = JSONObject.fromObject(ret);
@@ -1076,7 +1076,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
assertFalse(last);
ret = content(F.asMap("cmd", GridRestCommand.FETCH_SQL_QUERY.key(),
- "psz", "1", "qryId", String.valueOf(qryId)));
+ "pageSize", "1", "qryId", String.valueOf(qryId)));
json = JSONObject.fromObject(ret);
@@ -1098,7 +1098,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
Map<String, String> params = new HashMap<>();
params.put("cmd", GridRestCommand.EXECUTE_SQL_FIELDS_QUERY.key());
- params.put("psz", "10");
+ params.put("pageSize", "10");
params.put("cacheName", "person");
params.put("qry", URLEncoder.encode(qry));
@@ -1124,7 +1124,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
Map<String, String> params = new HashMap<>();
params.put("cmd", GridRestCommand.EXECUTE_SQL_FIELDS_QUERY.key());
- params.put("psz", "10");
+ params.put("pageSize", "10");
params.put("cacheName", "person");
params.put("qry", URLEncoder.encode(qry));
@@ -1162,7 +1162,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
Map<String, String> params = new HashMap<>();
params.put("cmd", GridRestCommand.EXECUTE_SQL_QUERY.key());
params.put("type", "Person");
- params.put("psz", "1");
+ params.put("pageSize", "1");
params.put("cacheName", "person");
params.put("qry", URLEncoder.encode(qry));
params.put("arg1", "1000");
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6b0552cd/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
index 59f95c9..1712dd4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
@@ -138,7 +138,7 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter {
if (cache == null)
return new GridRestResponse(GridRestResponse.STATUS_FAILED,
- "No cache with name [cacheName=" + req.cacheName() + "]");
+ "Failed to find cache with name: " + req.cacheName());
QueryCursor qryCur = cache.query(qry);
@@ -204,7 +204,7 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter {
if (cur == null)
return new GridRestResponse(GridRestResponse.STATUS_FAILED,
- "Cannot find query [qryId=" + req.queryId() + "]");
+ "Failed to find query with ID: " + req.queryId());
cur.close();
@@ -247,7 +247,7 @@ public class QueryCommandHandler extends GridRestCommandHandlerAdapter {
if (cur == null)
return new GridRestResponse(GridRestResponse.STATUS_FAILED,
- "Cannot find query [qryId=" + req.queryId() + "]");
+ "Failed to find query with ID: " + req.queryId());
CacheQueryResult res = createQueryResult(qryCurs, cur, req, req.queryId());
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6b0552cd/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
----------------------------------------------------------------------
diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
index bf0f2c8..75e80ec 100644
--- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
+++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
@@ -479,10 +479,10 @@ public class GridJettyRestHandler extends AbstractHandler {
restReq0.typeName((String) params.get("type"));
- String psz = (String) params.get("psz");
+ String pageSize = (String) params.get("pageSize");
- if (psz != null)
- restReq0.pageSize(Integer.parseInt(psz));
+ if (pageSize != null)
+ restReq0.pageSize(Integer.parseInt(pageSize));
restReq0.cacheName((String)params.get("cacheName"));
@@ -499,10 +499,10 @@ public class GridJettyRestHandler extends AbstractHandler {
if (qryId != null)
restReq0.queryId(Long.parseLong(qryId));
- String psz = (String) params.get("psz");
+ String pageSize = (String) params.get("pageSize");
- if (psz != null)
- restReq0.pageSize(Integer.parseInt(psz));
+ if (pageSize != null)
+ restReq0.pageSize(Integer.parseInt(pageSize));
restReq0.cacheName((String)params.get("cacheName"));
[4/8] incubator-ignite git commit: Merging IGNITE-1164
Posted by iv...@apache.org.
Merging IGNITE-1164
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/abb2cef1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/abb2cef1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/abb2cef1
Branch: refs/heads/ignite-1161
Commit: abb2cef136da824c55964bb4032c47dd150242c1
Parents: 44072f8
Author: Denis Magda <dm...@gridgain.com>
Authored: Fri Jul 31 13:41:41 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Fri Jul 31 13:41:41 2015 +0300
----------------------------------------------------------------------
.../main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/abb2cef1/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 47ba8e6..90133d6 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
@@ -2759,6 +2759,9 @@ class ServerImpl extends TcpDiscoveryImpl {
if (routerNode.id().equals(getLocalNodeId())) {
ClientMessageWorker worker = clientMsgWorkers.get(node.id());
+ if (worker == null)
+ throw new IgniteSpiException("Client node already disconnected: " + node);
+
msg.verify(getLocalNodeId()); // Client worker require verified messages.
worker.addMessage(msg);
[2/8] incubator-ignite git commit: #ignite-1175: Add test for dht
local partition map.
Posted by iv...@apache.org.
#ignite-1175: Add test for dht local partition map.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/7ed4d15f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/7ed4d15f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/7ed4d15f
Branch: refs/heads/ignite-1161
Commit: 7ed4d15f16c71e1683fd659865653a383d99259e
Parents: 5288b2d
Author: ivasilinets <iv...@gridgain.com>
Authored: Thu Jul 30 14:12:27 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Thu Jul 30 14:12:27 2015 +0300
----------------------------------------------------------------------
...cheDhtLocalPartitionAfterRemoveSelfTest.java | 107 +++++++++++++++++++
1 file changed, 107 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7ed4d15f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDhtLocalPartitionAfterRemoveSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDhtLocalPartitionAfterRemoveSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDhtLocalPartitionAfterRemoveSelfTest.java
new file mode 100644
index 0000000..b04e41a
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDhtLocalPartitionAfterRemoveSelfTest.java
@@ -0,0 +1,107 @@
+/*
+ * 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;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.processors.cache.distributed.dht.*;
+import org.apache.ignite.testframework.junits.common.*;
+
+/**
+ * Test for remove operation.
+ */
+public class CacheDhtLocalPartitionAfterRemoveSelfTest extends GridCommonAbstractTest {
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ CacheConfiguration ccfg = new CacheConfiguration();
+
+ ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
+ ccfg.setEvictSynchronized(false);
+ ccfg.setNearConfiguration(null);
+
+ cfg.setCacheConfiguration(ccfg);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ startGrids(1);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ stopAllGrids();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testMemoryUsage() throws Exception {
+ IgniteCache<TestKey, Integer> cache = grid(0).cache(null);
+
+ for (int i = 0; i < 1000; ++i)
+ cache.put(new TestKey("" + i), i);
+
+ for (int i = 0; i < 1000; ++i)
+ assert cache.getAndRemove(new TestKey("" + i)).equals(i);
+
+ assertEquals(0, cache.size());
+
+ int size = 0;
+
+ for (GridDhtLocalPartition p : dht(cache).topology().localPartitions()) {
+ int pSize = p.size();
+
+ size += pSize;
+ }
+
+ System.out.println("All size: " + size);
+ }
+
+ /**
+ * Test key.
+ */
+ private static class TestKey {
+ /** Key. */
+ private String key;
+
+ /**
+ * @param key Key.
+ */
+ public TestKey(String key) {
+ this.key = key;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return key.hashCode();
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object obj) {
+ if (obj == null || !(obj instanceof TestKey))
+ return false;
+
+ return key.equals(((TestKey)obj).key);
+ }
+ }
+}
[3/8] incubator-ignite git commit: Squashed commit of the following:
Posted by iv...@apache.org.
Squashed commit of the following:
commit f55a17f71ec97513a6968b1ea3c359bc6238cc5e
Author: Yakov Zhdanov <yz...@gridgain.com>
Date: Fri Jul 31 13:32:32 2015 +0300
review
commit 58ca345f622dbadfba7ef2d3dce850c4baa1f319
Merge: 5f921f6 7ed4d15
Author: Yakov Zhdanov <yz...@gridgain.com>
Date: Fri Jul 31 13:24:51 2015 +0300
Merge branches 'ignite-752-2' and 'master' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-752-2
commit 5f921f62dd6563a88b2ecdde92a2b2ee8218ec95
Author: Denis Magda <dm...@gridgain.com>
Date: Wed Jul 29 10:40:44 2015 +0300
ignite-752-2: added info on the lowest failure detection timeout to the documentation
commit 55f0eb56967d2cc9bdf62c3fb665521a59ddaf33
Author: Denis Magda <dm...@gridgain.com>
Date: Wed Jul 29 09:15:29 2015 +0300
ignite-752-2: supported connection check frequency even for cases when failure timeout is ignored; performance optimizations
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/44072f80
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/44072f80
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/44072f80
Branch: refs/heads/ignite-1161
Commit: 44072f806d8d14d716475a3665d0afdf004c6db2
Parents: 7ed4d15
Author: Denis Magda <dm...@gridgain.com>
Authored: Fri Jul 31 13:35:46 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Fri Jul 31 13:35:46 2015 +0300
----------------------------------------------------------------------
.../ignite/spi/discovery/tcp/ServerImpl.java | 42 +++++++++++---------
.../spi/discovery/tcp/TcpDiscoverySpi.java | 2 +-
2 files changed, 24 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/44072f80/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 547347c..47ba8e6 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
@@ -1787,6 +1787,9 @@ class ServerImpl extends TcpDiscoveryImpl {
/** Connection check frequency. */
private long connCheckFreq;
+ /** Connection check threshold. */
+ private long connCheckThreshold;
+
/**
*/
protected RingMessageWorker() {
@@ -1799,19 +1802,22 @@ class ServerImpl extends TcpDiscoveryImpl {
* Initializes connection check frequency. Used only when failure detection timeout is enabled.
*/
private void initConnectionCheckFrequency() {
- if (spi.failureDetectionTimeoutEnabled()) {
- for (int i = 3; i > 0; i--) {
- connCheckFreq = spi.failureDetectionTimeout() / i;
-
- if (connCheckFreq > 0)
- break;
- }
+ if (spi.failureDetectionTimeoutEnabled())
+ connCheckThreshold = spi.failureDetectionTimeout();
+ else
+ connCheckThreshold = Math.min(spi.getSocketTimeout(), spi.getHeartbeatFrequency());
- assert connCheckFreq > 0;
+ for (int i = 3; i > 0; i--) {
+ connCheckFreq = connCheckThreshold / i;
- if (log.isDebugEnabled())
- log.debug("Connection check frequency is calculated: " + connCheckFreq);
+ if (connCheckFreq > 10)
+ break;
}
+
+ assert connCheckFreq > 0;
+
+ if (log.isDebugEnabled())
+ log.debug("Connection check frequency is calculated: " + connCheckFreq);
}
/**
@@ -2306,9 +2312,9 @@ class ServerImpl extends TcpDiscoveryImpl {
// If node existed on connection initialization we should check
// whether it has not gone yet.
- if (nextNodeExists && pingNode(next))
- U.error(log, "Failed to send message to next node [msg=" + msg +
- ", next=" + next + ']', err);
+ if (nextNodeExists)
+ U.warn(log, "Failed to send message to next node [msg=" + msg + ", next=" + next +
+ ", errMsg=" + (err != null ? err.getMessage() : "N/A") + ']');
else if (log.isDebugEnabled())
log.debug("Failed to send message to next node [msg=" + msg + ", next=" + next +
", errMsg=" + (err != null ? err.getMessage() : "N/A") + ']');
@@ -4025,7 +4031,7 @@ class ServerImpl extends TcpDiscoveryImpl {
/**
* Check the last time a heartbeat message received. If the time is bigger than {@code hbCheckTimeout} than
- * {@link TcpDiscoveryStatusCheckMessage} is sent accros the ring.
+ * {@link TcpDiscoveryStatusCheckMessage} is sent across the ring.
*/
private void checkHeartbeatsReceiving() {
if (lastTimeStatusMsgSent < locNode.lastUpdateTime())
@@ -4045,11 +4051,9 @@ class ServerImpl extends TcpDiscoveryImpl {
* Check connection aliveness status.
*/
private void checkConnection() {
- if (!spi.failureDetectionTimeoutEnabled())
- return;
-
- if (!failureThresholdReached && U.currentTimeMillis() - locNode.lastDataReceivedTime()
- >= spi.failureDetectionTimeout() && ring.hasRemoteNodes() && spiStateCopy() == CONNECTED) {
+ if (spi.failureDetectionTimeoutEnabled() && !failureThresholdReached &&
+ U.currentTimeMillis() - locNode.lastDataReceivedTime() >= connCheckThreshold &&
+ ring.hasRemoteNodes() && spiStateCopy() == CONNECTED) {
log.info("Local node seems to be disconnected from topology (failure detection timeout " +
"is reached): [failureDetectionTimeout=" + spi.failureDetectionTimeout() +
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/44072f80/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 09690dc..3216166 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
@@ -74,7 +74,7 @@ import java.util.concurrent.atomic.*;
* {@link IgniteConfiguration#setFailureDetectionTimeout(long)}. This failure timeout automatically controls the
* following parameters: {@link #getSocketTimeout()}, {@link #getAckTimeout()}, {@link #getMaxAckTimeout()},
* {@link #getReconnectCount()}. If any of those parameters is set explicitly, then the failure timeout setting will be
- * ignored.
+ * ignored. As an example, for stable low-latency networks the failure detection timeout may be set to ~120 ms.
* <p>
* If it's required to perform advanced settings of failure detection and
* {@link IgniteConfiguration#getFailureDetectionTimeout()} is unsuitable then various {@code TcpDiscoverySpi}
[8/8] incubator-ignite git commit: Merge remote-tracking branch
'remotes/origin/master' into ignite-1161
Posted by iv...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-1161
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/0f7816de
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/0f7816de
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/0f7816de
Branch: refs/heads/ignite-1161
Commit: 0f7816def8a318e3b4c9b3c303d9d5f2f138204f
Parents: c92efc3 aec9764
Author: ivasilinets <iv...@gridgain.com>
Authored: Fri Jul 31 14:55:48 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Fri Jul 31 14:55:48 2015 +0300
----------------------------------------------------------------------
.../JettyRestProcessorAbstractSelfTest.java | 14 +--
.../GridDhtPartitionsExchangeFuture.java | 20 ++--
.../datastreamer/DataStreamerImpl.java | 22 ++++
.../datastreamer/DataStreamerUpdateJob.java | 20 +++-
.../handlers/query/QueryCommandHandler.java | 6 +-
.../communication/tcp/TcpCommunicationSpi.java | 41 ++++++-
.../ignite/spi/discovery/tcp/ServerImpl.java | 45 ++++----
.../spi/discovery/tcp/TcpDiscoverySpi.java | 2 +-
...cheDhtLocalPartitionAfterRemoveSelfTest.java | 107 +++++++++++++++++++
.../tcp/TcpDiscoveryMultiThreadedTest.java | 8 +-
.../http/jetty/GridJettyRestHandler.java | 12 +--
11 files changed, 241 insertions(+), 56 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0f7816de/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0f7816de/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
index a6a4c5c,1712dd4..bb19f2a
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
@@@ -152,9 -138,9 +152,9 @@@ public class QueryCommandHandler extend
if (cache == null)
return new GridRestResponse(GridRestResponse.STATUS_FAILED,
- "No cache with name [cacheName=" + req.cacheName() + "]");
+ "Failed to find cache with name: " + req.cacheName());
- QueryCursor qryCur = cache.query(qry);
+ final QueryCursor qryCur = cache.query(qry);
Iterator cur = qryCur.iterator();
@@@ -212,19 -200,15 +212,19 @@@
/** {@inheritDoc} */
@Override public GridRestResponse call() throws Exception {
try {
- QueryCursor cur = qryCurs.get(req.queryId()).get1();
+ GridTuple3<QueryCursor, Iterator, Long> val = qryCurs.get(req.queryId());
- if (cur == null)
+ if (val == null)
return new GridRestResponse(GridRestResponse.STATUS_FAILED,
- "Cannot find query [qryId=" + req.queryId() + "]");
+ "Failed to find query with ID: " + req.queryId());
- cur.close();
+ synchronized (val) {
+ QueryCursor cur = val.get1();
+
+ cur.close();
- qryCurs.remove(req.queryId());
+ qryCurs.remove(req.queryId());
+ }
return new GridRestResponse(true);
}
@@@ -253,24 -243,18 +253,24 @@@
/** {@inheritDoc} */
@Override public GridRestResponse call() throws Exception {
try {
- Iterator cur = qryCurs.get(req.queryId()).get2();
+ GridTuple3<QueryCursor, Iterator, Long> t = qryCurs.get(req.queryId());
- if (cur == null)
+ if (t == null)
return new GridRestResponse(GridRestResponse.STATUS_FAILED,
- "Cannot find query [qryId=" + req.queryId() + "]");
+ "Failed to find query with ID: " + req.queryId());
- CacheQueryResult res = createQueryResult(qryCurs, cur, req, req.queryId());
+ synchronized (t) {
+ t.set3(System.currentTimeMillis());
+
+ Iterator cur = t.get2();
- return new GridRestResponse(res);
+ CacheQueryResult res = createQueryResult(cur, req, req.queryId());
+
+ return new GridRestResponse(res);
+ }
}
catch (Exception e) {
- qryCurs.remove(req.queryId());
+ removeQueryCursor(req.queryId());
return new GridRestResponse(GridRestResponse.STATUS_FAILED, e.getMessage());
}