You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2017/03/21 11:29:50 UTC
[01/33] ignite git commit: IGNITE-4641 - Refresh client attributes
during reconnect
Repository: ignite
Updated Branches:
refs/heads/ignite-4565-ddl 1b2a3dedb -> d5b41960d
IGNITE-4641 - Refresh client attributes during reconnect
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8874f99f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8874f99f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8874f99f
Branch: refs/heads/ignite-4565-ddl
Commit: 8874f99f44dc2edf08a525619edb49d5db70b938
Parents: 0a43665
Author: dkarachentsev <dk...@gridgain.com>
Authored: Tue Feb 14 18:44:57 2017 +0300
Committer: dkarachentsev <dk...@gridgain.com>
Committed: Tue Feb 14 18:44:57 2017 +0300
----------------------------------------------------------------------
.../internal/managers/GridManagerAdapter.java | 4 +
.../org/apache/ignite/spi/IgniteSpiAdapter.java | 5 +
.../org/apache/ignite/spi/IgniteSpiContext.java | 6 +
.../ignite/spi/discovery/tcp/ClientImpl.java | 2 +-
.../spi/discovery/tcp/TcpDiscoverySpi.java | 5 +
.../tcp/internal/TcpDiscoveryNode.java | 6 +-
...veryNodeAttributesUpdateOnReconnectTest.java | 110 ++++++++++++++++++
.../tcp/TestReconnectPluginProvider.java | 111 +++++++++++++++++++
.../discovery/tcp/TestReconnectProcessor.java | 93 ++++++++++++++++
.../testframework/GridSpiTestContext.java | 5 +
.../IgniteSpiDiscoverySelfTestSuite.java | 3 +
.../org.apache.ignite.plugin.PluginProvider | 1 +
parent/pom.xml | 1 +
13 files changed, 349 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/8874f99f/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java
index 584cc56..25cc715 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java
@@ -569,6 +569,10 @@ public abstract class GridManagerAdapter<T extends IgniteSpi> implements GridMan
ctx.timeout().removeTimeoutObject(new GridSpiTimeoutObject(obj));
}
+ @Override public Map<String, Object> nodeAttributes() {
+ return ctx.nodeAttributes();
+ }
+
/**
* @param e Exception to handle.
* @return GridSpiException Converted exception.
http://git-wip-us.apache.org/repos/asf/ignite/blob/8874f99f/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java
index 219d07b..8879364 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java
@@ -928,5 +928,10 @@ public abstract class IgniteSpiAdapter implements IgniteSpi, IgniteSpiManagement
((IgniteKernal)ignite0).context().timeout().removeTimeoutObject(new GridSpiTimeoutObject(obj));
}
+
+ /** {@inheritDoc} */
+ @Override public Map<String, Object> nodeAttributes() {
+ return Collections.emptyMap();
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/8874f99f/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiContext.java b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiContext.java
index 5eb5227..96b3e61 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiContext.java
@@ -19,6 +19,7 @@ package org.apache.ignite.spi;
import java.io.Serializable;
import java.util.Collection;
+import java.util.Map;
import java.util.UUID;
import javax.cache.CacheException;
import org.apache.ignite.IgniteException;
@@ -352,4 +353,9 @@ public interface IgniteSpiContext {
* @param c Timeout object.
*/
public void removeTimeoutObject(IgniteSpiTimeoutObject c);
+
+ /**
+ * @return Current node attributes.
+ */
+ public Map<String, Object> nodeAttributes();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/8874f99f/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
index 39c539c..932e7d1 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
@@ -628,7 +628,7 @@ class ClientImpl extends TcpDiscoveryImpl {
TcpDiscoveryNode node = locNode;
if (locNode.order() > 0)
- node = locNode.clientReconnectNode();
+ node = locNode.clientReconnectNode(spi.spiCtx.nodeAttributes());
msg = new TcpDiscoveryJoinRequestMessage(node, spi.collectExchangeData(getLocalNodeId()));
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/8874f99f/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 45933e1..00ae97d 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
@@ -409,6 +409,9 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
/** */
private boolean clientReconnectDisabled;
+ /** */
+ protected IgniteSpiContext spiCtx;
+
/** {@inheritDoc} */
@Override public String getSpiState() {
return impl.getSpiState();
@@ -1161,6 +1164,8 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
@Override protected void onContextInitialized0(IgniteSpiContext spiCtx) throws IgniteSpiException {
super.onContextInitialized0(spiCtx);
+ this.spiCtx = spiCtx;
+
ctxInitLatch.countDown();
ipFinder.onSpiContextInitialized(spiCtx);
http://git-wip-us.apache.org/repos/asf/ignite/blob/8874f99f/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 307aefe..d8b1fc1 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
@@ -26,6 +26,7 @@ import java.net.InetSocketAddress;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@@ -513,13 +514,14 @@ public class TcpDiscoveryNode extends GridMetadataAwareAdapter implements Cluste
}
/**
+ * @param nodeAttrs Current node attributes.
* @return Copy of local node for client reconnect request.
*/
- public TcpDiscoveryNode clientReconnectNode() {
+ public TcpDiscoveryNode clientReconnectNode(Map<String, Object> nodeAttrs) {
TcpDiscoveryNode node = new TcpDiscoveryNode(id, addrs, hostNames, discPort, metricsProvider, ver,
null);
- node.attrs = attrs;
+ node.attrs = Collections.unmodifiableMap(new HashMap<>(nodeAttrs));
node.clientRouterNodeId = clientRouterNodeId;
return node;
http://git-wip-us.apache.org/repos/asf/ignite/blob/8874f99f/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryNodeAttributesUpdateOnReconnectTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryNodeAttributesUpdateOnReconnectTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryNodeAttributesUpdateOnReconnectTest.java
new file mode 100644
index 0000000..56dc4ec
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryNodeAttributesUpdateOnReconnectTest.java
@@ -0,0 +1,110 @@
+/*
+ * 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.spi.discovery.tcp;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteEvents;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.events.DiscoveryEvent;
+import org.apache.ignite.events.Event;
+import org.apache.ignite.events.EventType;
+import org.apache.ignite.internal.IgniteClientReconnectAbstractTest;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.resources.LoggerResource;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+import static org.apache.ignite.internal.IgniteClientReconnectAbstractTest.reconnectClientNode;
+
+/**
+ * Checks whether on client reconnect node attributes from kernal context are sent.
+ */
+public class TcpDiscoveryNodeAttributesUpdateOnReconnectTest extends GridCommonAbstractTest {
+ /** */
+ private volatile String rejoinAttr;
+
+ /** */
+ @LoggerResource
+ private IgniteLogger log;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ if (gridName.contains("client")) {
+ Map<String, String> attrs = new HashMap<>();
+
+ attrs.put("test", "1");
+
+ cfg.setUserAttributes(attrs);
+ cfg.setClientMode(true);
+ }
+
+ IgniteClientReconnectAbstractTest.TestTcpDiscoverySpi spi = new IgniteClientReconnectAbstractTest.TestTcpDiscoverySpi();
+
+ TcpDiscoveryIpFinder finder = ((TcpDiscoverySpi)cfg.getDiscoverySpi()).getIpFinder();
+
+ spi.setIpFinder(finder);
+
+ cfg.setDiscoverySpi(spi);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ TestReconnectPluginProvider.enabled = false;
+
+ stopAllGrids();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ TestReconnectPluginProvider.enabled = true;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testReconnect() throws Exception {
+ Ignite srv = startGrid("server");
+
+ IgniteEvents evts = srv.events();
+
+ evts.enableLocal(EventType.EVTS_DISCOVERY_ALL);
+ evts.localListen(new IgnitePredicate<Event>() {
+ @Override public boolean apply(Event evt) {
+ ClusterNode node = ((DiscoveryEvent)evt).eventNode();
+
+ rejoinAttr = node.attribute("test");
+
+ return true;
+ }
+ }, EventType.EVT_NODE_JOINED);
+
+ Ignite client = startGrid("client");
+
+ reconnectClientNode(log, client, srv, null);
+
+ assertEquals("2", rejoinAttr);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/8874f99f/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TestReconnectPluginProvider.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TestReconnectPluginProvider.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TestReconnectPluginProvider.java
new file mode 100644
index 0000000..692774c
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TestReconnectPluginProvider.java
@@ -0,0 +1,111 @@
+/*
+ * 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.spi.discovery.tcp;
+
+import java.io.Serializable;
+import java.util.UUID;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.processors.security.GridSecurityProcessor;
+import org.apache.ignite.plugin.ExtensionRegistry;
+import org.apache.ignite.plugin.IgnitePlugin;
+import org.apache.ignite.plugin.PluginContext;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.plugin.PluginValidationException;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Creates TestReconnectProcessor.
+ */
+public class TestReconnectPluginProvider implements PluginProvider {
+ /** */
+ private GridKernalContext igniteCtx;
+
+ /** */
+ public static volatile boolean enabled;
+
+ /** {@inheritDoc} */
+ @Override public String name() {
+ return "TestReconnectPlugin";
+ }
+
+ /** {@inheritDoc} */
+ @Override public String version() {
+ return "1.0";
+ }
+
+ /** {@inheritDoc} */
+ @Override public String copyright() {
+ return "";
+ }
+
+ /** {@inheritDoc} */
+ @Override public void initExtensions(PluginContext ctx, ExtensionRegistry registry) {
+ igniteCtx = ((IgniteKernal)ctx.grid()).context();
+ }
+
+ /** {@inheritDoc} */
+ @Override public void start(PluginContext ctx) throws IgniteCheckedException {
+ // No-op
+ }
+
+ /** {@inheritDoc} */
+ @Override public void stop(boolean cancel) throws IgniteCheckedException {
+ // No-op
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onIgniteStart() throws IgniteCheckedException {
+ // No-op
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onIgniteStop(boolean cancel) {
+ // No-op
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public Serializable provideDiscoveryData(UUID nodeId) {
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void receiveDiscoveryData(UUID nodeId, Serializable data) {
+ // No-op
+ }
+
+ /** {@inheritDoc} */
+ @Override public void validateNewNode(ClusterNode node) throws PluginValidationException {
+ // No-op
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public Object createComponent(PluginContext ctx, Class cls) {
+ if (enabled && GridSecurityProcessor.class.equals(cls))
+ return new TestReconnectProcessor(igniteCtx);
+
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgnitePlugin plugin() {
+ return new IgnitePlugin() {};
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/8874f99f/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TestReconnectProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TestReconnectProcessor.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TestReconnectProcessor.java
new file mode 100644
index 0000000..f0ed35c
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TestReconnectProcessor.java
@@ -0,0 +1,93 @@
+/*
+ * 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.spi.discovery.tcp;
+
+import java.util.Collection;
+import java.util.UUID;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.processors.GridProcessorAdapter;
+import org.apache.ignite.internal.processors.security.GridSecurityProcessor;
+import org.apache.ignite.internal.processors.security.SecurityContext;
+import org.apache.ignite.lang.IgniteFuture;
+import org.apache.ignite.plugin.security.AuthenticationContext;
+import org.apache.ignite.plugin.security.SecurityCredentials;
+import org.apache.ignite.plugin.security.SecurityException;
+import org.apache.ignite.plugin.security.SecurityPermission;
+import org.apache.ignite.plugin.security.SecuritySubject;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Updates node attributes on disconnect.
+ */
+public class TestReconnectProcessor extends GridProcessorAdapter implements GridSecurityProcessor {
+ /**
+ * @param ctx Kernal context.
+ */
+ protected TestReconnectProcessor(GridKernalContext ctx) {
+ super(ctx);
+ }
+
+ /** {@inheritDoc} */
+ @Override public SecurityContext authenticateNode(ClusterNode node,
+ SecurityCredentials cred) throws IgniteCheckedException {
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isGlobalNodeAuthentication() {
+ return false;
+ }
+
+ /** {@inheritDoc} */
+ @Override public SecurityContext authenticate(AuthenticationContext ctx) throws IgniteCheckedException {
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Collection<SecuritySubject> authenticatedSubjects() throws IgniteCheckedException {
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public SecuritySubject authenticatedSubject(UUID subjId) throws IgniteCheckedException {
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void authorize(String name, SecurityPermission perm,
+ @Nullable SecurityContext securityCtx) throws SecurityException {
+
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onSessionExpired(UUID subjId) {
+
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean enabled() {
+ return false;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onDisconnected(IgniteFuture<?> reconnectFut) throws IgniteCheckedException {
+ ctx.addNodeAttribute("test", "2");
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/8874f99f/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java b/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java
index ac50ef9..1c8acbc 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java
@@ -601,6 +601,11 @@ public class GridSpiTestContext implements IgniteSpiContext {
timeoutProcessor.removeTimeoutObject(new GridSpiTimeoutObject(obj));
}
+ /** {@inheritDoc} */
+ @Override public Map<String, Object> nodeAttributes() {
+ return Collections.emptyMap();
+ }
+
/**
* @param cacheName Cache name.
* @return Map representing cache.
http://git-wip-us.apache.org/repos/asf/ignite/blob/8874f99f/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiDiscoverySelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiDiscoverySelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiDiscoverySelfTestSuite.java
index 5f870a4..548e1a5 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiDiscoverySelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiDiscoverySelfTestSuite.java
@@ -25,6 +25,7 @@ import org.apache.ignite.spi.discovery.tcp.TcpClientDiscoverySpiMulticastTest;
import org.apache.ignite.spi.discovery.tcp.TcpClientDiscoverySpiSelfTest;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoveryMarshallerCheckSelfTest;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoveryMultiThreadedTest;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoveryNodeAttributesUpdateOnReconnectTest;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoveryNodeConfigConsistentIdSelfTest;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoveryNodeConsistentIdSelfTest;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoveryRestartTest;
@@ -84,6 +85,8 @@ public class IgniteSpiDiscoverySelfTestSuite extends TestSuite {
suite.addTest(new TestSuite(TcpDiscoveryRestartTest.class));
suite.addTest(new TestSuite(TcpDiscoveryMultiThreadedTest.class));
+ suite.addTest(new TestSuite(TcpDiscoveryNodeAttributesUpdateOnReconnectTest.class));
+
// SSL.
suite.addTest(new TestSuite(TcpDiscoverySslSelfTest.class));
http://git-wip-us.apache.org/repos/asf/ignite/blob/8874f99f/modules/core/src/test/resources/META-INF/services/org.apache.ignite.plugin.PluginProvider
----------------------------------------------------------------------
diff --git a/modules/core/src/test/resources/META-INF/services/org.apache.ignite.plugin.PluginProvider b/modules/core/src/test/resources/META-INF/services/org.apache.ignite.plugin.PluginProvider
new file mode 100644
index 0000000..a7fdf43
--- /dev/null
+++ b/modules/core/src/test/resources/META-INF/services/org.apache.ignite.plugin.PluginProvider
@@ -0,0 +1 @@
+org.apache.ignite.spi.discovery.tcp.TestReconnectPluginProvider
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/8874f99f/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 88532a7..8bf5dde 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -821,6 +821,7 @@
<exclude>src/main/java/META-INF/services/javax.cache.spi.CachingProvider</exclude><!--cannot be changed-->
<exclude>src/main/java/org/jetbrains/annotations/*.java</exclude><!--copyright-->
<exclude>src/main/resources/META-INF/services/org.apache.hadoop.mapreduce.protocol.ClientProtocolProvider</exclude><!--cannot be changed-->
+ <exclude>/src/test/resources/META-INF/services/org.apache.ignite.plugin.PluginProvider</exclude>
<exclude>dev-tools/IGNITE-*.patch</exclude>
<exclude>dev-tools/.gradle/**/*</exclude>
<exclude>dev-tools/gradle/wrapper/**/*</exclude>
[12/33] ignite git commit: IGNITE-4717 VisorClearTask minor fix.
(cherry picked from commit d4b87f4)
Posted by vo...@apache.org.
IGNITE-4717 VisorClearTask minor fix.
(cherry picked from commit d4b87f4)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/bcb13982
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/bcb13982
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/bcb13982
Branch: refs/heads/ignite-4565-ddl
Commit: bcb139822afa148a7ea3fbb3eecc274f308070f6
Parents: 7ad8e79
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Fri Mar 10 15:51:38 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Mar 10 16:01:45 2017 +0700
----------------------------------------------------------------------
.../visor/cache/VisorCacheClearTask.java | 57 +++++++++++++++++++-
1 file changed, 56 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/bcb13982/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTask.java
index 0c8476f..ce74f17 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTask.java
@@ -25,6 +25,7 @@ import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.visor.VisorJob;
import org.apache.ignite.internal.visor.VisorOneNodeTask;
import org.apache.ignite.lang.IgniteBiTuple;
+import org.apache.ignite.lang.IgniteCallable;
import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgniteInClosure;
import org.apache.ignite.resources.JobContextResource;
@@ -145,4 +146,58 @@ public class VisorCacheClearTask extends VisorOneNodeTask<String, IgniteBiTuple<
return S.toString(VisorCacheClearJob.class, this);
}
}
-}
\ No newline at end of file
+
+ /**
+ * Callable to get cache size.
+ *
+ * @deprecated This class needed only for compatibility.
+ */
+ @GridInternal @Deprecated
+ private static class VisorCacheSizeCallable implements IgniteCallable<Integer> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private final IgniteCache cache;
+
+ /**
+ * @param cache Cache to take size from.
+ */
+ private VisorCacheSizeCallable(IgniteCache cache) {
+ this.cache = cache;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Integer call() throws Exception {
+ return cache.size(CachePeekMode.PRIMARY);
+ }
+ }
+
+ /**
+ * Callable to clear cache.
+ *
+ * @deprecated This class needed only for compatibility.
+ */
+ @GridInternal @Deprecated
+ private static class VisorCacheClearCallable implements IgniteCallable<Integer> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private final IgniteCache cache;
+
+ /**
+ * @param cache Cache to clear.
+ */
+ private VisorCacheClearCallable(IgniteCache cache) {
+ this.cache = cache;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Integer call() throws Exception {
+ cache.clear();
+
+ return 0;
+ }
+ }
+}
[14/33] ignite git commit: ignite-2552 Code review
Posted by vo...@apache.org.
ignite-2552 Code review
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/748d1fd0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/748d1fd0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/748d1fd0
Branch: refs/heads/ignite-4565-ddl
Commit: 748d1fd0a5ff6459f789b71ae1d0e36276965b51
Parents: 19566fb
Author: agura <ag...@apache.org>
Authored: Fri Mar 10 17:29:39 2017 +0300
Committer: agura <ag...@apache.org>
Committed: Fri Mar 10 17:29:39 2017 +0300
----------------------------------------------------------------------
.../cache/eviction/AbstractEvictionPolicy.java | 45 +++++++++-----------
.../cache/eviction/fifo/FifoEvictionPolicy.java | 10 ++---
.../cache/eviction/lru/LruEvictionPolicy.java | 10 ++---
.../eviction/sorted/SortedEvictionPolicy.java | 17 +++++---
4 files changed, 40 insertions(+), 42 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/748d1fd0/modules/core/src/main/java/org/apache/ignite/cache/eviction/AbstractEvictionPolicy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/AbstractEvictionPolicy.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/AbstractEvictionPolicy.java
index eca58e6..cf0aa1f 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/eviction/AbstractEvictionPolicy.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/eviction/AbstractEvictionPolicy.java
@@ -17,6 +17,7 @@
package org.apache.ignite.cache.eviction;
+import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
@@ -24,12 +25,9 @@ import org.apache.ignite.internal.util.typedef.internal.A;
import org.jsr166.LongAdder8;
/**
- * Common functionality implementation for eviction policies
+ * Common functionality implementation for eviction policies with max size/max memory and batch eviction support.
*/
-public abstract class AbstractEvictionPolicy<K, V> implements EvictionPolicy<K, V> {
- /** Memory size occupied by elements in container. */
- private final LongAdder8 memSize = new LongAdder8();
-
+public abstract class AbstractEvictionPolicy<K, V> implements EvictionPolicy<K, V>, Externalizable {
/** Max memory size occupied by elements in container. */
private volatile long maxMemSize;
@@ -39,6 +37,9 @@ public abstract class AbstractEvictionPolicy<K, V> implements EvictionPolicy<K,
/** Batch size. */
private volatile int batchSize = 1;
+ /** Memory size occupied by elements in container. */
+ protected final LongAdder8 memSize = new LongAdder8();
+
/**
* Shrinks backed container to maximum allowed size.
*/
@@ -48,7 +49,7 @@ public abstract class AbstractEvictionPolicy<K, V> implements EvictionPolicy<K,
if (maxMem > 0) {
long startMemSize = memSize.longValue();
- if (startMemSize >= maxMem)
+ if (startMemSize >= maxMem) {
for (long i = maxMem; i < startMemSize && memSize.longValue() > maxMem; ) {
int size = shrink0();
@@ -57,6 +58,7 @@ public abstract class AbstractEvictionPolicy<K, V> implements EvictionPolicy<K,
i += size;
}
+ }
}
int max = this.max;
@@ -64,10 +66,12 @@ public abstract class AbstractEvictionPolicy<K, V> implements EvictionPolicy<K,
if (max > 0) {
int startSize = getCurrentSize();
- if (startSize >= max + (maxMem > 0 ? 1 : this.batchSize))
- for (int i = max; i < startSize && getCurrentSize() > max; i++)
+ if (startSize >= max + (maxMem > 0 ? 1 : this.batchSize)) {
+ for (int i = max; i < startSize && getCurrentSize() > max; i++) {
if (shrink0() == -1)
break;
+ }
+ }
}
}
@@ -77,6 +81,7 @@ public abstract class AbstractEvictionPolicy<K, V> implements EvictionPolicy<K,
if (!entry.isCached())
return;
+ // Shrink only if queue was changed.
if (touch(entry))
shrink();
}
@@ -86,28 +91,19 @@ public abstract class AbstractEvictionPolicy<K, V> implements EvictionPolicy<K,
if (node != null) {
removeMeta(node);
- addToMemorySize(-entry.size());
+ memSize.add(-entry.size());
}
-
}
}
/**
- * @param x Changing memory size by adding the value.
- */
- protected void addToMemorySize(int x) {
- memSize.add(x);
- }
-
- /**
- *
- * @return Size of the container.
+ * @return Size of the container with trackable entries.
*/
protected abstract int getCurrentSize();
/**
*
- * @return Size of the memory which was shrinked0.
+ * @return Size of the memory which was shrinked.
*/
protected abstract int shrink0();
@@ -191,18 +187,15 @@ public abstract class AbstractEvictionPolicy<K, V> implements EvictionPolicy<K,
return batchSize;
}
- public LongAdder8 getMemSize() {
- return memSize;
- }
-
/** {@inheritDoc} */
- public void writeExternal(ObjectOutput out) throws IOException {
+ @Override public void writeExternal(ObjectOutput out) throws IOException {
out.writeInt(max);
out.writeInt(batchSize);
out.writeLong(maxMemSize);
}
+
/** {@inheritDoc} */
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
max = in.readInt();
batchSize = in.readInt();
maxMemSize = in.readLong();
http://git-wip-us.apache.org/repos/asf/ignite/blob/748d1fd0/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/FifoEvictionPolicy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/FifoEvictionPolicy.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/FifoEvictionPolicy.java
index dd7ba0f..f95a588 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/FifoEvictionPolicy.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/FifoEvictionPolicy.java
@@ -17,7 +17,6 @@
package org.apache.ignite.cache.eviction.fifo;
-import java.io.Externalizable;
import java.util.Collection;
import java.util.Collections;
import org.apache.ignite.cache.eviction.AbstractEvictionPolicy;
@@ -44,7 +43,7 @@ import org.jsr166.ConcurrentLinkedDeque8.Node;
* table-like data structures. The {@code FIFO} ordering information is
* maintained by attaching ordering metadata to cache entries.
*/
-public class FifoEvictionPolicy<K, V> extends AbstractEvictionPolicy<K, V> implements FifoEvictionPolicyMBean, Externalizable {
+public class FifoEvictionPolicy<K, V> extends AbstractEvictionPolicy<K, V> implements FifoEvictionPolicyMBean {
/** */
private static final long serialVersionUID = 0L;
@@ -81,7 +80,7 @@ public class FifoEvictionPolicy<K, V> extends AbstractEvictionPolicy<K, V> imple
/** {@inheritDoc} */
@Override public int getCurrentSize() {
- return queue.size();
+ return queue.sizex();
}
/**
@@ -94,6 +93,7 @@ public class FifoEvictionPolicy<K, V> extends AbstractEvictionPolicy<K, V> imple
}
/** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
@Override protected boolean removeMeta(Object meta) {
return queue.unlinkx((Node<EvictableEntry<K, V>>)meta);
}
@@ -125,7 +125,7 @@ public class FifoEvictionPolicy<K, V> extends AbstractEvictionPolicy<K, V> imple
return false;
}
- addToMemorySize(entry.size());
+ memSize.add(entry.size());
return true;
}
@@ -157,7 +157,7 @@ public class FifoEvictionPolicy<K, V> extends AbstractEvictionPolicy<K, V> imple
if (meta != null) {
size = entry.size();
- addToMemorySize(-size);
+ memSize.add(-size);
if (!entry.evict())
touch(entry);
http://git-wip-us.apache.org/repos/asf/ignite/blob/748d1fd0/modules/core/src/main/java/org/apache/ignite/cache/eviction/lru/LruEvictionPolicy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/lru/LruEvictionPolicy.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/lru/LruEvictionPolicy.java
index caa4b3f..17835f1 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/eviction/lru/LruEvictionPolicy.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/eviction/lru/LruEvictionPolicy.java
@@ -17,7 +17,6 @@
package org.apache.ignite.cache.eviction.lru;
-import java.io.Externalizable;
import java.util.Collection;
import java.util.Collections;
import org.apache.ignite.cache.eviction.AbstractEvictionPolicy;
@@ -43,7 +42,7 @@ import org.jsr166.ConcurrentLinkedDeque8.Node;
* This implementation is very efficient since it is lock-free and does not create any additional table-like
* data structures. The {@code LRU} ordering information is maintained by attaching ordering metadata to cache entries.
*/
-public class LruEvictionPolicy<K, V> extends AbstractEvictionPolicy<K, V> implements LruEvictionPolicyMBean, Externalizable {
+public class LruEvictionPolicy<K, V> extends AbstractEvictionPolicy<K, V> implements LruEvictionPolicyMBean {
/** */
private static final long serialVersionUID = 0L;
@@ -69,7 +68,7 @@ public class LruEvictionPolicy<K, V> extends AbstractEvictionPolicy<K, V> implem
/** {@inheritDoc} */
@Override public int getCurrentSize() {
- return queue.size();
+ return queue.sizex();
}
/**
@@ -82,6 +81,7 @@ public class LruEvictionPolicy<K, V> extends AbstractEvictionPolicy<K, V> implem
}
/** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
@Override protected boolean removeMeta(Object meta) {
return queue.unlinkx((Node<EvictableEntry<K, V>>)meta);
}
@@ -113,7 +113,7 @@ public class LruEvictionPolicy<K, V> extends AbstractEvictionPolicy<K, V> implem
return false;
}
- addToMemorySize(entry.size());
+ memSize.add(entry.size());
return true;
}
@@ -153,7 +153,7 @@ public class LruEvictionPolicy<K, V> extends AbstractEvictionPolicy<K, V> implem
if (meta != null) {
size = entry.size();
- addToMemorySize(-size);
+ memSize.add(-size);
if (!entry.evict())
touch(entry);
http://git-wip-us.apache.org/repos/asf/ignite/blob/748d1fd0/modules/core/src/main/java/org/apache/ignite/cache/eviction/sorted/SortedEvictionPolicy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/sorted/SortedEvictionPolicy.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/sorted/SortedEvictionPolicy.java
index 47f8479..d0cc975 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/eviction/sorted/SortedEvictionPolicy.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/eviction/sorted/SortedEvictionPolicy.java
@@ -17,7 +17,6 @@
package org.apache.ignite.cache.eviction.sorted;
-import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
@@ -59,7 +58,7 @@ import static org.apache.ignite.configuration.CacheConfiguration.DFLT_CACHE_SIZE
* <p>
* User defined comparator should implement {@link Serializable} interface.
*/
-public class SortedEvictionPolicy<K, V> extends AbstractEvictionPolicy<K, V> implements SortedEvictionPolicyMBean, Externalizable {
+public class SortedEvictionPolicy<K, V> extends AbstractEvictionPolicy<K, V> implements SortedEvictionPolicyMBean {
/** */
private static final long serialVersionUID = 0L;
@@ -108,6 +107,7 @@ public class SortedEvictionPolicy<K, V> extends AbstractEvictionPolicy<K, V> imp
public SortedEvictionPolicy(int max, int batchSize, @Nullable Comparator<EvictableEntry<K, V>> comp) {
setMaxSize(max);
setBatchSize(batchSize);
+
this.comp = comp == null ? new DefaultHolderComparator<K, V>() : new HolderComparator<>(comp);
this.set = new GridConcurrentSkipListSetEx<>(this.comp);
}
@@ -161,7 +161,7 @@ public class SortedEvictionPolicy<K, V> extends AbstractEvictionPolicy<K, V> imp
return false;
}
- addToMemorySize(entry.size());
+ memSize.add(entry.size());
return true;
}
@@ -177,7 +177,7 @@ public class SortedEvictionPolicy<K, V> extends AbstractEvictionPolicy<K, V> imp
/** {@inheritDoc} */
@Override public int getCurrentSize() {
- return set.size();
+ return set.sizex();
}
/**
@@ -195,10 +195,12 @@ public class SortedEvictionPolicy<K, V> extends AbstractEvictionPolicy<K, V> imp
EvictableEntry<K, V> entry = h.entry;
- if (entry != null && h.order > 0 && entry.removeMeta(h)) {
+ assert entry != null;
+
+ if (h.order > 0 && entry.removeMeta(h)) {
size = entry.size();
- addToMemorySize(-size);
+ memSize.add(-size);
if (!entry.evict())
touch(entry);
@@ -210,6 +212,7 @@ public class SortedEvictionPolicy<K, V> extends AbstractEvictionPolicy<K, V> imp
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
super.writeExternal(out);
+
out.writeObject(comp);
}
@@ -217,6 +220,7 @@ public class SortedEvictionPolicy<K, V> extends AbstractEvictionPolicy<K, V> imp
@SuppressWarnings("unchecked")
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
super.readExternal(in);
+
comp = (Comparator<Holder<K, V>>)in.readObject();
}
@@ -225,6 +229,7 @@ public class SortedEvictionPolicy<K, V> extends AbstractEvictionPolicy<K, V> imp
*
* @param meta Holder.
*/
+ @SuppressWarnings("unchecked")
@Override protected boolean removeMeta(Object meta) {
Holder<K, V> holder = (Holder<K, V>)meta;
[18/33] ignite git commit: IGNITE-933:
GridFailFastNodeFailureDetectionSelfTest.testFailFast fails periodically
Posted by vo...@apache.org.
IGNITE-933: GridFailFastNodeFailureDetectionSelfTest.testFailFast fails periodically
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f361da43
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f361da43
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f361da43
Branch: refs/heads/ignite-4565-ddl
Commit: f361da4305db72cd1e3784721ebbbc8520382353
Parents: 3da7794
Author: Vadim Opolskij <va...@gmail.com>
Authored: Tue Mar 14 19:03:08 2017 -0700
Committer: Denis Magda <dm...@gridgain.com>
Committed: Tue Mar 14 19:03:08 2017 -0700
----------------------------------------------------------------------
.../ignite/internal/GridFailFastNodeFailureDetectionSelfTest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f361da43/modules/core/src/test/java/org/apache/ignite/internal/GridFailFastNodeFailureDetectionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridFailFastNodeFailureDetectionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridFailFastNodeFailureDetectionSelfTest.java
index 49a3f94..a4886cd 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridFailFastNodeFailureDetectionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridFailFastNodeFailureDetectionSelfTest.java
@@ -113,7 +113,7 @@ public class GridFailFastNodeFailureDetectionSelfTest extends GridCommonAbstract
failNode(ignite1);
- assert failLatch.await(1000, MILLISECONDS);
+ assert failLatch.await(1500, MILLISECONDS);
}
/**
[31/33] ignite git commit: Fixes after merge from master.
Posted by vo...@apache.org.
Fixes after merge from master.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7e6f214e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7e6f214e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7e6f214e
Branch: refs/heads/ignite-4565-ddl
Commit: 7e6f214e8404e45c63585f96966136fb1112c382
Parents: 0b6b838
Author: devozerov <vo...@gridgain.com>
Authored: Tue Mar 21 11:10:58 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Tue Mar 21 11:10:58 2017 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheProcessor.java | 1 -
.../processors/query/GridQueryProcessor.java | 3 ---
.../internal/processors/query/QueryUtils.java | 20 +++++++++++++++++---
3 files changed, 17 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7e6f214e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index d383ce8..a7d38a7 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -102,7 +102,6 @@ import org.apache.ignite.internal.processors.cache.version.GridCacheVersionManag
import org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessor;
import org.apache.ignite.internal.processors.plugin.CachePluginManager;
import org.apache.ignite.internal.processors.timeout.GridTimeoutObject;
-import org.apache.ignite.internal.suggestions.GridPerformanceSuggestions;
import org.apache.ignite.internal.util.F0;
import org.apache.ignite.internal.util.future.GridCompoundFuture;
import org.apache.ignite.internal.util.future.GridFinishedFuture;
http://git-wip-us.apache.org/repos/asf/ignite/blob/7e6f214e/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index 47341da..a58ca53 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -31,9 +31,6 @@ import javax.cache.CacheException;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteDataStreamer;
import org.apache.ignite.IgniteException;
-import org.apache.ignite.binary.BinaryField;
-import org.apache.ignite.binary.BinaryObject;
-import org.apache.ignite.binary.BinaryType;
import org.apache.ignite.binary.Binarylizable;
import org.apache.ignite.cache.CacheTypeMetadata;
import org.apache.ignite.cache.QueryEntity;
http://git-wip-us.apache.org/repos/asf/ignite/blob/7e6f214e/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
index c033801..20570ab 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
@@ -703,12 +703,26 @@ public class QueryUtils {
res = buildClassProperty(false, valCls, pathStr, resType, aliases, coCtx);
if (res == null)
- throw new IgniteCheckedException("Failed to initialize property '" + pathStr + "' of type '" +
- resType.getName() + "' for key class '" + keyCls + "' and value class '" + valCls + "'. " +
- "Make sure that one of these classes contains respective getter method or field.");
+ throw new IgniteCheckedException(propertyInitializationExceptionMessage(keyCls, valCls, pathStr, resType));
return res;
}
+
+ /**
+ * Exception message to compare in tests.
+ *
+ * @param keyCls key class
+ * @param valCls value class
+ * @param pathStr property name
+ * @param resType property type
+ * @return Exception message.
+ */
+ public static String propertyInitializationExceptionMessage(Class<?> keyCls, Class<?> valCls, String pathStr,
+ Class<?> resType) {
+ return "Failed to initialize property '" + pathStr + "' of type '" +
+ resType.getName() + "' for key class '" + keyCls + "' and value class '" + valCls + "'. " +
+ "Make sure that one of these classes contains respective getter method or field.";
+ }
/**
* @param key If this is a key property.
[04/33] ignite git commit: Merge remote-tracking branch
'origin/ignite-1.7.8' into ignite-1.7.8
Posted by vo...@apache.org.
Merge remote-tracking branch 'origin/ignite-1.7.8' into ignite-1.7.8
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/382fbc9d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/382fbc9d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/382fbc9d
Branch: refs/heads/ignite-4565-ddl
Commit: 382fbc9d0b55f794eb4a9045fe72ca06b480062f
Parents: 1f881aa 05788b3
Author: dkarachentsev <dk...@gridgain.com>
Authored: Fri Feb 17 12:35:18 2017 +0300
Committer: dkarachentsev <dk...@gridgain.com>
Committed: Fri Feb 17 12:35:18 2017 +0300
----------------------------------------------------------------------
.../Hibernate5CacheKeyTypeConfiguration.java | 52 ++++++++++++++++++++
.../HibernateCacheKeyTypeConfiguration.java | 51 +++++++++++++++++++
2 files changed, 103 insertions(+)
----------------------------------------------------------------------
[20/33] ignite git commit: Merge ignite-1.7.9 into master
Posted by vo...@apache.org.
Merge ignite-1.7.9 into master
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/84880a81
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/84880a81
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/84880a81
Branch: refs/heads/ignite-4565-ddl
Commit: 84880a8108a586604ab00d7bf48ba6c9f8f658ee
Parents: 94c1e7c bcb1398
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Thu Mar 16 16:34:28 2017 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Thu Mar 16 16:34:36 2017 +0300
----------------------------------------------------------------------
.../internal/managers/GridManagerAdapter.java | 4 +
.../cache/DynamicCacheChangeBatch.java | 14 ++
.../service/GridServiceProcessor.java | 49 ++---
.../org/apache/ignite/spi/IgniteSpiAdapter.java | 5 +
.../org/apache/ignite/spi/IgniteSpiContext.java | 6 +
.../ignite/spi/discovery/tcp/ClientImpl.java | 32 +++-
.../ignite/spi/discovery/tcp/ServerImpl.java | 19 ++
.../spi/discovery/tcp/TcpDiscoverySpi.java | 5 +
.../tcp/internal/TcpDiscoveryNode.java | 6 +-
.../GridServiceContinuousQueryRedeploy.java | 167 +++++++++++++++++
...veryNodeAttributesUpdateOnReconnectTest.java | 110 +++++++++++
.../TcpDiscoverySslSecuredUnsecuredTest.java | 185 +++++++++++++++++++
.../tcp/TestReconnectPluginProvider.java | 111 +++++++++++
.../discovery/tcp/TestReconnectProcessor.java | 93 ++++++++++
.../testframework/GridSpiTestContext.java | 5 +
.../testsuites/IgniteKernalSelfTestSuite.java | 2 +
.../IgniteSpiDiscoverySelfTestSuite.java | 5 +
.../org.apache.ignite.plugin.PluginProvider | 1 +
.../processors/query/h2/IgniteH2Indexing.java | 1 +
parent/pom.xml | 1 +
20 files changed, 793 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/84880a81/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/84880a81/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
index 99146aa,4eeafed..74cca8e
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
@@@ -1586,16 -1576,19 +1576,22 @@@ public class GridServiceProcessor exten
if (!((CacheAffinityChangeMessage)msg).exchangeNeeded())
return;
}
+ else if (msg instanceof DynamicCacheChangeBatch) {
+ if (!((DynamicCacheChangeBatch)msg).exchangeNeeded())
+ return;
+ }
+ else
+ return;
}
else
- topVer = new AffinityTopologyVersion(((DiscoveryEvent)evt).topologyVersion(), 0);
+ topVer = new AffinityTopologyVersion((evt).topologyVersion(), 0);
- depExe.submit(new BusyRunnable() {
+ depExe.execute(new BusyRunnable() {
@Override public void run0() {
- ClusterNode oldest = ctx.discovery().oldestAliveCacheServerNode(topVer);
+ // In case the cache instance isn't tracked by DiscoveryManager anymore.
+ discoCache.updateAlives(ctx.discovery());
+
+ ClusterNode oldest = discoCache.oldestAliveServerNodeWithCache();
if (oldest != null && oldest.isLocal()) {
final Collection<GridServiceDeployment> retries = new ConcurrentLinkedQueue<>();
http://git-wip-us.apache.org/repos/asf/ignite/blob/84880a81/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/84880a81/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/84880a81/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/84880a81/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/84880a81/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
----------------------------------------------------------------------
diff --cc modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
index 41035ec,5977702..df27868
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
@@@ -141,7 -144,7 +142,8 @@@ public class IgniteKernalSelfTestSuite
suite.addTestSuite(GridServiceProxyClientReconnectSelfTest.class);
suite.addTestSuite(IgniteServiceReassignmentTest.class);
suite.addTestSuite(IgniteServiceProxyTimeoutInitializedTest.class);
+ suite.addTestSuite(IgniteServiceDynamicCachesSelfTest.class);
+ suite.addTestSuite(GridServiceContinuousQueryRedeploy.class);
suite.addTestSuite(IgniteServiceDeploymentClassLoadingDefaultMarshallerTest.class);
suite.addTestSuite(IgniteServiceDeploymentClassLoadingOptimizedMarshallerTest.class);
http://git-wip-us.apache.org/repos/asf/ignite/blob/84880a81/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --cc modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index 46fbb9e,62b47b8..7b188bf
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@@ -83,9 -80,7 +83,10 @@@ import org.apache.ignite.internal.proce
import org.apache.ignite.internal.processors.cache.QueryCursorImpl;
import org.apache.ignite.internal.processors.cache.query.GridCacheQueryMarshallable;
import org.apache.ignite.internal.processors.cache.query.GridCacheTwoStepQuery;
+import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode;
+import org.apache.ignite.internal.processors.query.GridQueryCacheObjectsIterator;
+import org.apache.ignite.internal.processors.query.GridRunningQueryInfo;
+ import org.apache.ignite.internal.processors.query.GridRunningQueryInfo;
import org.apache.ignite.internal.processors.query.GridQueryCancel;
import org.apache.ignite.internal.processors.query.GridQueryFieldMetadata;
import org.apache.ignite.internal.processors.query.GridQueryFieldsResult;
http://git-wip-us.apache.org/repos/asf/ignite/blob/84880a81/parent/pom.xml
----------------------------------------------------------------------
[29/33] ignite git commit: Web Console: minor fix.
Posted by vo...@apache.org.
Web Console: minor fix.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/92bce6ec
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/92bce6ec
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/92bce6ec
Branch: refs/heads/ignite-4565-ddl
Commit: 92bce6ec9cdfa3ed7184b055d07be8efc87dbeb6
Parents: fbb9940
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Tue Mar 21 11:23:18 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Tue Mar 21 11:23:18 2017 +0700
----------------------------------------------------------------------
modules/web-console/frontend/app/modules/sql/sql.controller.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/92bce6ec/modules/web-console/frontend/app/modules/sql/sql.controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/sql/sql.controller.js b/modules/web-console/frontend/app/modules/sql/sql.controller.js
index a3a5a5f..075bd55 100644
--- a/modules/web-console/frontend/app/modules/sql/sql.controller.js
+++ b/modules/web-console/frontend/app/modules/sql/sql.controller.js
@@ -154,7 +154,7 @@ class Paragraph {
while (_.nonNil(cause)) {
if (_.nonEmpty(cause.className) &&
- _.includes(['SQLException', 'JdbcSQLException'], JavaTypes.shortClassName(cause.className))) {
+ _.includes(['SQLException', 'JdbcSQLException', 'QueryCancelledException'], JavaTypes.shortClassName(cause.className))) {
this.error.message = cause.message;
break;
[27/33] ignite git commit: Merge branch ignite-1.7.9 into ignite-2.0
Posted by vo...@apache.org.
Merge branch ignite-1.7.9 into ignite-2.0
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/99bb87ae
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/99bb87ae
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/99bb87ae
Branch: refs/heads/ignite-4565-ddl
Commit: 99bb87ae97153c3d2965ef8573b9efaf8b3e639a
Parents: 67bd32c bcb1398
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Mon Mar 20 18:22:03 2017 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Mon Mar 20 18:22:35 2017 +0300
----------------------------------------------------------------------
.../internal/managers/GridManagerAdapter.java | 4 +
.../cache/DynamicCacheChangeBatch.java | 14 ++
.../processors/query/GridQueryProcessor.java | 3 +
.../service/GridServiceProcessor.java | 50 +++--
.../org/apache/ignite/spi/IgniteSpiAdapter.java | 5 +
.../org/apache/ignite/spi/IgniteSpiContext.java | 6 +
.../ignite/spi/discovery/tcp/ClientImpl.java | 32 +++-
.../ignite/spi/discovery/tcp/ServerImpl.java | 19 ++
.../spi/discovery/tcp/TcpDiscoverySpi.java | 5 +
.../tcp/internal/TcpDiscoveryNode.java | 6 +-
.../GridServiceContinuousQueryRedeployTest.java | 167 +++++++++++++++++
...veryNodeAttributesUpdateOnReconnectTest.java | 110 +++++++++++
.../TcpDiscoverySslSecuredUnsecuredTest.java | 185 +++++++++++++++++++
.../tcp/TestReconnectPluginProvider.java | 111 +++++++++++
.../discovery/tcp/TestReconnectProcessor.java | 93 ++++++++++
.../testframework/GridSpiTestContext.java | 5 +
.../testsuites/IgniteKernalSelfTestSuite.java | 2 +
.../IgniteSpiDiscoverySelfTestSuite.java | 5 +
.../org.apache.ignite.plugin.PluginProvider | 1 +
.../processors/query/h2/IgniteH2Indexing.java | 1 +
parent/pom.xml | 1 +
21 files changed, 795 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/99bb87ae/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/99bb87ae/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index a58ca53,0a0d166..47341da
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@@ -29,8 -42,11 +29,11 @@@ import java.util.concurrent.ConcurrentM
import javax.cache.Cache;
import javax.cache.CacheException;
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteDataStreamer;
import org.apache.ignite.IgniteException;
+ import org.apache.ignite.binary.BinaryField;
+ import org.apache.ignite.binary.BinaryObject;
+ import org.apache.ignite.binary.BinaryType;
import org.apache.ignite.binary.Binarylizable;
import org.apache.ignite.cache.CacheTypeMetadata;
import org.apache.ignite.cache.QueryEntity;
http://git-wip-us.apache.org/repos/asf/ignite/blob/99bb87ae/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
index a680a88,4eeafed..84fb8e3
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
@@@ -65,12 -65,12 +65,14 @@@ import org.apache.ignite.internal.proce
import org.apache.ignite.internal.processors.cache.CacheAffinityChangeMessage;
import org.apache.ignite.internal.processors.cache.CacheEntryImpl;
import org.apache.ignite.internal.processors.cache.CacheIteratorConverter;
+ import org.apache.ignite.internal.processors.cache.DynamicCacheChangeBatch;
import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
+import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal;
import org.apache.ignite.internal.processors.cache.query.CacheQuery;
import org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager;
-import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
+import org.apache.ignite.internal.processors.marshaller.MappingAcceptedMessage;
+import org.apache.ignite.internal.processors.marshaller.MappingProposedMessage;
+ import org.apache.ignite.internal.processors.continuous.AbstractContinuousMessage;
import org.apache.ignite.internal.processors.task.GridInternal;
import org.apache.ignite.internal.processors.timeout.GridTimeoutObject;
import org.apache.ignite.internal.util.GridEmptyIterator;
@@@ -1586,21 -1576,19 +1576,24 @@@ public class GridServiceProcessor exten
if (!((CacheAffinityChangeMessage)msg).exchangeNeeded())
return;
}
-
- if (msg instanceof MappingProposedMessage || msg instanceof MappingAcceptedMessage)
+ else if (msg instanceof DynamicCacheChangeBatch) {
+ if (!((DynamicCacheChangeBatch)msg).exchangeNeeded())
+ return;
+ }
+ else
return;
+
+ topVer = ((DiscoveryCustomEvent)evt).affinityTopologyVersion();
}
else
- topVer = new AffinityTopologyVersion(((DiscoveryEvent)evt).topologyVersion(), 0);
+ topVer = new AffinityTopologyVersion((evt).topologyVersion(), 0);
- depExe.submit(new BusyRunnable() {
+ depExe.execute(new BusyRunnable() {
@Override public void run0() {
- ClusterNode oldest = ctx.discovery().oldestAliveCacheServerNode(topVer);
+ // In case the cache instance isn't tracked by DiscoveryManager anymore.
+ discoCache.updateAlives(ctx.discovery());
+
+ ClusterNode oldest = discoCache.oldestAliveServerNodeWithCache();
if (oldest != null && oldest.isLocal()) {
final Collection<GridServiceDeployment> retries = new ConcurrentLinkedQueue<>();
http://git-wip-us.apache.org/repos/asf/ignite/blob/99bb87ae/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/99bb87ae/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
index 5c13449,95e2cda..04b076d
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
@@@ -629,11 -632,9 +633,11 @@@ class ClientImpl extends TcpDiscoveryIm
TcpDiscoveryNode node = locNode;
if (locNode.order() > 0)
- node = locNode.clientReconnectNode();
+ node = locNode.clientReconnectNode(spi.spiCtx.nodeAttributes());
- msg = new TcpDiscoveryJoinRequestMessage(node, spi.collectExchangeData(getLocalNodeId()));
+ msg = new TcpDiscoveryJoinRequestMessage(
+ node,
+ spi.collectExchangeData(new DiscoveryDataPacket(getLocalNodeId())));
}
else
msg = new TcpDiscoveryClientReconnectMessage(getLocalNodeId(), rmtNodeId, lastMsgId);
http://git-wip-us.apache.org/repos/asf/ignite/blob/99bb87ae/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/99bb87ae/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/99bb87ae/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceContinuousQueryRedeployTest.java
----------------------------------------------------------------------
diff --cc modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceContinuousQueryRedeployTest.java
index 0000000,0000000..2437b47
new file mode 100644
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceContinuousQueryRedeployTest.java
@@@ -1,0 -1,0 +1,167 @@@
++/*
++ * 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.service;
++
++import java.util.ArrayList;
++import java.util.Collections;
++import java.util.List;
++import java.util.UUID;
++import java.util.concurrent.Callable;
++import javax.cache.event.CacheEntryEvent;
++import javax.cache.event.CacheEntryListenerException;
++import javax.cache.event.CacheEntryUpdatedListener;
++import org.apache.ignite.Ignite;
++import org.apache.ignite.IgniteCache;
++import org.apache.ignite.cache.query.ContinuousQuery;
++import org.apache.ignite.cache.query.QueryCursor;
++import org.apache.ignite.cluster.ClusterNode;
++import org.apache.ignite.internal.IgniteInternalFuture;
++import org.apache.ignite.internal.util.typedef.internal.U;
++import org.apache.ignite.lang.IgnitePredicate;
++import org.apache.ignite.resources.IgniteInstanceResource;
++import org.apache.ignite.services.Service;
++import org.apache.ignite.services.ServiceConfiguration;
++import org.apache.ignite.services.ServiceContext;
++import org.apache.ignite.testframework.GridTestUtils;
++import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
++
++/**
++ * Tests whether concurrent service cancel and registering ContinuousQuery doesn't causes
++ * service redeployment.
++ */
++public class GridServiceContinuousQueryRedeployTest extends GridCommonAbstractTest {
++ /** */
++ private static final String CACHE_NAME = "TEST_CACHE";
++
++ /** */
++ private static final String TEST_KEY = "TEST_KEY";
++
++ /** */
++ private static final String SERVICE_NAME = "service1";
++
++ /** {@inheritDoc} */
++ @Override protected void afterTest() throws Exception {
++ stopAllGrids();
++ }
++
++ /**
++ * @throws Exception If failed.
++ */
++ public void testServiceRedeploymentAfterCancel() throws Exception {
++ final Ignite ignite = startGrid(0);
++
++ final IgniteCache<Object, Object> managementCache = ignite.getOrCreateCache(CACHE_NAME);
++
++ final ContinuousQuery<Object, Object> qry = new ContinuousQuery<>();
++ final List<Object> evts = Collections.synchronizedList(new ArrayList<>());
++
++ qry.setLocalListener(new CacheEntryUpdatedListener<Object, Object>() {
++ @Override public void onUpdated(
++ Iterable<CacheEntryEvent<?, ?>> iterable) throws CacheEntryListenerException {
++ for (CacheEntryEvent<?, ?> event : iterable)
++ evts.add(event);
++ }
++ });
++
++ int iterations = 100;
++
++ while (iterations-- > 0) {
++ QueryCursor quorumCursor = managementCache.query(qry);
++
++ IgniteInternalFuture<?> fut1 = GridTestUtils.runAsync(new Callable<Object>() {
++ @Override public Object call() throws Exception {
++ System.out.println("Deploy " + SERVICE_NAME);
++ deployService(ignite);
++
++ return null;
++ }
++ });
++
++ IgniteInternalFuture<?> fut2 = GridTestUtils.runAsync(new Callable<Object>() {
++ @Override public Object call() throws Exception {
++ System.out.println("Undeploy " + SERVICE_NAME);
++ ignite.services().cancel(SERVICE_NAME);
++
++ return null;
++ }
++ });
++
++ fut1.get();
++ fut2.get();
++
++ U.sleep(100);
++
++ assert evts.size() <= 1 : evts.size();
++
++ ignite.services().cancel("service1");
++
++ evts.clear();
++
++ quorumCursor.close();
++ }
++
++ }
++
++ /**
++ * @param ignite Ignite.
++ */
++ private void deployService(final Ignite ignite) {
++ ServiceConfiguration svcCfg = new ServiceConfiguration();
++
++ svcCfg.setService(new ManagementService());
++ svcCfg.setName(SERVICE_NAME);
++ svcCfg.setTotalCount(1);
++ svcCfg.setMaxPerNodeCount(1);
++ svcCfg.setNodeFilter(new IgnitePredicate<ClusterNode>() {
++ @Override public boolean apply(ClusterNode node) {
++ return !node.isClient();
++ }
++ });
++
++ ignite.services().deploy(svcCfg);
++ }
++
++ /**
++ *
++ */
++ public static class ManagementService implements Service {
++ /** */
++ private final String name = UUID.randomUUID().toString();
++
++ /** */
++ @IgniteInstanceResource
++ private Ignite ignite;
++
++ /** {@inheritDoc} */
++ @Override public void cancel(ServiceContext ctx) {
++ System.out.println(name + " shutdown.");
++ }
++
++ /** {@inheritDoc} */
++ @Override public synchronized void init(ServiceContext ctx) throws Exception {
++ System.out.println(name + " initializing.");
++
++ ignite.cache(CACHE_NAME).put(TEST_KEY, name + " init");
++ }
++
++ /** {@inheritDoc} */
++ @Override public void execute(ServiceContext ctx) throws Exception {
++ // No-op
++ }
++ }
++}
http://git-wip-us.apache.org/repos/asf/ignite/blob/99bb87ae/modules/core/src/test/java/org/apache/ignite/testframework/GridSpiTestContext.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/99bb87ae/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
----------------------------------------------------------------------
diff --cc modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
index 41035ec,5977702..a0d37e9
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
@@@ -49,6 -50,7 +49,7 @@@ import org.apache.ignite.internal.proce
import org.apache.ignite.internal.processors.cluster.GridUpdateNotifierSelfTest;
import org.apache.ignite.internal.processors.port.GridPortProcessorSelfTest;
import org.apache.ignite.internal.processors.service.GridServiceClientNodeTest;
-import org.apache.ignite.internal.processors.service.GridServiceContinuousQueryRedeploy;
++import org.apache.ignite.internal.processors.service.GridServiceContinuousQueryRedeployTest;
import org.apache.ignite.internal.processors.service.GridServicePackagePrivateSelfTest;
import org.apache.ignite.internal.processors.service.GridServiceProcessorMultiNodeConfigSelfTest;
import org.apache.ignite.internal.processors.service.GridServiceProcessorMultiNodeSelfTest;
@@@ -141,7 -144,7 +142,8 @@@ public class IgniteKernalSelfTestSuite
suite.addTestSuite(GridServiceProxyClientReconnectSelfTest.class);
suite.addTestSuite(IgniteServiceReassignmentTest.class);
suite.addTestSuite(IgniteServiceProxyTimeoutInitializedTest.class);
- suite.addTestSuite(GridServiceContinuousQueryRedeploy.class);
+ suite.addTestSuite(IgniteServiceDynamicCachesSelfTest.class);
++ suite.addTestSuite(GridServiceContinuousQueryRedeployTest.class);
suite.addTestSuite(IgniteServiceDeploymentClassLoadingDefaultMarshallerTest.class);
suite.addTestSuite(IgniteServiceDeploymentClassLoadingOptimizedMarshallerTest.class);
http://git-wip-us.apache.org/repos/asf/ignite/blob/99bb87ae/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --cc modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index 6e75fd2,62b47b8..b0d3850
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@@ -84,9 -80,7 +84,10 @@@ import org.apache.ignite.internal.proce
import org.apache.ignite.internal.processors.cache.QueryCursorImpl;
import org.apache.ignite.internal.processors.cache.query.GridCacheQueryMarshallable;
import org.apache.ignite.internal.processors.cache.query.GridCacheTwoStepQuery;
+import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode;
+import org.apache.ignite.internal.processors.query.GridQueryCacheObjectsIterator;
+import org.apache.ignite.internal.processors.query.GridRunningQueryInfo;
+ import org.apache.ignite.internal.processors.query.GridRunningQueryInfo;
import org.apache.ignite.internal.processors.query.GridQueryCancel;
import org.apache.ignite.internal.processors.query.GridQueryFieldMetadata;
import org.apache.ignite.internal.processors.query.GridQueryFieldsResult;
http://git-wip-us.apache.org/repos/asf/ignite/blob/99bb87ae/parent/pom.xml
----------------------------------------------------------------------
[17/33] ignite git commit: Web Console: Cleanup
Posted by vo...@apache.org.
Web Console: Cleanup
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3da7794f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3da7794f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3da7794f
Branch: refs/heads/ignite-4565-ddl
Commit: 3da7794fb59ebb836523ba717722c6a6df845019
Parents: 0b996e6
Author: Andrey Novikov <an...@gridgain.com>
Authored: Tue Mar 14 15:54:14 2017 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Tue Mar 14 15:54:14 2017 +0700
----------------------------------------------------------------------
.../ui-grid-settings/ui-grid-settings.scss | 35 ++++++++++++++++++++
1 file changed, 35 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3da7794f/modules/web-console/frontend/app/components/ui-grid-settings/ui-grid-settings.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/ui-grid-settings/ui-grid-settings.scss b/modules/web-console/frontend/app/components/ui-grid-settings/ui-grid-settings.scss
index 4beb2a1..24f4d9b 100644
--- a/modules/web-console/frontend/app/components/ui-grid-settings/ui-grid-settings.scss
+++ b/modules/web-console/frontend/app/components/ui-grid-settings/ui-grid-settings.scss
@@ -70,6 +70,41 @@
}
}
+ &-number-filter {
+ float: right;
+
+ .ignite-form-field {
+ width: 180px;
+ margin-right: 0;
+
+ &__label {
+ }
+
+ &__control {
+ }
+
+ &:nth-child(1) {
+ float: left;
+
+ .ignite-form-field__label {
+ margin-right: 0;
+ width: 70%;
+ max-width: 100%;
+ }
+
+ .ignite-form-field__control {
+ width: 30%;
+ }
+ }
+ }
+
+ button {
+ width: auto;
+ display: inline-block;
+ margin-left: 5px;
+ }
+ }
+
&-dateperiod {
float: right;
[10/33] ignite git commit: IGNITE-4717 Fixed hangs in
VisorCacheClearTask. (cherry picked from commit 76f3060)
Posted by vo...@apache.org.
IGNITE-4717 Fixed hangs in VisorCacheClearTask.
(cherry picked from commit 76f3060)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a30183ac
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a30183ac
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a30183ac
Branch: refs/heads/ignite-4565-ddl
Commit: a30183ac821507fbdaa6f0cc2c6ef25ca2677867
Parents: 5736247
Author: Andrey Novikov <an...@gridgain.com>
Authored: Mon Feb 20 18:23:33 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Thu Mar 2 10:47:15 2017 +0700
----------------------------------------------------------------------
.../visor/cache/VisorCacheClearTask.java | 88 +++++---------------
.../visor/compute/VisorGatewayTask.java | 30 ++++++-
2 files changed, 49 insertions(+), 69 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a30183ac/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTask.java
index 1f1a6fb..0c8476f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTask.java
@@ -18,7 +18,6 @@
package org.apache.ignite.internal.visor.cache;
import org.apache.ignite.IgniteCache;
-import org.apache.ignite.IgniteCompute;
import org.apache.ignite.cache.CachePeekMode;
import org.apache.ignite.compute.ComputeJobContext;
import org.apache.ignite.internal.processors.task.GridInternal;
@@ -26,7 +25,6 @@ import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.visor.VisorJob;
import org.apache.ignite.internal.visor.VisorOneNodeTask;
import org.apache.ignite.lang.IgniteBiTuple;
-import org.apache.ignite.lang.IgniteCallable;
import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgniteInClosure;
import org.apache.ignite.resources.JobContextResource;
@@ -90,17 +88,11 @@ public class VisorCacheClearTask extends VisorOneNodeTask<String, IgniteBiTuple<
}
/**
- * @param subJob Sub job to execute asynchronously.
+ * @param fut Future for asynchronous cache operation.
* @param idx Index.
* @return {@code true} If subJob was not completed and this job should be suspended.
*/
- private boolean callAsync(IgniteCallable<Integer> subJob, int idx) {
- IgniteCompute compute = ignite.compute(ignite.cluster().forCacheNodes(cacheName)).withAsync();
-
- compute.call(subJob);
-
- IgniteFuture<Integer> fut = compute.future();
-
+ private boolean callAsync(IgniteFuture<Integer> fut, int idx) {
futs[idx] = fut;
if (fut.isDone())
@@ -119,16 +111,28 @@ public class VisorCacheClearTask extends VisorOneNodeTask<String, IgniteBiTuple<
futs = new IgniteFuture[3];
if (futs[0] == null || futs[1] == null || futs[2] == null) {
- IgniteCache cache = ignite.cache(cacheName);
+ IgniteCache cache = ignite.cache(cacheName).withAsync();
+
+ if (futs[0] == null) {
+ cache.size(CachePeekMode.PRIMARY);
+
+ if (callAsync(cache.<Integer>future(), 0))
+ return null;
+ }
- if (futs[0] == null && callAsync(new VisorCacheSizeCallable(cache), 0))
- return null;
+ if (futs[1] == null) {
+ cache.clear();
- if (futs[1] == null && callAsync(new VisorCacheClearCallable(cache), 1))
- return null;
+ if (callAsync(cache.<Integer>future(), 1))
+ return null;
+ }
+
+ if (futs[2] == null) {
+ cache.size(CachePeekMode.PRIMARY);
- if (futs[2] == null && callAsync(new VisorCacheSizeCallable(cache), 2))
- return null;
+ if (callAsync(cache.<Integer>future(), 2))
+ return null;
+ }
}
assert futs[0].isDone() && futs[1].isDone() && futs[2].isDone();
@@ -141,54 +145,4 @@ public class VisorCacheClearTask extends VisorOneNodeTask<String, IgniteBiTuple<
return S.toString(VisorCacheClearJob.class, this);
}
}
-
- /**
- * Callable to get cache size.
- */
- @GridInternal
- private static class VisorCacheSizeCallable implements IgniteCallable<Integer> {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** */
- private final IgniteCache cache;
-
- /**
- * @param cache Cache to take size from.
- */
- private VisorCacheSizeCallable(IgniteCache cache) {
- this.cache = cache;
- }
-
- /** {@inheritDoc} */
- @Override public Integer call() throws Exception {
- return cache.size(CachePeekMode.PRIMARY);
- }
- }
-
- /**
- * Callable to clear cache.
- */
- @GridInternal
- private static class VisorCacheClearCallable implements IgniteCallable<Integer> {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** */
- private final IgniteCache cache;
-
- /**
- * @param cache Cache to clear.
- */
- private VisorCacheClearCallable(IgniteCache cache) {
- this.cache = cache;
- }
-
- /** {@inheritDoc} */
- @Override public Integer call() throws Exception {
- cache.clear();
-
- return 0;
- }
- }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/a30183ac/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorGatewayTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorGatewayTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorGatewayTask.java
index 2539a26..a64ec6d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorGatewayTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/compute/VisorGatewayTask.java
@@ -29,21 +29,26 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
+import org.apache.ignite.IgniteCompute;
import org.apache.ignite.IgniteException;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.compute.ComputeJob;
import org.apache.ignite.compute.ComputeJobAdapter;
+import org.apache.ignite.compute.ComputeJobContext;
import org.apache.ignite.compute.ComputeJobResult;
import org.apache.ignite.compute.ComputeJobResultPolicy;
import org.apache.ignite.compute.ComputeTask;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.task.GridInternal;
import org.apache.ignite.internal.util.lang.GridTuple3;
+import org.apache.ignite.internal.util.typedef.CI1;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.visor.VisorTaskArgument;
import org.apache.ignite.lang.IgniteBiTuple;
+import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.resources.IgniteInstanceResource;
+import org.apache.ignite.resources.JobContextResource;
import org.jetbrains.annotations.Nullable;
/**
@@ -101,9 +106,16 @@ public class VisorGatewayTask implements ComputeTask<Object[], Object> {
@IgniteInstanceResource
protected transient IgniteEx ignite;
+ /** Auto-inject job context. */
+ @JobContextResource
+ protected transient ComputeJobContext jobCtx;
+
/** Arguments count. */
private final int argsCnt;
+ /** Future for spawned task. */
+ private transient IgniteFuture fut;
+
/**
* Create job with specified argument.
*
@@ -284,6 +296,9 @@ public class VisorGatewayTask implements ComputeTask<Object[], Object> {
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override public Object execute() throws IgniteException {
+ if (fut != null)
+ return fut.get();
+
String nidsArg = argument(0);
String taskName = argument(1);
@@ -355,8 +370,19 @@ public class VisorGatewayTask implements ComputeTask<Object[], Object> {
}
}
- return ignite.compute(ignite.cluster().forNodeIds(nids))
- .execute(taskName, new VisorTaskArgument<>(nids, jobArgs, false));
+ IgniteCompute comp = ignite.compute(ignite.cluster().forNodeIds(nids)).withAsync();
+
+ comp.execute(taskName, new VisorTaskArgument<>(nids, jobArgs, false));
+
+ fut = comp.future();
+
+ fut.listen(new CI1<IgniteFuture<Object>>() {
+ @Override public void apply(IgniteFuture<Object> f) {
+ jobCtx.callcc();
+ }
+ });
+
+ return jobCtx.holdcc();
}
}
}
[19/33] ignite git commit: IGNITE-4821 Implemented enforce join order
option on query tab.
Posted by vo...@apache.org.
IGNITE-4821 Implemented enforce join order option on query tab.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/94c1e7cb
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/94c1e7cb
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/94c1e7cb
Branch: refs/heads/ignite-4565-ddl
Commit: 94c1e7cb505e0a40e1d3c28de5a25b5aefbd55c0
Parents: f361da4
Author: Vasiliy Sisko <vs...@gridgain.com>
Authored: Wed Mar 15 11:43:23 2017 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Wed Mar 15 11:43:23 2017 +0700
----------------------------------------------------------------------
modules/web-console/backend/app/agent.js | 14 ++++++-
modules/web-console/backend/app/browser.js | 8 ++--
.../frontend/app/modules/agent/agent.module.js | 10 +++--
.../frontend/app/modules/sql/sql.controller.js | 25 ++++++++++---
.../frontend/public/stylesheets/style.scss | 8 +++-
.../web-console/frontend/views/sql/sql.tpl.pug | 39 +++++++++++++-------
6 files changed, 74 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/94c1e7cb/modules/web-console/backend/app/agent.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/app/agent.js b/modules/web-console/backend/app/agent.js
index b4394b7..f65eabb 100644
--- a/modules/web-console/backend/app/agent.js
+++ b/modules/web-console/backend/app/agent.js
@@ -227,17 +227,27 @@ module.exports.factory = function(_, fs, path, JSZip, socketio, settings, mongo,
* @param {String} cacheName Cache name.
* @param {String} query Query.
* @param {Boolean} nonCollocatedJoins Flag whether to execute non collocated joins.
+ * @param {Boolean} enforceJoinOrder Flag whether enforce join order is enabled.
* @param {Boolean} local Flag whether to execute query locally.
* @param {int} pageSize Page size.
* @returns {Promise}
*/
- fieldsQuery(demo, nid, cacheName, query, nonCollocatedJoins, local, pageSize) {
+ fieldsQuery(demo, nid, cacheName, query, nonCollocatedJoins, enforceJoinOrder, local, pageSize) {
const cmd = new Command(demo, 'exe')
.addParam('name', 'org.apache.ignite.internal.visor.compute.VisorGatewayTask')
.addParam('p1', nid)
.addParam('p2', 'org.apache.ignite.internal.visor.query.VisorQueryTask');
- if (nonCollocatedJoins) {
+ if (enforceJoinOrder) {
+ cmd.addParam('p3', 'org.apache.ignite.internal.visor.query.VisorQueryArgV3')
+ .addParam('p4', cacheName)
+ .addParam('p5', query)
+ .addParam('p6', nonCollocatedJoins)
+ .addParam('p7', enforceJoinOrder)
+ .addParam('p8', local)
+ .addParam('p9', pageSize);
+ }
+ else if (nonCollocatedJoins) {
cmd.addParam('p3', 'org.apache.ignite.internal.visor.query.VisorQueryArgV2')
.addParam('p4', cacheName)
.addParam('p5', query)
http://git-wip-us.apache.org/repos/asf/ignite/blob/94c1e7cb/modules/web-console/backend/app/browser.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/app/browser.js b/modules/web-console/backend/app/browser.js
index 56f2acc..00ae751 100644
--- a/modules/web-console/backend/app/browser.js
+++ b/modules/web-console/backend/app/browser.js
@@ -98,9 +98,9 @@ module.exports.factory = (_, socketio, agentMgr, configure) => {
});
// Execute query on node and return first page to browser.
- socket.on('node:query', (nid, cacheName, query, distributedJoins, local, pageSize, cb) => {
+ socket.on('node:query', (nid, cacheName, query, distributedJoins, enforceJoinOrder, local, pageSize, cb) => {
agentMgr.findAgent(accountId())
- .then((agent) => agent.fieldsQuery(demo, nid, cacheName, query, distributedJoins, local, pageSize))
+ .then((agent) => agent.fieldsQuery(demo, nid, cacheName, query, distributedJoins, enforceJoinOrder, local, pageSize))
.then((res) => cb(null, res))
.catch((err) => cb(_errorToJson(err)));
});
@@ -114,13 +114,13 @@ module.exports.factory = (_, socketio, agentMgr, configure) => {
});
// Execute query on node and return full result to browser.
- socket.on('node:query:getAll', (nid, cacheName, query, distributedJoins, local, cb) => {
+ socket.on('node:query:getAll', (nid, cacheName, query, distributedJoins, enforceJoinOrder, local, cb) => {
// Set page size for query.
const pageSize = 1024;
agentMgr.findAgent(accountId())
.then((agent) => {
- const firstPage = agent.fieldsQuery(demo, nid, cacheName, query, distributedJoins, local, pageSize)
+ const firstPage = agent.fieldsQuery(demo, nid, cacheName, query, distributedJoins, enforceJoinOrder, local, pageSize)
.then(({result}) => {
if (result.key)
return Promise.reject(result.key);
http://git-wip-us.apache.org/repos/asf/ignite/blob/94c1e7cb/modules/web-console/frontend/app/modules/agent/agent.module.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/agent/agent.module.js b/modules/web-console/frontend/app/modules/agent/agent.module.js
index c0e92d5..724fc6c 100644
--- a/modules/web-console/frontend/app/modules/agent/agent.module.js
+++ b/modules/web-console/frontend/app/modules/agent/agent.module.js
@@ -265,12 +265,13 @@ class IgniteAgentMonitor {
* @param {String} cacheName Cache name.
* @param {String} [query] Query if null then scan query.
* @param {Boolean} nonCollocatedJoins Flag whether to execute non collocated joins.
+ * @param {Boolean} enforceJoinOrder Flag whether enforce join order is enabled.
* @param {Boolean} local Flag whether to execute query locally.
* @param {int} pageSize
* @returns {Promise}
*/
- query(nid, cacheName, query, nonCollocatedJoins, local, pageSize) {
- return this._rest('node:query', nid, maskNull(cacheName), maskNull(query), nonCollocatedJoins, local, pageSize)
+ query(nid, cacheName, query, nonCollocatedJoins, enforceJoinOrder, local, pageSize) {
+ return this._rest('node:query', nid, maskNull(cacheName), maskNull(query), nonCollocatedJoins, enforceJoinOrder, local, pageSize)
.then(({result}) => {
if (_.isEmpty(result.key))
return result.value;
@@ -284,11 +285,12 @@ class IgniteAgentMonitor {
* @param {String} cacheName Cache name.
* @param {String} [query] Query if null then scan query.
* @param {Boolean} nonCollocatedJoins Flag whether to execute non collocated joins.
+ * @param {Boolean} enforceJoinOrder Flag whether enforce join order is enabled.
* @param {Boolean} local Flag whether to execute query locally.
* @returns {Promise}
*/
- queryGetAll(nid, cacheName, query, nonCollocatedJoins, local) {
- return this._rest('node:query:getAll', nid, maskNull(cacheName), maskNull(query), nonCollocatedJoins, local);
+ queryGetAll(nid, cacheName, query, nonCollocatedJoins, enforceJoinOrder, local) {
+ return this._rest('node:query:getAll', nid, maskNull(cacheName), maskNull(query), nonCollocatedJoins, enforceJoinOrder, local);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/94c1e7cb/modules/web-console/frontend/app/modules/sql/sql.controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/sql/sql.controller.js b/modules/web-console/frontend/app/modules/sql/sql.controller.js
index c082d4e..7ded2d5 100644
--- a/modules/web-console/frontend/app/modules/sql/sql.controller.js
+++ b/modules/web-console/frontend/app/modules/sql/sql.controller.js
@@ -34,6 +34,8 @@ const SCAN_CACHE_WITH_FILTER_CASE_SENSITIVE = 'VISOR_SCAN_CACHE_WITH_FILTER_CASE
const NON_COLLOCATED_JOINS_SINCE = '1.7.0';
+const ENFORCE_JOIN_VERS = [['1.7.9', '1.8.0'], ['1.8.4', '1.9.0'], ['1.9.1']];
+
const _fullColName = (col) => {
const res = [];
@@ -1336,7 +1338,8 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
agentMonitor.awaitAgent()
.then(() => _closeOldQuery(paragraph))
.then(() => args.localNid || _chooseNode(args.cacheName, false))
- .then((nid) => agentMonitor.query(nid, args.cacheName, args.query, args.nonCollocatedJoins, !!args.localNid, args.pageSize))
+ .then((nid) => agentMonitor.query(nid, args.cacheName, args.query, args.nonCollocatedJoins,
+ args.enforceJoinOrder, !!args.localNid, args.pageSize))
.then(_processQueryResult.bind(this, paragraph, false))
.catch((err) => paragraph.errMsg = err.message);
};
@@ -1369,8 +1372,18 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
return false;
};
+ $scope.enforceJoinOrderAvailable = (paragraph) => {
+ const cache = _.find($scope.caches, {name: paragraph.cacheName});
+
+ if (cache)
+ return !!_.find(cache.nodes, (node) => Version.includes(node.version, ...ENFORCE_JOIN_VERS));
+
+ return false;
+ };
+
$scope.execute = (paragraph, local = false) => {
const nonCollocatedJoins = !!paragraph.nonCollocatedJoins;
+ const enforceJoinOrder = !!paragraph.enforceJoinOrder;
$scope.actionAvailable(paragraph, true) && _chooseNode(paragraph.cacheName, local)
.then((nid) => {
@@ -1390,6 +1403,7 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
pageSize: paragraph.pageSize,
maxPages: paragraph.maxPages,
nonCollocatedJoins,
+ enforceJoinOrder,
localNid: local ? nid : null
};
@@ -1397,7 +1411,7 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
ActivitiesData.post({ action: '/queries/execute' });
- return agentMonitor.query(nid, args.cacheName, qry, nonCollocatedJoins, local, args.pageSize);
+ return agentMonitor.query(nid, args.cacheName, qry, nonCollocatedJoins, enforceJoinOrder, local, args.pageSize);
})
.then((res) => {
_processQueryResult(paragraph, true, res);
@@ -1450,7 +1464,7 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
ActivitiesData.post({ action: '/queries/explain' });
- return agentMonitor.query(nid, args.cacheName, args.query, false, false, args.pageSize);
+ return agentMonitor.query(nid, args.cacheName, args.query, false, !!paragraph.enforceJoinOrder, false, args.pageSize);
})
.then(_processQueryResult.bind(this, paragraph, true))
.catch((err) => {
@@ -1488,7 +1502,7 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
ActivitiesData.post({ action: '/queries/scan' });
- return agentMonitor.query(nid, args.cacheName, query, false, local, args.pageSize);
+ return agentMonitor.query(nid, args.cacheName, query, false, false, local, args.pageSize);
})
.then((res) => _processQueryResult(paragraph, true, res))
.catch((err) => {
@@ -1609,7 +1623,8 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
const args = paragraph.queryArgs;
return Promise.resolve(args.localNid || _chooseNode(args.cacheName, false))
- .then((nid) => agentMonitor.queryGetAll(nid, args.cacheName, args.query, !!args.nonCollocatedJoins, !!args.localNid))
+ .then((nid) => agentMonitor.queryGetAll(nid, args.cacheName, args.query, !!args.nonCollocatedJoins,
+ !!args.enforceJoinOrder, !!args.localNid))
.then((res) => _export(paragraph.name + '-all.csv', paragraph.gridOptions.columnDefs, res.columns, res.rows))
.catch(Messages.showError)
.then(() => paragraph.ace && paragraph.ace.focus());
http://git-wip-us.apache.org/repos/asf/ignite/blob/94c1e7cb/modules/web-console/frontend/public/stylesheets/style.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/public/stylesheets/style.scss b/modules/web-console/frontend/public/stylesheets/style.scss
index ab7e3dd..a07472e 100644
--- a/modules/web-console/frontend/public/stylesheets/style.scss
+++ b/modules/web-console/frontend/public/stylesheets/style.scss
@@ -809,7 +809,7 @@ button.form-control {
}
.btn-group {
- vertical-align:top;
+ vertical-align: top;
margin-left: 10px;
i { line-height: 18px; }
@@ -1854,6 +1854,12 @@ th[st-sort] {
display: inline-block;
}
+.panel-top-align {
+ label {
+ vertical-align: top !important;
+ }
+}
+
button.dropdown-toggle {
margin-right: 5px;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/94c1e7cb/modules/web-console/frontend/views/sql/sql.tpl.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/sql/sql.tpl.pug b/modules/web-console/frontend/views/sql/sql.tpl.pug
index 931d632..bc134a6 100644
--- a/modules/web-console/frontend/views/sql/sql.tpl.pug
+++ b/modules/web-console/frontend/views/sql/sql.tpl.pug
@@ -91,20 +91,31 @@ mixin paragraph-rename
input.form-control(id='paragraph-name-{{paragraph.id}}' ng-model='paragraph.editName' required ng-click='$event.stopPropagation();' ignite-on-enter='renameParagraph(paragraph, paragraph.editName)' ignite-on-escape='paragraph.edit = false')
mixin query-settings
- label.tipLabel(bs-tooltip data-placement='bottom' data-title='Configure periodical execution of last successfully executed query') Refresh rate:
- button.btn.btn-default.fa.fa-clock-o.tipLabel(ng-class='{"btn-info": paragraph.rate && paragraph.rate.installed}' bs-popover data-template-url='{{ $ctrl.paragraphRateTemplateUrl }}' data-placement='left' data-auto-close='1' data-trigger='click') {{rateAsString(paragraph)}}
-
- label.tipLabel(bs-tooltip data-placement='bottom' data-title='Max number of rows to show in query result as one page') Page size:
- button.btn.btn-default.select-toggle.tipLabel(ng-model='paragraph.pageSize' bs-select bs-options='item for item in pageSizes')
-
- label.tipLabel(bs-tooltip data-placement='bottom' data-title='Limit query max results to specified number of pages') Max pages:
- button.btn.btn-default.select-toggle.tipLabel(ng-model='paragraph.maxPages' bs-select bs-options='item.value as item.label for item in maxPages')
-
- label.tipLabel(ng-if='nonCollocatedJoinsAvailable(paragraph)' bs-tooltip data-placement='bottom' data-title='Non-collocated joins is a special mode that allow to join data across cluster without collocation.<br/>\
- Nested joins are not supported for now.<br/>\
- <b>NOTE</b>: In some cases it may consume more heap memory or may take a long time than collocated joins.' data-trigger='hover')
- input(type='checkbox' ng-model='paragraph.nonCollocatedJoins')
- span Allow non-collocated joins
+ .panel-top-align
+ label.tipLabel(bs-tooltip data-placement='bottom' data-title='Configure periodical execution of last successfully executed query') Refresh rate:
+ button.btn.btn-default.fa.fa-clock-o.tipLabel(ng-class='{"btn-info": paragraph.rate && paragraph.rate.installed}' bs-popover data-template-url='{{ $ctrl.paragraphRateTemplateUrl }}' data-placement='left' data-auto-close='1' data-trigger='click') {{rateAsString(paragraph)}}
+
+ label.tipLabel(bs-tooltip data-placement='bottom' data-title='Max number of rows to show in query result as one page') Page size:
+ button.btn.btn-default.select-toggle.tipLabel(ng-model='paragraph.pageSize' bs-select bs-options='item for item in pageSizes')
+
+ label.tipLabel(bs-tooltip data-placement='bottom' data-title='Limit query max results to specified number of pages') Max pages:
+ button.btn.btn-default.select-toggle.tipLabel(ng-model='paragraph.maxPages' bs-select bs-options='item.value as item.label for item in maxPages')
+
+ .panel-tip-container
+ .row(ng-if='nonCollocatedJoinsAvailable(paragraph)')
+ label.tipLabel(bs-tooltip data-placement='bottom' data-title='Non-collocated joins is a special mode that allow to join data across cluster without collocation.<br/>\
+ Nested joins are not supported for now.<br/>\
+ <b>NOTE</b>: In some cases it may consume more heap memory or may take a long time than collocated joins.' data-trigger='hover')
+ input(type='checkbox' ng-model='paragraph.nonCollocatedJoins')
+ span Allow non-collocated joins
+ .row(ng-if='enforceJoinOrderAvailable(paragraph)')
+ label.tipLabel(bs-tooltip data-placement='bottom' data-title='Enforce join order of tables in the query.<br/>\
+ If <b>set</b> then query optimizer will not reorder tables in join.<br/>\
+ <b>NOTE:</b> It is not recommended to enable this property until you are sure that\
+ your indexes and the query itself are correct and tuned as much as possible but\
+ query optimizer still produces wrong join order.' data-trigger='hover')
+ input(type='checkbox' ng-model='paragraph.enforceJoinOrder')
+ span Enforce join order
mixin query-actions
button.btn.btn-primary(ng-disabled='!actionAvailable(paragraph, true)' ng-click='execute(paragraph)') Execute
[06/33] ignite git commit: IGNITE-4624: Scan query optimization. This
closes #1509.
Posted by vo...@apache.org.
IGNITE-4624: Scan query optimization. This closes #1509.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2f57760d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2f57760d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2f57760d
Branch: refs/heads/ignite-4565-ddl
Commit: 2f57760dbb4fba948cd035498d2c7f71869c0665
Parents: 11bbec4
Author: Andrey V. Mashenkov <an...@gmail.com>
Authored: Fri Feb 17 16:15:31 2017 +0300
Committer: Andrey V. Mashenkov <an...@gmail.com>
Committed: Fri Feb 17 18:47:21 2017 +0300
----------------------------------------------------------------------
.../distributed/dht/GridDhtCacheAdapter.java | 19 +++-
.../cache/query/GridCacheQueryManager.java | 97 ++++++++++----------
2 files changed, 64 insertions(+), 52 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2f57760d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
index dcd379a..be7fa55 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
@@ -1247,14 +1247,27 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
final boolean backup,
final boolean keepBinary,
final AffinityTopologyVersion topVer) {
+
+ return iterator(localEntriesIteratorEx(primary, backup, topVer), !keepBinary);
+ }
+
+ /**
+ * @param primary If {@code true} includes primary entries.
+ * @param backup If {@code true} includes backup entries.
+ * @param topVer Specified affinity topology version.
+ * @return Local entries iterator.
+ */
+ public Iterator<? extends GridCacheEntryEx> localEntriesIteratorEx(final boolean primary,
+ final boolean backup,
+ final AffinityTopologyVersion topVer) {
assert primary || backup;
if (primary && backup)
- return iterator(entries().iterator(), !keepBinary);
+ return entries().iterator();
else {
final Iterator<GridDhtLocalPartition> partIt = topology().currentLocalPartitions().iterator();
- Iterator<GridCacheMapEntry> it = new Iterator<GridCacheMapEntry>() {
+ return new Iterator<GridCacheMapEntry>() {
private GridCacheMapEntry next;
private Iterator<GridCacheMapEntry> curIt;
@@ -1311,8 +1324,6 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
while (partIt.hasNext());
}
};
-
- return iterator(it, !keepBinary);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2f57760d/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 d64dff4..14b1106 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
@@ -1033,23 +1033,25 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
* @throws GridDhtUnreservedPartitionException If failed to reserve partition.
*/
private GridIterator<IgniteBiTuple<K, V>> onheapIterator(
- GridCacheQueryAdapter<?> qry,
+ final GridCacheQueryAdapter<?> qry,
AffinityTopologyVersion topVer,
final IgniteBiPredicate<K, V> keyValFilter,
- boolean backups,
+ final boolean backups,
final ExpiryPolicy plc,
final boolean locNode) throws GridDhtUnreservedPartitionException {
- Iterator<K> keyIter;
+ Iterator<? extends GridCacheEntryEx> entryIter;
GridDhtLocalPartition locPart = null;
Integer part = qry.partition();
- if (part == null || cctx.isLocal()) {
- // Performance optimization.
- if (locNode && plc == null && !cctx.isLocal()) {
- GridDhtCacheAdapter<K, V> cache = cctx.isNear() ? cctx.near().dht() : cctx.dht();
+ if (cctx.isLocal())
+ entryIter = cctx.local().allEntries().iterator();
+ else if (part == null) {
+ GridDhtCacheAdapter<K, V> cache = cctx.isNear() ? cctx.near().dht() : cctx.dht();
+ // Performance optimization.
+ if (locNode && plc == null) {
final Iterator<Cache.Entry<K, V>> iter = cache.localEntriesIterator(true,
backups, cache.context().keepBinary(), topVer);
@@ -1099,12 +1101,10 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
};
}
- IgniteInternalCache<K, V> keepBinaryCache = cctx.cache().keepBinary();
-
- keyIter = backups ? keepBinaryCache.keySetx().iterator() : keepBinaryCache.primaryKeySet().iterator();
+ entryIter = cache.localEntriesIteratorEx(true, backups, topVer);
}
else if (part < 0 || part >= cctx.affinity().partitions())
- keyIter = new GridEmptyIterator<>();
+ return new GridEmptyIterator<>();
else {
final GridDhtCacheAdapter dht = cctx.isNear() ? cctx.near().dht() : cctx.dht();
@@ -1115,28 +1115,12 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
throw new GridDhtUnreservedPartitionException(part, cctx.affinity().affinityTopologyVersion(),
"Partition can not be reserved.");
- final GridDhtLocalPartition locPart0 = locPart;
-
- keyIter = new Iterator<K>() {
- private Iterator<KeyCacheObject> iter0 = locPart0.keySet().iterator();
-
- @Override public boolean hasNext() {
- return iter0.hasNext();
- }
-
- @Override public K next() {
- return (K)iter0.next();
- }
-
- @Override public void remove() {
- iter0.remove();
- }
- };
+ entryIter = locPart.allEntries().iterator();
}
final GridDhtLocalPartition locPart0 = locPart;
- return new PeekValueExpiryAwareIterator(keyIter, plc, topVer, keyValFilter, qry.keepBinary(), locNode, true) {
+ return new PeekValueExpiryAwareIterator(entryIter, plc, topVer, keyValFilter, qry.keepBinary(), locNode, true) {
@Override protected void onClose() {
super.onClose();
@@ -1263,18 +1247,20 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
ExpiryPolicy expPlc,
final boolean keepBinary,
boolean locNode) {
- Iterator<K> keyIter = new Iterator<K>() {
+ Iterator<? extends GridCacheEntryEx> keyIter = new Iterator<GridCacheEntryEx>() {
/** {@inheritDoc} */
@Override public boolean hasNext() {
return it.hasNext();
}
/** {@inheritDoc} */
- @Override public K next() {
+ @Override public GridCacheEntryEx next() {
try {
KeyCacheObject key = cctx.toCacheKeyObject(it.next().getKey());
- return (K)cctx.unwrapBinaryIfNeeded(key, keepBinary);
+ final GridCacheEntryEx entryEx = cctx.cache().entryEx(key);
+
+ return entryEx;
}
catch (IgniteCheckedException e) {
throw new IgniteException(e);
@@ -2189,8 +2175,8 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
}
/**
- * Gets cache queries detailed metrics.
- * Detail metrics could be enabled by setting non-zero value via {@link CacheConfiguration#setQueryDetailMetricsSize(int)}
+ * Gets cache queries detailed metrics. Detail metrics could be enabled by setting non-zero value via {@link
+ * CacheConfiguration#setQueryDetailMetricsSize(int)}
*
* @return Cache queries metrics aggregated by query type and query text.
*/
@@ -3091,8 +3077,10 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
private abstract static class CachedResult<R> extends GridFutureAdapter<IgniteSpiCloseableIterator<R>> {
/** Absolute position of each recipient. */
private final Map<Object, QueueIterator> recipients = new GridLeanMap<>(1);
+
/** */
private CircularQueue<R> queue;
+
/** */
private int pruned;
@@ -3529,10 +3517,10 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
private IgniteCacheExpiryPolicy expiryPlc;
/** */
- private Iterator<K> keyIt;
+ private Iterator<? extends GridCacheEntryEx> entryIt;
/**
- * @param keyIt Key iterator.
+ * @param entryIter Key iterator.
* @param plc Expiry policy.
* @param topVer Topology version.
* @param keyValFilter Key-value filter.
@@ -3540,8 +3528,8 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
* @param locNode Local node.
* @param heapOnly Heap only.
*/
- private PeekValueExpiryAwareIterator(
- Iterator<K> keyIt,
+ PeekValueExpiryAwareIterator(
+ Iterator<? extends GridCacheEntryEx> entryIter,
ExpiryPolicy plc,
AffinityTopologyVersion topVer,
IgniteBiPredicate<K, V> keyValFilter,
@@ -3549,7 +3537,7 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
boolean locNode,
boolean heapOnly
) {
- this.keyIt = keyIt;
+ this.entryIt = entryIter;
this.plc = plc;
this.topVer = topVer;
this.keyValFilter = keyValFilter;
@@ -3593,15 +3581,27 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
private void advance() {
IgniteBiTuple<K, V> next0 = null;
- while (keyIt.hasNext()) {
+ while (entryIt.hasNext()) {
next0 = null;
- K key = keyIt.next();
+ GridCacheEntryEx entry = entryIt.next();
+
+ if (entry.deleted())
+ continue;
+ KeyCacheObject key = entry.key();
CacheObject val;
try {
- val = value(key);
+ if (heapOnly)
+ val = entry.peek(true, false, false, expiryPlc);
+ else
+ val = value(entry, entry.key());
+ }
+ catch (GridCacheEntryRemovedException ignore) {
+ assert heapOnly;
+
+ continue;
}
catch (IgniteCheckedException e) {
if (log.isDebugEnabled())
@@ -3664,23 +3664,24 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
}
/**
+ * @param entry Entry.
* @param key Key.
* @return Value.
* @throws IgniteCheckedException If failed to peek value.
*/
- private CacheObject value(K key) throws IgniteCheckedException {
+ private CacheObject value(GridCacheEntryEx entry, KeyCacheObject key) throws IgniteCheckedException {
while (true) {
try {
- GridCacheEntryEx entry = heapOnly ? cache.peekEx(key) : cache.entryEx(key);
+ if (entry == null)
+ entry = cache.entryEx(key);
- if (expiryPlc != null && !heapOnly)
+ if (expiryPlc != null)
entry.unswap();
- return entry != null ? entry.peek(true, !heapOnly, !heapOnly, topVer, expiryPlc) : null;
+ return entry.peek(true, true, true, topVer, expiryPlc);
}
catch (GridCacheEntryRemovedException ignore) {
- if (heapOnly)
- return null;
+ entry = null;
}
}
}
[11/33] ignite git commit: ignite-4577 Add non-reachable addresses at
the end of addresses list
Posted by vo...@apache.org.
ignite-4577 Add non-reachable addresses at the end of addresses list
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7ad8e79f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7ad8e79f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7ad8e79f
Branch: refs/heads/ignite-4565-ddl
Commit: 7ad8e79fa1077291c50f2f535ecccde6baee0321
Parents: a30183a
Author: Evgenii Zhuravlev <ez...@gridgain.com>
Authored: Tue Mar 7 14:32:28 2017 +0300
Committer: Evgenii Zhuravlev <ez...@gridgain.com>
Committed: Tue Mar 7 14:41:38 2017 +0300
----------------------------------------------------------------------
.../ignite/internal/util/IgniteUtils.java | 14 ++++++-----
.../communication/tcp/TcpCommunicationSpi.java | 25 ++++++++++++++++++++
2 files changed, 33 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ad8e79f/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
index 3fa3f7b..ba118cb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
@@ -1810,15 +1810,16 @@ public abstract class IgniteUtils {
/**
* @param addrs Addresses.
+ * @return List of reachable addresses.
*/
- public static List<InetAddress> filterReachable(List<InetAddress> addrs) {
+ public static List<InetAddress> filterReachable(Collection<InetAddress> addrs) {
final int reachTimeout = 2000;
if (addrs.isEmpty())
return Collections.emptyList();
if (addrs.size() == 1) {
- InetAddress addr = addrs.get(0);
+ InetAddress addr = F.first(addrs);
if (reachable(addr, reachTimeout))
return Collections.singletonList(addr);
@@ -1834,8 +1835,7 @@ public abstract class IgniteUtils {
for (final InetAddress addr : addrs) {
futs.add(executor.submit(new Runnable() {
- @Override
- public void run() {
+ @Override public void run() {
if (reachable(addr, reachTimeout)) {
synchronized (res) {
res.add(addr);
@@ -1848,11 +1848,13 @@ public abstract class IgniteUtils {
for (Future<?> fut : futs) {
try {
fut.get();
- } catch (InterruptedException e) {
+ }
+ catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new IgniteException("Thread has been interrupted.", e);
- } catch (ExecutionException e) {
+ }
+ catch (ExecutionException e) {
throw new IgniteException(e);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ad8e79f/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 94b7efe..81454f8 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
@@ -2334,6 +2334,31 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
if (isExtAddrsExist)
addrs.addAll(extAddrs);
+ Set<InetAddress> allInetAddrs = U.newHashSet(addrs.size());
+
+ for (InetSocketAddress addr : addrs)
+ allInetAddrs.add(addr.getAddress());
+
+ List<InetAddress> reachableInetAddrs = U.filterReachable(allInetAddrs);
+
+ if (reachableInetAddrs.size() < allInetAddrs.size()) {
+ LinkedHashSet<InetSocketAddress> addrs0 = U.newLinkedHashSet(addrs.size());
+
+ for (InetSocketAddress addr : addrs) {
+ if (reachableInetAddrs.contains(addr.getAddress()))
+ addrs0.add(addr);
+ }
+ for (InetSocketAddress addr : addrs) {
+ if (!reachableInetAddrs.contains(addr.getAddress()))
+ addrs0.add(addr);
+ }
+
+ addrs = addrs0;
+ }
+
+ if (log.isDebugEnabled())
+ log.debug("Addresses to connect for node [rmtNode=" + node.id() + ", addrs=" + addrs.toString() + ']');
+
boolean conn = false;
GridCommunicationClient client = null;
IgniteCheckedException errs = null;
[13/33] ignite git commit: IGNITE-2552 EvictionPolicies refactored,
logic changed
Posted by vo...@apache.org.
IGNITE-2552 EvictionPolicies refactored, logic changed
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/19566fbc
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/19566fbc
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/19566fbc
Branch: refs/heads/ignite-4565-ddl
Commit: 19566fbc0a683e5a72cf91ee0f8de987c524c01d
Parents: d4b87f4
Author: voipp <al...@gmail.com>
Authored: Wed Feb 15 11:54:48 2017 +0300
Committer: agura <ag...@apache.org>
Committed: Fri Mar 10 14:50:25 2017 +0300
----------------------------------------------------------------------
.../cache/eviction/AbstractEvictionPolicy.java | 210 +++++++++++++++++++
.../ignite/cache/eviction/EvictionPolicy.java | 2 -
.../cache/eviction/fifo/FifoEvictionPolicy.java | 158 +-------------
.../cache/eviction/lru/LruEvictionPolicy.java | 159 ++------------
.../eviction/random/RandomEvictionPolicy.java | 124 -----------
.../random/RandomEvictionPolicyMBean.java | 42 ----
.../eviction/sorted/SortedEvictionPolicy.java | 160 ++------------
.../internal/visor/util/VisorTaskUtils.java | 8 +-
.../resources/META-INF/classnames.properties | 1 -
...idCacheConfigurationConsistencySelfTest.java | 6 +-
.../cache/eviction/EvictionAbstractTest.java | 4 +-
11 files changed, 264 insertions(+), 610 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/19566fbc/modules/core/src/main/java/org/apache/ignite/cache/eviction/AbstractEvictionPolicy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/AbstractEvictionPolicy.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/AbstractEvictionPolicy.java
new file mode 100644
index 0000000..eca58e6
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/cache/eviction/AbstractEvictionPolicy.java
@@ -0,0 +1,210 @@
+/*
+ * 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.cache.eviction;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.util.typedef.internal.A;
+import org.jsr166.LongAdder8;
+
+/**
+ * Common functionality implementation for eviction policies
+ */
+public abstract class AbstractEvictionPolicy<K, V> implements EvictionPolicy<K, V> {
+ /** Memory size occupied by elements in container. */
+ private final LongAdder8 memSize = new LongAdder8();
+
+ /** Max memory size occupied by elements in container. */
+ private volatile long maxMemSize;
+
+ /** Maximum elements in container. */
+ private volatile int max;
+
+ /** Batch size. */
+ private volatile int batchSize = 1;
+
+ /**
+ * Shrinks backed container to maximum allowed size.
+ */
+ protected void shrink() {
+ long maxMem = this.maxMemSize;
+
+ if (maxMem > 0) {
+ long startMemSize = memSize.longValue();
+
+ if (startMemSize >= maxMem)
+ for (long i = maxMem; i < startMemSize && memSize.longValue() > maxMem; ) {
+ int size = shrink0();
+
+ if (size == -1)
+ break;
+
+ i += size;
+ }
+ }
+
+ int max = this.max;
+
+ if (max > 0) {
+ int startSize = getCurrentSize();
+
+ if (startSize >= max + (maxMem > 0 ? 1 : this.batchSize))
+ for (int i = max; i < startSize && getCurrentSize() > max; i++)
+ if (shrink0() == -1)
+ break;
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onEntryAccessed(boolean rmv, EvictableEntry<K, V> entry) {
+ if (!rmv) {
+ if (!entry.isCached())
+ return;
+
+ if (touch(entry))
+ shrink();
+ }
+ else {
+ Object node = entry.removeMeta();
+
+ if (node != null) {
+ removeMeta(node);
+
+ addToMemorySize(-entry.size());
+ }
+
+ }
+ }
+
+ /**
+ * @param x Changing memory size by adding the value.
+ */
+ protected void addToMemorySize(int x) {
+ memSize.add(x);
+ }
+
+ /**
+ *
+ * @return Size of the container.
+ */
+ protected abstract int getCurrentSize();
+
+ /**
+ *
+ * @return Size of the memory which was shrinked0.
+ */
+ protected abstract int shrink0();
+
+ /**
+ *
+ * @param meta Meta-information shipped to an entry.
+ * @return {@code True} if meta was successfully removed from the container.
+ */
+ protected abstract boolean removeMeta(Object meta);
+
+ /**
+ * @param entry Entry to touch.
+ * @return {@code True} if container has been changed by this call.
+ */
+ protected abstract boolean touch(EvictableEntry<K, V> entry);
+
+ /**
+ * Sets maximum allowed cache size in bytes.
+ */
+ public void setMaxMemorySize(long maxMemSize) {
+ A.ensure(maxMemSize >= 0, "maxMemSize >= 0");
+
+ this.maxMemSize = maxMemSize;
+ }
+
+ /**
+ * Gets maximum allowed cache size in bytes.
+ *
+ * @return maximum allowed cache size in bytes.
+ */
+ public long getMaxMemorySize() {
+ return maxMemSize;
+ }
+
+ /**
+ * Gets current queue size in bytes.
+ *
+ * @return current queue size in bytes.
+ */
+ public long getCurrentMemorySize() {
+ return memSize.longValue();
+ }
+
+ /**
+ * Sets maximum allowed size of cache before entry will start getting evicted.
+ *
+ * @param max Maximum allowed size of cache before entry will start getting evicted.
+ */
+ public void setMaxSize(int max) {
+ A.ensure(max >= 0, "max >= 0");
+
+ this.max = max;
+ }
+
+ /**
+ * Gets maximum allowed size of cache before entry will start getting evicted.
+ *
+ * @return Maximum allowed size of cache before entry will start getting evicted.
+ */
+ public int getMaxSize() {
+ return max;
+ }
+
+ /**
+ * Sets batch size.
+ *
+ * @param batchSize Batch size.
+ */
+ public void setBatchSize(int batchSize) {
+ A.ensure(batchSize > 0, "batchSize > 0");
+
+ this.batchSize = batchSize;
+ }
+
+ /**
+ * Gets batch size.
+ *
+ * @return batch size.
+ */
+ public int getBatchSize() {
+ return batchSize;
+ }
+
+ public LongAdder8 getMemSize() {
+ return memSize;
+ }
+
+ /** {@inheritDoc} */
+ public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeInt(max);
+ out.writeInt(batchSize);
+ out.writeLong(maxMemSize);
+ }
+ /** {@inheritDoc} */
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ max = in.readInt();
+ batchSize = in.readInt();
+ maxMemSize = in.readLong();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/19566fbc/modules/core/src/main/java/org/apache/ignite/cache/eviction/EvictionPolicy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/EvictionPolicy.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/EvictionPolicy.java
index a77514a..6125b50 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/eviction/EvictionPolicy.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/eviction/EvictionPolicy.java
@@ -19,7 +19,6 @@ package org.apache.ignite.cache.eviction;
import org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy;
import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy;
-import org.apache.ignite.cache.eviction.random.RandomEvictionPolicy;
import org.apache.ignite.cache.eviction.sorted.SortedEvictionPolicy;
/**
@@ -31,7 +30,6 @@ import org.apache.ignite.cache.eviction.sorted.SortedEvictionPolicy;
* Ignite comes with following eviction policies out-of-the-box:
* <ul>
* <li>{@link LruEvictionPolicy}</li>
- * <li>{@link RandomEvictionPolicy}</li>
* <li>{@link FifoEvictionPolicy}</li>
* <li>{@link SortedEvictionPolicy}</li>
* </ul>
http://git-wip-us.apache.org/repos/asf/ignite/blob/19566fbc/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/FifoEvictionPolicy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/FifoEvictionPolicy.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/FifoEvictionPolicy.java
index 4d1c3f1..dd7ba0f 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/FifoEvictionPolicy.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/eviction/fifo/FifoEvictionPolicy.java
@@ -18,20 +18,13 @@
package org.apache.ignite.cache.eviction.fifo;
import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
import java.util.Collection;
import java.util.Collections;
+import org.apache.ignite.cache.eviction.AbstractEvictionPolicy;
import org.apache.ignite.cache.eviction.EvictableEntry;
-import org.apache.ignite.cache.eviction.EvictionPolicy;
-import org.apache.ignite.internal.util.typedef.internal.A;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.jsr166.ConcurrentLinkedDeque8;
import org.jsr166.ConcurrentLinkedDeque8.Node;
-import org.jsr166.LongAdder8;
-
-import static org.apache.ignite.configuration.CacheConfiguration.DFLT_CACHE_SIZE;
/**
* Eviction policy based on {@code First In First Out (FIFO)} algorithm and supports batch eviction.
@@ -51,22 +44,10 @@ import static org.apache.ignite.configuration.CacheConfiguration.DFLT_CACHE_SIZE
* table-like data structures. The {@code FIFO} ordering information is
* maintained by attaching ordering metadata to cache entries.
*/
-public class FifoEvictionPolicy<K, V> implements EvictionPolicy<K, V>, FifoEvictionPolicyMBean, Externalizable {
+public class FifoEvictionPolicy<K, V> extends AbstractEvictionPolicy<K, V> implements FifoEvictionPolicyMBean, Externalizable {
/** */
private static final long serialVersionUID = 0L;
- /** Maximum size. */
- private volatile int max = DFLT_CACHE_SIZE;
-
- /** Batch size. */
- private volatile int batchSize = 1;
-
- /** Max memory size. */
- private volatile long maxMemSize;
-
- /** Memory size. */
- private final LongAdder8 memSize = new LongAdder8();
-
/** FIFO queue. */
private final ConcurrentLinkedDeque8<EvictableEntry<K, V>> queue =
new ConcurrentLinkedDeque8<>();
@@ -84,9 +65,7 @@ public class FifoEvictionPolicy<K, V> implements EvictionPolicy<K, V>, FifoEvict
* @param max Maximum allowed size of cache before entry will start getting evicted.
*/
public FifoEvictionPolicy(int max) {
- A.ensure(max >= 0, "max >= 0");
-
- this.max = max;
+ setMaxSize(max);
}
/**
@@ -96,43 +75,8 @@ public class FifoEvictionPolicy<K, V> implements EvictionPolicy<K, V>, FifoEvict
* @param batchSize Batch size.
*/
public FifoEvictionPolicy(int max, int batchSize) {
- A.ensure(max >= 0, "max >= 0");
- A.ensure(batchSize > 0, "batchSize > 0");
-
- this.max = max;
- this.batchSize = batchSize;
- }
-
- /**
- * Gets maximum allowed size of cache before entry will start getting evicted.
- *
- * @return Maximum allowed size of cache before entry will start getting evicted.
- */
- @Override public int getMaxSize() {
- return max;
- }
-
- /**
- * Sets maximum allowed size of cache before entry will start getting evicted.
- *
- * @param max Maximum allowed size of cache before entry will start getting evicted.
- */
- @Override public void setMaxSize(int max) {
- A.ensure(max >= 0, "max >= 0");
-
- this.max = max;
- }
-
- /** {@inheritDoc} */
- @Override public int getBatchSize() {
- return batchSize;
- }
-
- /** {@inheritDoc} */
- @Override public void setBatchSize(int batchSize) {
- A.ensure(batchSize > 0, "batchSize > 0");
-
- this.batchSize = batchSize;
+ setMaxSize(max);
+ setBatchSize(batchSize);
}
/** {@inheritDoc} */
@@ -140,23 +84,6 @@ public class FifoEvictionPolicy<K, V> implements EvictionPolicy<K, V>, FifoEvict
return queue.size();
}
- /** {@inheritDoc} */
- @Override public long getMaxMemorySize() {
- return maxMemSize;
- }
-
- /** {@inheritDoc} */
- @Override public void setMaxMemorySize(long maxMemSize) {
- A.ensure(maxMemSize >= 0, "maxMemSize >= 0");
-
- this.maxMemSize = maxMemSize;
- }
-
- /** {@inheritDoc} */
- @Override public long getCurrentMemorySize() {
- return memSize.longValue();
- }
-
/**
* Gets read-only view on internal {@code FIFO} queue in proper order.
*
@@ -167,31 +94,15 @@ public class FifoEvictionPolicy<K, V> implements EvictionPolicy<K, V>, FifoEvict
}
/** {@inheritDoc} */
- @Override public void onEntryAccessed(boolean rmv, EvictableEntry<K, V> entry) {
- if (!rmv) {
- if (!entry.isCached())
- return;
-
- // Shrink only if queue was changed.
- if (touch(entry))
- shrink();
- }
- else {
- Node<EvictableEntry<K, V>> node = entry.removeMeta();
-
- if (node != null) {
- queue.unlinkx(node);
-
- memSize.add(-entry.size());
- }
- }
+ @Override protected boolean removeMeta(Object meta) {
+ return queue.unlinkx((Node<EvictableEntry<K, V>>)meta);
}
/**
* @param entry Entry to touch.
* @return {@code True} if queue has been changed by this call.
*/
- private boolean touch(EvictableEntry<K, V> entry) {
+ protected boolean touch(EvictableEntry<K, V> entry) {
Node<EvictableEntry<K, V>> node = entry.meta();
// Entry has not been enqueued yet.
@@ -214,7 +125,7 @@ public class FifoEvictionPolicy<K, V> implements EvictionPolicy<K, V>, FifoEvict
return false;
}
- memSize.add(entry.size());
+ addToMemorySize(entry.size());
return true;
}
@@ -229,44 +140,11 @@ public class FifoEvictionPolicy<K, V> implements EvictionPolicy<K, V>, FifoEvict
}
/**
- * Shrinks FIFO queue to maximum allowed size.
- */
- private void shrink() {
- long maxMem = this.maxMemSize;
-
- if (maxMem > 0) {
- long startMemSize = memSize.longValue();
-
- if (startMemSize >= maxMem)
- for (long i = maxMem; i < startMemSize && memSize.longValue() > maxMem;) {
- int size = shrink0();
-
- if (size == -1)
- break;
-
- i += size;
- }
- }
-
- int max = this.max;
-
- if (max > 0) {
- int startSize = queue.sizex();
-
- // Shrink only if queue is full.
- if (startSize >= max + (maxMem > 0 ? 1 : this.batchSize))
- for (int i = max; i < startSize && queue.sizex() > max; i++)
- if (shrink0() == -1)
- break;
- }
- }
-
- /**
* Tries to remove one item from queue.
*
* @return number of bytes that was free. {@code -1} if queue is empty.
*/
- private int shrink0() {
+ @Override protected int shrink0() {
EvictableEntry<K, V> entry = queue.poll();
if (entry == null)
@@ -279,7 +157,7 @@ public class FifoEvictionPolicy<K, V> implements EvictionPolicy<K, V>, FifoEvict
if (meta != null) {
size = entry.size();
- memSize.add(-size);
+ addToMemorySize(-size);
if (!entry.evict())
touch(entry);
@@ -289,20 +167,6 @@ public class FifoEvictionPolicy<K, V> implements EvictionPolicy<K, V>, FifoEvict
}
/** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- out.writeInt(max);
- out.writeInt(batchSize);
- out.writeLong(maxMemSize);
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- max = in.readInt();
- batchSize = in.readInt();
- maxMemSize = in.readLong();
- }
-
- /** {@inheritDoc} */
@Override public String toString() {
return S.toString(FifoEvictionPolicy.class, this);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/19566fbc/modules/core/src/main/java/org/apache/ignite/cache/eviction/lru/LruEvictionPolicy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/lru/LruEvictionPolicy.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/lru/LruEvictionPolicy.java
index f321764..caa4b3f 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/eviction/lru/LruEvictionPolicy.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/eviction/lru/LruEvictionPolicy.java
@@ -18,20 +18,13 @@
package org.apache.ignite.cache.eviction.lru;
import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
import java.util.Collection;
import java.util.Collections;
+import org.apache.ignite.cache.eviction.AbstractEvictionPolicy;
import org.apache.ignite.cache.eviction.EvictableEntry;
-import org.apache.ignite.cache.eviction.EvictionPolicy;
-import org.apache.ignite.internal.util.typedef.internal.A;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.jsr166.ConcurrentLinkedDeque8;
import org.jsr166.ConcurrentLinkedDeque8.Node;
-import org.jsr166.LongAdder8;
-
-import static org.apache.ignite.configuration.CacheConfiguration.DFLT_CACHE_SIZE;
/**
* Eviction policy based on {@code Least Recently Used (LRU)} algorithm and supports batch eviction.
@@ -50,22 +43,10 @@ import static org.apache.ignite.configuration.CacheConfiguration.DFLT_CACHE_SIZE
* This implementation is very efficient since it is lock-free and does not create any additional table-like
* data structures. The {@code LRU} ordering information is maintained by attaching ordering metadata to cache entries.
*/
-public class LruEvictionPolicy<K, V> implements EvictionPolicy<K, V>, LruEvictionPolicyMBean, Externalizable {
+public class LruEvictionPolicy<K, V> extends AbstractEvictionPolicy<K, V> implements LruEvictionPolicyMBean, Externalizable {
/** */
private static final long serialVersionUID = 0L;
- /** Maximum size. */
- private volatile int max = DFLT_CACHE_SIZE;
-
- /** Batch size. */
- private volatile int batchSize = 1;
-
- /** Max memory size. */
- private volatile long maxMemSize;
-
- /** Memory size. */
- private final LongAdder8 memSize = new LongAdder8();
-
/** Queue. */
private final ConcurrentLinkedDeque8<EvictableEntry<K, V>> queue =
new ConcurrentLinkedDeque8<>();
@@ -83,41 +64,7 @@ public class LruEvictionPolicy<K, V> implements EvictionPolicy<K, V>, LruEvictio
* @param max Maximum allowed size of cache before entry will start getting evicted.
*/
public LruEvictionPolicy(int max) {
- A.ensure(max >= 0, "max >= 0");
-
- this.max = max;
- }
-
- /**
- * Gets maximum allowed size of cache before entry will start getting evicted.
- *
- * @return Maximum allowed size of cache before entry will start getting evicted.
- */
- @Override public int getMaxSize() {
- return max;
- }
-
- /**
- * Sets maximum allowed size of cache before entry will start getting evicted.
- *
- * @param max Maximum allowed size of cache before entry will start getting evicted.
- */
- @Override public void setMaxSize(int max) {
- A.ensure(max >= 0, "max >= 0");
-
- this.max = max;
- }
-
- /** {@inheritDoc} */
- @Override public int getBatchSize() {
- return batchSize;
- }
-
- /** {@inheritDoc} */
- @Override public void setBatchSize(int batchSize) {
- A.ensure(batchSize > 0, "batchSize > 0");
-
- this.batchSize = batchSize;
+ setMaxSize(max);
}
/** {@inheritDoc} */
@@ -125,23 +72,6 @@ public class LruEvictionPolicy<K, V> implements EvictionPolicy<K, V>, LruEvictio
return queue.size();
}
- /** {@inheritDoc} */
- @Override public long getMaxMemorySize() {
- return maxMemSize;
- }
-
- /** {@inheritDoc} */
- @Override public void setMaxMemorySize(long maxMemSize) {
- A.ensure(maxMemSize >= 0, "maxMemSize >= 0");
-
- this.maxMemSize = maxMemSize;
- }
-
- /** {@inheritDoc} */
- @Override public long getCurrentMemorySize() {
- return memSize.longValue();
- }
-
/**
* Gets read-only view on internal {@code FIFO} queue in proper order.
*
@@ -152,30 +82,15 @@ public class LruEvictionPolicy<K, V> implements EvictionPolicy<K, V>, LruEvictio
}
/** {@inheritDoc} */
- @Override public void onEntryAccessed(boolean rmv, EvictableEntry<K, V> entry) {
- if (!rmv) {
- if (!entry.isCached())
- return;
-
- if (touch(entry))
- shrink();
- }
- else {
- Node<EvictableEntry<K, V>> node = entry.removeMeta();
-
- if (node != null) {
- queue.unlinkx(node);
-
- memSize.add(-entry.size());
- }
- }
+ @Override protected boolean removeMeta(Object meta) {
+ return queue.unlinkx((Node<EvictableEntry<K, V>>)meta);
}
/**
* @param entry Entry to touch.
* @return {@code True} if new node has been added to queue by this call.
*/
- private boolean touch(EvictableEntry<K, V> entry) {
+ @Override protected boolean touch(EvictableEntry<K, V> entry) {
Node<EvictableEntry<K, V>> node = entry.meta();
// Entry has not been enqueued yet.
@@ -185,7 +100,7 @@ public class LruEvictionPolicy<K, V> implements EvictionPolicy<K, V>, LruEvictio
if (entry.putMetaIfAbsent(node) != null) {
// Was concurrently added, need to clear it from queue.
- queue.unlinkx(node);
+ removeMeta(node);
// Queue has not been changed.
return false;
@@ -193,12 +108,12 @@ public class LruEvictionPolicy<K, V> implements EvictionPolicy<K, V>, LruEvictio
else if (node.item() != null) {
if (!entry.isCached()) {
// Was concurrently evicted, need to clear it from queue.
- queue.unlinkx(node);
+ removeMeta(node);
return false;
}
- memSize.add(entry.size());
+ addToMemorySize(entry.size());
return true;
}
@@ -207,13 +122,13 @@ public class LruEvictionPolicy<K, V> implements EvictionPolicy<K, V>, LruEvictio
return false;
}
}
- else if (queue.unlinkx(node)) {
+ else if (removeMeta(node)) {
// Move node to tail.
Node<EvictableEntry<K, V>> newNode = queue.offerLastx(entry);
if (!entry.replaceMeta(node, newNode))
// Was concurrently added, need to clear it from queue.
- queue.unlinkx(newNode);
+ removeMeta(newNode);
}
// Entry is already in queue.
@@ -221,43 +136,11 @@ public class LruEvictionPolicy<K, V> implements EvictionPolicy<K, V>, LruEvictio
}
/**
- * Shrinks queue to maximum allowed size.
- */
- private void shrink() {
- long maxMem = this.maxMemSize;
-
- if (maxMem > 0) {
- long startMemSize = memSize.longValue();
-
- if (startMemSize >= maxMem)
- for (long i = maxMem; i < startMemSize && memSize.longValue() > maxMem;) {
- int size = shrink0();
-
- if (size == -1)
- break;
-
- i += size;
- }
- }
-
- int max = this.max;
-
- if (max > 0) {
- int startSize = queue.sizex();
-
- if (startSize >= max + (maxMem > 0 ? 1 : this.batchSize))
- for (int i = max; i < startSize && queue.sizex() > max; i++)
- if (shrink0() == -1)
- break;
- }
- }
-
- /**
* Tries to remove one item from queue.
*
* @return number of bytes that was free. {@code -1} if queue is empty.
*/
- private int shrink0() {
+ @Override protected int shrink0() {
EvictableEntry<K, V> entry = queue.poll();
if (entry == null)
@@ -270,7 +153,7 @@ public class LruEvictionPolicy<K, V> implements EvictionPolicy<K, V>, LruEvictio
if (meta != null) {
size = entry.size();
- memSize.add(-size);
+ addToMemorySize(-size);
if (!entry.evict())
touch(entry);
@@ -280,21 +163,7 @@ public class LruEvictionPolicy<K, V> implements EvictionPolicy<K, V>, LruEvictio
}
/** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- out.writeInt(max);
- out.writeInt(batchSize);
- out.writeLong(maxMemSize);
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- max = in.readInt();
- batchSize = in.readInt();
- maxMemSize = in.readLong();
- }
-
- /** {@inheritDoc} */
@Override public String toString() {
- return S.toString(LruEvictionPolicy.class, this, "size", queue.sizex());
+ return S.toString(LruEvictionPolicy.class, this, "size", getCurrentSize());
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/19566fbc/modules/core/src/main/java/org/apache/ignite/cache/eviction/random/RandomEvictionPolicy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/random/RandomEvictionPolicy.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/random/RandomEvictionPolicy.java
deleted file mode 100644
index f77551d..0000000
--- a/modules/core/src/main/java/org/apache/ignite/cache/eviction/random/RandomEvictionPolicy.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.cache.eviction.random;
-
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import javax.cache.Cache;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.CachePeekMode;
-import org.apache.ignite.cache.eviction.EvictableEntry;
-import org.apache.ignite.cache.eviction.EvictionPolicy;
-import org.apache.ignite.internal.util.typedef.internal.A;
-import org.apache.ignite.internal.util.typedef.internal.S;
-
-import static org.apache.ignite.configuration.CacheConfiguration.DFLT_CACHE_SIZE;
-
-/**
- * Cache eviction policy which will select random cache entry for eviction if cache
- * size exceeds the {@link #getMaxSize()} parameter. This implementation is
- * extremely light weight, lock-free, and does not create any data structures to maintain
- * any order for eviction.
- * <p>
- * Random eviction will provide the best performance over any key queue in which every
- * key has the same probability of being accessed.
- *
- * @deprecated This eviction policy implementation doesn't support near cache
- * and doesn't work on client nodes. Also it seems that random eviction doesn't make sense.
- */
-@Deprecated
-public class RandomEvictionPolicy<K, V> implements EvictionPolicy<K, V>, RandomEvictionPolicyMBean, Externalizable {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** Maximum size. */
- private volatile int max = DFLT_CACHE_SIZE;
-
- /**
- * Constructs random eviction policy with all defaults.
- */
- public RandomEvictionPolicy() {
- // No-op.
- }
-
- /**
- * Constructs random eviction policy with maximum size.
- *
- * @param max Maximum allowed size of cache before entry will start getting evicted.
- */
- public RandomEvictionPolicy(int max) {
- A.ensure(max > 0, "max > 0");
-
- this.max = max;
- }
-
- /**
- * Gets maximum allowed size of cache before entry will start getting evicted.
- *
- * @return Maximum allowed size of cache before entry will start getting evicted.
- */
- @Override public int getMaxSize() {
- return max;
- }
-
- /**
- * Sets maximum allowed size of cache before entry will start getting evicted.
- *
- * @param max Maximum allowed size of cache before entry will start getting evicted.
- */
- @Override public void setMaxSize(int max) {
- A.ensure(max > 0, "max > 0");
-
- this.max = max;
- }
-
- /** {@inheritDoc} */
- @SuppressWarnings("unchecked")
- @Override public void onEntryAccessed(boolean rmv, EvictableEntry<K, V> entry) {
- if (!entry.isCached())
- return;
-
- IgniteCache<K, V> cache = entry.unwrap(IgniteCache.class);
-
- int size = cache.localSize(CachePeekMode.ONHEAP);
-
- for (int i = max; i < size; i++) {
- Cache.Entry<K, V> e = cache.randomEntry();
-
- if (e != null)
- e.unwrap(EvictableEntry.class).evict();
- }
- }
-
- /** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- out.writeInt(max);
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- max = in.readInt();
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(RandomEvictionPolicy.class, this);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/19566fbc/modules/core/src/main/java/org/apache/ignite/cache/eviction/random/RandomEvictionPolicyMBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/random/RandomEvictionPolicyMBean.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/random/RandomEvictionPolicyMBean.java
deleted file mode 100644
index 3193483..0000000
--- a/modules/core/src/main/java/org/apache/ignite/cache/eviction/random/RandomEvictionPolicyMBean.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.cache.eviction.random;
-
-import org.apache.ignite.mxbean.MXBeanDescription;
-
-/**
- * MBean for {@code random} eviction policy.
- */
-@MXBeanDescription("MBean for random cache eviction policy.")
-public interface RandomEvictionPolicyMBean {
- /**
- * Gets maximum allowed cache size.
- *
- * @return Maximum allowed cache size.
- */
- @MXBeanDescription("Maximum allowed cache size.")
- public int getMaxSize();
-
- /**
- * Sets maximum allowed cache size.
- *
- * @param max Maximum allowed cache size.
- */
- @MXBeanDescription("Sets maximum allowed cache size.")
- public void setMaxSize(int max);
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/19566fbc/modules/core/src/main/java/org/apache/ignite/cache/eviction/sorted/SortedEvictionPolicy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/eviction/sorted/SortedEvictionPolicy.java b/modules/core/src/main/java/org/apache/ignite/cache/eviction/sorted/SortedEvictionPolicy.java
index 6189552..47f8479 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/eviction/sorted/SortedEvictionPolicy.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/eviction/sorted/SortedEvictionPolicy.java
@@ -29,8 +29,8 @@ import java.util.LinkedHashSet;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.atomic.AtomicLong;
+import org.apache.ignite.cache.eviction.AbstractEvictionPolicy;
import org.apache.ignite.cache.eviction.EvictableEntry;
-import org.apache.ignite.cache.eviction.EvictionPolicy;
import org.apache.ignite.internal.util.GridConcurrentSkipListSet;
import org.apache.ignite.internal.util.typedef.internal.A;
import org.jetbrains.annotations.Nullable;
@@ -59,22 +59,10 @@ import static org.apache.ignite.configuration.CacheConfiguration.DFLT_CACHE_SIZE
* <p>
* User defined comparator should implement {@link Serializable} interface.
*/
-public class SortedEvictionPolicy<K, V> implements EvictionPolicy<K, V>, SortedEvictionPolicyMBean, Externalizable {
+public class SortedEvictionPolicy<K, V> extends AbstractEvictionPolicy<K, V> implements SortedEvictionPolicyMBean, Externalizable {
/** */
private static final long serialVersionUID = 0L;
- /** Maximum size. */
- private volatile int max = DFLT_CACHE_SIZE;
-
- /** Batch size. */
- private volatile int batchSize = 1;
-
- /** Max memory size. */
- private volatile long maxMemSize;
-
- /** Memory size. */
- private final LongAdder8 memSize = new LongAdder8();
-
/** Comparator. */
private Comparator<Holder<K, V>> comp;
@@ -118,11 +106,8 @@ public class SortedEvictionPolicy<K, V> implements EvictionPolicy<K, V>, SortedE
* @param comp Entries comparator.
*/
public SortedEvictionPolicy(int max, int batchSize, @Nullable Comparator<EvictableEntry<K, V>> comp) {
- A.ensure(max >= 0, "max >= 0");
- A.ensure(batchSize > 0, "batchSize > 0");
-
- this.max = max;
- this.batchSize = batchSize;
+ setMaxSize(max);
+ setBatchSize(batchSize);
this.comp = comp == null ? new DefaultHolderComparator<K, V>() : new HolderComparator<>(comp);
this.set = new GridConcurrentSkipListSetEx<>(this.comp);
}
@@ -138,60 +123,6 @@ public class SortedEvictionPolicy<K, V> implements EvictionPolicy<K, V>, SortedE
}
/**
- * Gets maximum allowed size of cache before entry will start getting evicted.
- *
- * @return Maximum allowed size of cache before entry will start getting evicted.
- */
- @Override public int getMaxSize() {
- return max;
- }
-
- /**
- * Sets maximum allowed size of cache before entry will start getting evicted.
- *
- * @param max Maximum allowed size of cache before entry will start getting evicted.
- */
- @Override public void setMaxSize(int max) {
- A.ensure(max >= 0, "max >= 0");
-
- this.max = max;
- }
-
- /** {@inheritDoc} */
- @Override public int getBatchSize() {
- return batchSize;
- }
-
- /** {@inheritDoc} */
- @Override public void setBatchSize(int batchSize) {
- A.ensure(batchSize > 0, "batchSize > 0");
-
- this.batchSize = batchSize;
- }
-
- /** {@inheritDoc} */
- @Override public int getCurrentSize() {
- return set.sizex();
- }
-
- /** {@inheritDoc} */
- @Override public long getMaxMemorySize() {
- return maxMemSize;
- }
-
- /** {@inheritDoc} */
- @Override public void setMaxMemorySize(long maxMemSize) {
- A.ensure(maxMemSize >= 0, "maxMemSize >= 0");
-
- this.maxMemSize = maxMemSize;
- }
-
- /** {@inheritDoc} */
- @Override public long getCurrentMemorySize() {
- return memSize.longValue();
- }
-
- /**
* Gets read-only view of backed queue in proper order.
*
* @return Read-only view of backed queue.
@@ -205,31 +136,11 @@ public class SortedEvictionPolicy<K, V> implements EvictionPolicy<K, V>, SortedE
return Collections.unmodifiableCollection(cp);
}
- /** {@inheritDoc} */
- @Override public void onEntryAccessed(boolean rmv, EvictableEntry<K, V> entry) {
- if (!rmv) {
- if (!entry.isCached())
- return;
-
- if (touch(entry))
- shrink();
- }
- else {
- Holder<K, V> holder = entry.removeMeta();
-
- if (holder != null) {
- removeHolder(holder);
-
- memSize.add(-entry.size());
- }
- }
- }
-
/**
* @param entry Entry to touch.
* @return {@code True} if backed queue has been changed by this call.
*/
- private boolean touch(EvictableEntry<K, V> entry) {
+ @Override protected boolean touch(EvictableEntry<K, V> entry) {
Holder<K, V> holder = entry.meta();
// Entry has not been added yet to backed queue.
@@ -245,12 +156,12 @@ public class SortedEvictionPolicy<K, V> implements EvictionPolicy<K, V>, SortedE
if (holder.order > 0) {
if (!entry.isCached()) {
// Was concurrently evicted, need to remove it from queue.
- removeHolder(holder);
+ removeMeta(holder);
return false;
}
- memSize.add(entry.size());
+ addToMemorySize(entry.size());
return true;
}
@@ -264,38 +175,9 @@ public class SortedEvictionPolicy<K, V> implements EvictionPolicy<K, V>, SortedE
return false;
}
- /**
- * Shrinks backed queue to maximum allowed size.
- */
- private void shrink() {
- long maxMem = this.maxMemSize;
-
- if (maxMem > 0) {
- long startMemSize = memSize.longValue();
-
- if (startMemSize >= maxMem)
- for (long i = maxMem; i < startMemSize && memSize.longValue() > maxMem;) {
- int size = shrink0();
-
- if (size == -1)
- break;
-
- i += size;
- }
- }
-
- int max = this.max;
-
- if (max > 0) {
- int startSize = set.sizex();
-
- if (startSize >= max + (maxMem > 0 ? 1 : this.batchSize)) {
- for (int i = max; i < startSize && set.sizex() > max; i++) {
- if (shrink0() == -1)
- break;
- }
- }
- }
+ /** {@inheritDoc} */
+ @Override public int getCurrentSize() {
+ return set.size();
}
/**
@@ -303,7 +185,7 @@ public class SortedEvictionPolicy<K, V> implements EvictionPolicy<K, V>, SortedE
*
* @return number of bytes that was free. {@code -1} if queue is empty.
*/
- private int shrink0() {
+ @Override protected int shrink0() {
Holder<K, V> h = set.pollFirst();
if (h == null)
@@ -313,10 +195,10 @@ public class SortedEvictionPolicy<K, V> implements EvictionPolicy<K, V>, SortedE
EvictableEntry<K, V> entry = h.entry;
- if (h.order > 0 && entry.removeMeta(h)) {
+ if (entry != null && h.order > 0 && entry.removeMeta(h)) {
size = entry.size();
- memSize.add(-size);
+ addToMemorySize(-size);
if (!entry.evict())
touch(entry);
@@ -327,33 +209,31 @@ public class SortedEvictionPolicy<K, V> implements EvictionPolicy<K, V>, SortedE
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
- out.writeInt(max);
- out.writeInt(batchSize);
- out.writeLong(maxMemSize);
+ super.writeExternal(out);
out.writeObject(comp);
}
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- max = in.readInt();
- batchSize = in.readInt();
- maxMemSize = in.readLong();
+ super.readExternal(in);
comp = (Comparator<Holder<K, V>>)in.readObject();
}
/**
* Removes holder from backed queue and marks holder as removed.
*
- * @param holder Holder.
+ * @param meta Holder.
*/
- private void removeHolder(Holder<K, V> holder) {
+ @Override protected boolean removeMeta(Object meta) {
+ Holder<K, V> holder = (Holder<K, V>)meta;
+
long order0 = holder.order;
if (order0 > 0)
holder.order = -order0;
- set.remove(holder);
+ return set.remove(holder);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/19566fbc/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
index 3f5003a..8e4590e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
@@ -53,7 +53,7 @@ import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cache.eviction.EvictionPolicy;
import org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicyMBean;
import org.apache.ignite.cache.eviction.lru.LruEvictionPolicyMBean;
-import org.apache.ignite.cache.eviction.random.RandomEvictionPolicyMBean;
+import org.apache.ignite.cache.eviction.sorted.SortedEvictionPolicyMBean;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.events.DiscoveryEvent;
import org.apache.ignite.events.Event;
@@ -693,12 +693,12 @@ public class VisorTaskUtils {
if (plc instanceof LruEvictionPolicyMBean)
return ((LruEvictionPolicyMBean)plc).getMaxSize();
- if (plc instanceof RandomEvictionPolicyMBean)
- return ((RandomEvictionPolicyMBean)plc).getMaxSize();
-
if (plc instanceof FifoEvictionPolicyMBean)
return ((FifoEvictionPolicyMBean)plc).getMaxSize();
+ if (plc instanceof SortedEvictionPolicyMBean)
+ return ((SortedEvictionPolicyMBean)plc).getMaxSize();
+
return null;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/19566fbc/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties
index 8cfed3a..eb8bfad 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -67,7 +67,6 @@ org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy
org.apache.ignite.cache.eviction.igfs.IgfsEvictionFilter
org.apache.ignite.cache.eviction.igfs.IgfsPerBlockLruEvictionPolicy
org.apache.ignite.cache.eviction.lru.LruEvictionPolicy
-org.apache.ignite.cache.eviction.random.RandomEvictionPolicy
org.apache.ignite.cache.eviction.sorted.SortedEvictionPolicy
org.apache.ignite.cache.eviction.sorted.SortedEvictionPolicy$DefaultHolderComparator
org.apache.ignite.cache.eviction.sorted.SortedEvictionPolicy$GridConcurrentSkipListSetEx
http://git-wip-us.apache.org/repos/asf/ignite/blob/19566fbc/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java
index a1f917f..7157531 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java
@@ -31,7 +31,7 @@ import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.cache.eviction.EvictionFilter;
import org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy;
import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy;
-import org.apache.ignite.cache.eviction.random.RandomEvictionPolicy;
+import org.apache.ignite.cache.eviction.sorted.SortedEvictionPolicy;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.DeploymentMode;
@@ -382,7 +382,7 @@ public class GridCacheConfigurationConsistencySelfTest extends GridCommonAbstrac
new C1<CacheConfiguration, Void>() {
/** {@inheritDoc} */
@Override public Void apply(CacheConfiguration cfg) {
- cfg.setEvictionPolicy(new RandomEvictionPolicy());
+ cfg.setEvictionPolicy(new SortedEvictionPolicy());
return null;
}
},
@@ -632,7 +632,7 @@ public class GridCacheConfigurationConsistencySelfTest extends GridCommonAbstrac
@Override public Void apply(CacheConfiguration cfg) {
NearCacheConfiguration nearCfg = new NearCacheConfiguration();
- nearCfg.setNearEvictionPolicy(new RandomEvictionPolicy());
+ nearCfg.setNearEvictionPolicy(new LruEvictionPolicy());
cfg.setNearConfiguration(nearCfg);
http://git-wip-us.apache.org/repos/asf/ignite/blob/19566fbc/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/EvictionAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/EvictionAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/EvictionAbstractTest.java
index 4acf1af..cee04ed 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/EvictionAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/EvictionAbstractTest.java
@@ -1030,7 +1030,7 @@ public abstract class EvictionAbstractTest<T extends EvictionPolicy<?, ?>>
*/
public long getCurrentMemorySize() {
try {
- return (Long)plc.getClass().getDeclaredMethod("getCurrentMemorySize").invoke(plc);
+ return (Long)plc.getClass().getMethod("getCurrentMemorySize").invoke(plc);
}
catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
throw new RuntimeException(e);
@@ -1056,7 +1056,7 @@ public abstract class EvictionAbstractTest<T extends EvictionPolicy<?, ?>>
@Override public void onEntryAccessed(boolean rmv, EvictableEntry entry) {
try {
plc.getClass()
- .getDeclaredMethod("onEntryAccessed", boolean.class, EvictableEntry.class)
+ .getMethod("onEntryAccessed", boolean.class, EvictableEntry.class)
.invoke(plc, rmv, entry);
}
catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
[15/33] ignite git commit: IGNITE-4804: Remove duplicated properties
in parent-pom
Posted by vo...@apache.org.
IGNITE-4804: Remove duplicated properties in parent-pom
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e6703518
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e6703518
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e6703518
Branch: refs/heads/ignite-4565-ddl
Commit: e6703518f4549a183993a5422fbf75b18f1237de
Parents: 748d1fd
Author: Vyacheslav Daradur <da...@gmail.com>
Authored: Fri Mar 10 11:35:26 2017 -0800
Committer: Denis Magda <dm...@gridgain.com>
Committed: Fri Mar 10 11:35:26 2017 -0800
----------------------------------------------------------------------
parent/pom.xml | 2 --
1 file changed, 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e6703518/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 32da7ec..5361d15 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -71,7 +71,6 @@
<guava14.version>14.0.1</guava14.version>
<guava16.version>16.0.1</guava16.version>
<h2.version>1.4.191</h2.version>
- <hadoop.version>2.4.1</hadoop.version>
<httpclient.version>4.5.1</httpclient.version>
<httpcore.version>4.4.3</httpcore.version>
<jackson.version>1.9.13</jackson.version>
@@ -99,7 +98,6 @@
<scala211.library.version>2.11.7</scala211.library.version>
<slf4j.version>1.7.7</slf4j.version>
<slf4j16.version>1.6.4</slf4j16.version>
- <spring.version>4.1.0.RELEASE</spring.version>
<spring41.osgi.feature.version>4.1.7.RELEASE_1</spring41.osgi.feature.version>
<tomcat.version>8.0.23</tomcat.version>
<twitter.hbc.version>2.2.0</twitter.hbc.version>
[02/33] ignite git commit: IGNITE-3429: Added BinaryResolver
configuration samples for org.hibernate.cache.spi.CacheKey. This closes
#1516.
Posted by vo...@apache.org.
IGNITE-3429: Added BinaryResolver configuration samples for org.hibernate.cache.spi.CacheKey. This closes #1516.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/05788b31
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/05788b31
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/05788b31
Branch: refs/heads/ignite-4565-ddl
Commit: 05788b3188b30b5a3b39a75fe66301e03658408f
Parents: 8874f99
Author: Andrey V. Mashenkov <an...@gmail.com>
Authored: Fri Feb 17 12:14:53 2017 +0300
Committer: Andrey V. Mashenkov <an...@gmail.com>
Committed: Fri Feb 17 12:14:53 2017 +0300
----------------------------------------------------------------------
.../Hibernate5CacheKeyTypeConfiguration.java | 52 ++++++++++++++++++++
.../HibernateCacheKeyTypeConfiguration.java | 51 +++++++++++++++++++
2 files changed, 103 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/05788b31/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/config/Hibernate5CacheKeyTypeConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/config/Hibernate5CacheKeyTypeConfiguration.java b/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/config/Hibernate5CacheKeyTypeConfiguration.java
new file mode 100644
index 0000000..886f69b
--- /dev/null
+++ b/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/config/Hibernate5CacheKeyTypeConfiguration.java
@@ -0,0 +1,52 @@
+/*
+ * 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.cache.hibernate.config;
+
+import java.util.Objects;
+import org.apache.ignite.binary.BinaryAbstractIdentityResolver;
+import org.apache.ignite.binary.BinaryIdentityResolver;
+import org.apache.ignite.binary.BinaryObject;
+import org.apache.ignite.binary.BinaryTypeConfiguration;
+
+/**
+ * This configuration provides correct {@link BinaryIdentityResolver} implementation
+ * for Hibernate CacheKey class can be used as a key object.
+ *
+ * Note: for Hibernate version < 5.0 {@link HibernateCacheKeyTypeConfiguration} should be used.
+
+ */
+public class Hibernate5CacheKeyTypeConfiguration extends BinaryTypeConfiguration {
+
+ /** {@inheritDoc} */
+ public Hibernate5CacheKeyTypeConfiguration() {
+ super("org.hibernate.cache.internal.CacheKeyImplementation");
+
+ setIdentityResolver(new BinaryAbstractIdentityResolver() {
+ @Override protected int hashCode0(BinaryObject obj) {
+ return obj.field("id").hashCode();
+ }
+
+ @Override protected boolean equals0(BinaryObject o1, BinaryObject o2) {
+ Object obj0 = o1.field("id");
+ Object obj1 = o2.field("id");
+
+ return Objects.equals(obj0, obj1);
+ }
+ });
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/05788b31/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/config/HibernateCacheKeyTypeConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/config/HibernateCacheKeyTypeConfiguration.java b/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/config/HibernateCacheKeyTypeConfiguration.java
new file mode 100644
index 0000000..c54292e
--- /dev/null
+++ b/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/config/HibernateCacheKeyTypeConfiguration.java
@@ -0,0 +1,51 @@
+/*
+ * 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.cache.hibernate.config;
+
+import java.util.Objects;
+import org.apache.ignite.binary.BinaryAbstractIdentityResolver;
+import org.apache.ignite.binary.BinaryIdentityResolver;
+import org.apache.ignite.binary.BinaryObject;
+import org.apache.ignite.binary.BinaryTypeConfiguration;
+
+/**
+ * This configuration provides correct {@link BinaryIdentityResolver} implementation
+ * for Hibernate CacheKey class can be used as a key object.
+ *
+ * Note: for Hibernate version >= 5.0 {@link Hibernate5CacheKeyTypeConfiguration} should be used.
+ */
+public class HibernateCacheKeyTypeConfiguration extends BinaryTypeConfiguration {
+
+ /** {@inheritDoc} */
+ public HibernateCacheKeyTypeConfiguration() {
+ super("org.hibernate.cache.spi.CacheKey");
+
+ setIdentityResolver(new BinaryAbstractIdentityResolver() {
+ @Override protected int hashCode0(BinaryObject obj) {
+ return obj.field("key").hashCode();
+ }
+
+ @Override protected boolean equals0(BinaryObject o1, BinaryObject o2) {
+ Object obj0 = o1.field("key");
+ Object obj1 = o2.field("key");
+
+ return Objects.equals(obj0, obj1);
+ }
+ });
+ }
+}
[07/33] ignite git commit: IGNITE-3429 - Rollback due to broken
compilation
Posted by vo...@apache.org.
IGNITE-3429 - Rollback due to broken compilation
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c0e2df26
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c0e2df26
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c0e2df26
Branch: refs/heads/ignite-4565-ddl
Commit: c0e2df26f056cd11690d821146f05e3fd938906e
Parents: 2f57760
Author: dkarachentsev <dk...@gridgain.com>
Authored: Mon Feb 20 11:17:35 2017 +0300
Committer: dkarachentsev <dk...@gridgain.com>
Committed: Mon Feb 20 11:17:35 2017 +0300
----------------------------------------------------------------------
.../Hibernate5CacheKeyTypeConfiguration.java | 52 --------------------
.../HibernateCacheKeyTypeConfiguration.java | 51 -------------------
2 files changed, 103 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c0e2df26/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/config/Hibernate5CacheKeyTypeConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/config/Hibernate5CacheKeyTypeConfiguration.java b/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/config/Hibernate5CacheKeyTypeConfiguration.java
deleted file mode 100644
index 886f69b..0000000
--- a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/config/Hibernate5CacheKeyTypeConfiguration.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.cache.hibernate.config;
-
-import java.util.Objects;
-import org.apache.ignite.binary.BinaryAbstractIdentityResolver;
-import org.apache.ignite.binary.BinaryIdentityResolver;
-import org.apache.ignite.binary.BinaryObject;
-import org.apache.ignite.binary.BinaryTypeConfiguration;
-
-/**
- * This configuration provides correct {@link BinaryIdentityResolver} implementation
- * for Hibernate CacheKey class can be used as a key object.
- *
- * Note: for Hibernate version < 5.0 {@link HibernateCacheKeyTypeConfiguration} should be used.
-
- */
-public class Hibernate5CacheKeyTypeConfiguration extends BinaryTypeConfiguration {
-
- /** {@inheritDoc} */
- public Hibernate5CacheKeyTypeConfiguration() {
- super("org.hibernate.cache.internal.CacheKeyImplementation");
-
- setIdentityResolver(new BinaryAbstractIdentityResolver() {
- @Override protected int hashCode0(BinaryObject obj) {
- return obj.field("id").hashCode();
- }
-
- @Override protected boolean equals0(BinaryObject o1, BinaryObject o2) {
- Object obj0 = o1.field("id");
- Object obj1 = o2.field("id");
-
- return Objects.equals(obj0, obj1);
- }
- });
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/c0e2df26/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/config/HibernateCacheKeyTypeConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/config/HibernateCacheKeyTypeConfiguration.java b/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/config/HibernateCacheKeyTypeConfiguration.java
deleted file mode 100644
index c54292e..0000000
--- a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/config/HibernateCacheKeyTypeConfiguration.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.cache.hibernate.config;
-
-import java.util.Objects;
-import org.apache.ignite.binary.BinaryAbstractIdentityResolver;
-import org.apache.ignite.binary.BinaryIdentityResolver;
-import org.apache.ignite.binary.BinaryObject;
-import org.apache.ignite.binary.BinaryTypeConfiguration;
-
-/**
- * This configuration provides correct {@link BinaryIdentityResolver} implementation
- * for Hibernate CacheKey class can be used as a key object.
- *
- * Note: for Hibernate version >= 5.0 {@link Hibernate5CacheKeyTypeConfiguration} should be used.
- */
-public class HibernateCacheKeyTypeConfiguration extends BinaryTypeConfiguration {
-
- /** {@inheritDoc} */
- public HibernateCacheKeyTypeConfiguration() {
- super("org.hibernate.cache.spi.CacheKey");
-
- setIdentityResolver(new BinaryAbstractIdentityResolver() {
- @Override protected int hashCode0(BinaryObject obj) {
- return obj.field("key").hashCode();
- }
-
- @Override protected boolean equals0(BinaryObject o1, BinaryObject o2) {
- Object obj0 = o1.field("key");
- Object obj1 = o2.field("key");
-
- return Objects.equals(obj0, obj1);
- }
- });
- }
-}
[25/33] ignite git commit: IGNITE-3586: CPP: Made QueryArgument
private
Posted by vo...@apache.org.
IGNITE-3586: CPP: Made QueryArgument private
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/15c97807
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/15c97807
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/15c97807
Branch: refs/heads/ignite-4565-ddl
Commit: 15c97807d9aba529fdd637e3ce5c89d2747f529b
Parents: 89eb175
Author: Igor Sapego <is...@gridgain.com>
Authored: Mon Mar 20 15:51:57 2017 +0300
Committer: Igor Sapego <is...@gridgain.com>
Committed: Mon Mar 20 15:51:57 2017 +0300
----------------------------------------------------------------------
modules/platforms/cpp/core/include/Makefile.am | 2 +-
.../include/ignite/cache/query/query_argument.h | 134 ------------------
.../core/include/ignite/cache/query/query_sql.h | 16 ++-
.../ignite/cache/query/query_sql_fields.h | 16 ++-
.../ignite/impl/cache/query/query_argument.h | 137 +++++++++++++++++++
.../platforms/cpp/core/project/vs/core.vcxproj | 2 +-
.../cpp/core/project/vs/core.vcxproj.filters | 6 +-
7 files changed, 160 insertions(+), 153 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/15c97807/modules/platforms/cpp/core/include/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/Makefile.am b/modules/platforms/cpp/core/include/Makefile.am
index 650f230..21d3062 100644
--- a/modules/platforms/cpp/core/include/Makefile.am
+++ b/modules/platforms/cpp/core/include/Makefile.am
@@ -25,6 +25,7 @@ nobase_include_HEADERS = \
ignite/impl/ignite_environment.h \
ignite/impl/ignite_impl.h \
ignite/impl/cache/query/query_fields_row_impl.h \
+ ignite/impl/cache/query/query_argument.h \
ignite/impl/cache/query/query_impl.h \
ignite/impl/cache/cache_impl.h \
ignite/impl/cache/cache_entry_processor_holder.h \
@@ -43,7 +44,6 @@ nobase_include_HEADERS = \
ignite/cache/query/query_cursor.h \
ignite/cache/query/query_sql.h \
ignite/cache/query/query.h \
- ignite/cache/query/query_argument.h \
ignite/cache/query/query_sql_fields.h \
ignite/cache/query/query_text.h \
ignite/cache/cache.h \
http://git-wip-us.apache.org/repos/asf/ignite/blob/15c97807/modules/platforms/cpp/core/include/ignite/cache/query/query_argument.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/cache/query/query_argument.h b/modules/platforms/cpp/core/include/ignite/cache/query/query_argument.h
deleted file mode 100644
index 65578ce..0000000
--- a/modules/platforms/cpp/core/include/ignite/cache/query/query_argument.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file
- * Declares ignite::cache::query::QueryArgument class template and
- * ignite::cache::query::QueryArgumentBase interface.
- */
-
-#ifndef _IGNITE_CACHE_QUERY_QUERY_ARGUMENT
-#define _IGNITE_CACHE_QUERY_QUERY_ARGUMENT
-
-#include "ignite/binary/binary_raw_writer.h"
-
-namespace ignite
-{
- namespace cache
- {
- namespace query
- {
- /**
- * Base class for all query arguments.
- */
- class QueryArgumentBase
- {
- public:
- /**
- * Destructor.
- */
- virtual ~QueryArgumentBase()
- {
- // No-op.
- }
-
- /**
- * Copy argument.
- *
- * @return Copy of this argument instance.
- */
- virtual QueryArgumentBase* Copy() const = 0;
-
- /**
- * Write argument using provided writer.
- *
- * @param writer Writer to use to write this argument.
- */
- virtual void Write(ignite::binary::BinaryRawWriter& writer) = 0;
- };
-
- /**
- * Query argument class template.
- *
- * Template argument type should be copy-constructable and
- * assignable. Also BinaryType class template should be specialized
- * for this type.
- */
- template<typename T>
- class QueryArgument : public QueryArgumentBase
- {
- public:
- /**
- * Constructor.
- *
- * @param val Value.
- */
- QueryArgument(const T& val) :
- val(val)
- {
- // No-op.
- }
-
- /**
- * Copy constructor.
- *
- * @param other Other instance.
- */
- QueryArgument(const QueryArgument& other) :
- val(other.val)
- {
- // No-op.
- }
-
- /**
- * Assignment operator.
- *
- * @param other Other instance.
- * @return *this.
- */
- QueryArgument& operator=(const QueryArgument& other)
- {
- if (this != &other)
- val = other.val;
-
- return *this;
- }
-
- virtual ~QueryArgument()
- {
- // No-op.
- }
-
- virtual QueryArgumentBase* Copy() const
- {
- return new QueryArgument(val);
- }
-
- virtual void Write(ignite::binary::BinaryRawWriter& writer)
- {
- writer.WriteObject<T>(val);
- }
-
- private:
- /** Value. */
- T val;
- };
- }
- }
-}
-
-#endif //_IGNITE_CACHE_QUERY_QUERY_ARGUMENT
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/15c97807/modules/platforms/cpp/core/include/ignite/cache/query/query_sql.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/cache/query/query_sql.h b/modules/platforms/cpp/core/include/ignite/cache/query/query_sql.h
index 0ec5d5f..289d70a 100644
--- a/modules/platforms/cpp/core/include/ignite/cache/query/query_sql.h
+++ b/modules/platforms/cpp/core/include/ignite/cache/query/query_sql.h
@@ -27,8 +27,8 @@
#include <string>
#include <vector>
-#include "ignite/cache/query/query_argument.h"
-#include "ignite/binary/binary_raw_writer.h"
+#include <ignite/impl/cache/query/query_argument.h>
+#include <ignite/binary/binary_raw_writer.h>
namespace ignite
{
@@ -74,7 +74,7 @@ namespace ignite
{
args.reserve(other.args.size());
- typedef std::vector<QueryArgumentBase*>::const_iterator Iter;
+ typedef std::vector<impl::cache::query::QueryArgumentBase*>::const_iterator Iter;
for (Iter i = other.args.begin(); i != other.args.end(); ++i)
args.push_back((*i)->Copy());
@@ -102,7 +102,7 @@ namespace ignite
*/
~SqlQuery()
{
- typedef std::vector<QueryArgumentBase*>::const_iterator Iter;
+ typedef std::vector<impl::cache::query::QueryArgumentBase*>::const_iterator Iter;
for (Iter it = args.begin(); it != args.end(); ++it)
delete *it;
@@ -241,7 +241,7 @@ namespace ignite
template<typename T>
void AddArgument(const T& arg)
{
- args.push_back(new QueryArgument<T>(arg));
+ args.push_back(new impl::cache::query::QueryArgument<T>(arg));
}
/**
@@ -258,7 +258,9 @@ namespace ignite
writer.WriteInt32(static_cast<int32_t>(args.size()));
- for (std::vector<QueryArgumentBase*>::const_iterator it = args.begin(); it != args.end(); ++it)
+ std::vector<impl::cache::query::QueryArgumentBase*>::const_iterator it;
+
+ for (it = args.begin(); it != args.end(); ++it)
(*it)->Write(writer);
writer.WriteBool(distributedJoins);
@@ -281,7 +283,7 @@ namespace ignite
bool distributedJoins;
/** Arguments. */
- std::vector<QueryArgumentBase*> args;
+ std::vector<impl::cache::query::QueryArgumentBase*> args;
};
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/15c97807/modules/platforms/cpp/core/include/ignite/cache/query/query_sql_fields.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/cache/query/query_sql_fields.h b/modules/platforms/cpp/core/include/ignite/cache/query/query_sql_fields.h
index 10dd6ab..7c09d85 100644
--- a/modules/platforms/cpp/core/include/ignite/cache/query/query_sql_fields.h
+++ b/modules/platforms/cpp/core/include/ignite/cache/query/query_sql_fields.h
@@ -27,8 +27,8 @@
#include <string>
#include <vector>
-#include "ignite/cache/query/query_argument.h"
-#include "ignite/binary/binary_raw_writer.h"
+#include <ignite/impl/cache/query/query_argument.h>
+#include <ignite/binary/binary_raw_writer.h>
namespace ignite
{
@@ -90,7 +90,7 @@ namespace ignite
{
args.reserve(other.args.size());
- typedef std::vector<QueryArgumentBase*>::const_iterator Iter;
+ typedef std::vector<impl::cache::query::QueryArgumentBase*>::const_iterator Iter;
for (Iter i = other.args.begin(); i != other.args.end(); ++i)
args.push_back((*i)->Copy());
@@ -118,7 +118,7 @@ namespace ignite
*/
~SqlFieldsQuery()
{
- typedef std::vector<QueryArgumentBase*>::const_iterator Iter;
+ typedef std::vector<impl::cache::query::QueryArgumentBase*>::const_iterator Iter;
for (Iter it = args.begin(); it != args.end(); ++it)
delete *it;
@@ -264,7 +264,7 @@ namespace ignite
template<typename T>
void AddArgument(const T& arg)
{
- args.push_back(new QueryArgument<T>(arg));
+ args.push_back(new impl::cache::query::QueryArgument<T>(arg));
}
/**
@@ -280,7 +280,9 @@ namespace ignite
writer.WriteInt32(static_cast<int32_t>(args.size()));
- for (std::vector<QueryArgumentBase*>::const_iterator it = args.begin(); it != args.end(); ++it)
+ std::vector<impl::cache::query::QueryArgumentBase*>::const_iterator it;
+
+ for (it = args.begin(); it != args.end(); ++it)
(*it)->Write(writer);
writer.WriteBool(distributedJoins);
@@ -304,7 +306,7 @@ namespace ignite
bool enforceJoinOrder;
/** Arguments. */
- std::vector<QueryArgumentBase*> args;
+ std::vector<impl::cache::query::QueryArgumentBase*> args;
};
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/15c97807/modules/platforms/cpp/core/include/ignite/impl/cache/query/query_argument.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/cache/query/query_argument.h b/modules/platforms/cpp/core/include/ignite/impl/cache/query/query_argument.h
new file mode 100644
index 0000000..f2f55bc
--- /dev/null
+++ b/modules/platforms/cpp/core/include/ignite/impl/cache/query/query_argument.h
@@ -0,0 +1,137 @@
+/*
+ * 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.
+ */
+
+/**
+ * @file
+ * Declares ignite::cache::query::QueryArgument class template and
+ * ignite::cache::query::QueryArgumentBase interface.
+ */
+
+#ifndef _IGNITE_IMPL_CACHE_QUERY_QUERY_ARGUMENT
+#define _IGNITE_IMPL_CACHE_QUERY_QUERY_ARGUMENT
+
+#include <ignite/binary/binary_raw_writer.h>
+
+namespace ignite
+{
+ namespace impl
+ {
+ namespace cache
+ {
+ namespace query
+ {
+ /**
+ * Base class for all query arguments.
+ */
+ class QueryArgumentBase
+ {
+ public:
+ /**
+ * Destructor.
+ */
+ virtual ~QueryArgumentBase()
+ {
+ // No-op.
+ }
+
+ /**
+ * Copy argument.
+ *
+ * @return Copy of this argument instance.
+ */
+ virtual QueryArgumentBase* Copy() const = 0;
+
+ /**
+ * Write argument using provided writer.
+ *
+ * @param writer Writer to use to write this argument.
+ */
+ virtual void Write(ignite::binary::BinaryRawWriter& writer) = 0;
+ };
+
+ /**
+ * Query argument class template.
+ *
+ * Template argument type should be copy-constructable and
+ * assignable. Also BinaryType class template should be specialized
+ * for this type.
+ */
+ template<typename T>
+ class QueryArgument : public QueryArgumentBase
+ {
+ public:
+ /**
+ * Constructor.
+ *
+ * @param val Value.
+ */
+ QueryArgument(const T& val) :
+ val(val)
+ {
+ // No-op.
+ }
+
+ /**
+ * Copy constructor.
+ *
+ * @param other Other instance.
+ */
+ QueryArgument(const QueryArgument& other) :
+ val(other.val)
+ {
+ // No-op.
+ }
+
+ /**
+ * Assignment operator.
+ *
+ * @param other Other instance.
+ * @return *this.
+ */
+ QueryArgument& operator=(const QueryArgument& other)
+ {
+ if (this != &other)
+ val = other.val;
+
+ return *this;
+ }
+
+ virtual ~QueryArgument()
+ {
+ // No-op.
+ }
+
+ virtual QueryArgumentBase* Copy() const
+ {
+ return new QueryArgument(val);
+ }
+
+ virtual void Write(ignite::binary::BinaryRawWriter& writer)
+ {
+ writer.WriteObject<T>(val);
+ }
+
+ private:
+ /** Value. */
+ T val;
+ };
+ }
+ }
+ }
+}
+
+#endif //_IGNITE_IMPL_CACHE_QUERY_QUERY_ARGUMENT
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/15c97807/modules/platforms/cpp/core/project/vs/core.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/project/vs/core.vcxproj b/modules/platforms/cpp/core/project/vs/core.vcxproj
index 9a5a80b..b490887 100644
--- a/modules/platforms/cpp/core/project/vs/core.vcxproj
+++ b/modules/platforms/cpp/core/project/vs/core.vcxproj
@@ -200,7 +200,6 @@
<ClInclude Include="..\..\include\ignite\cache\query\continuous\continuous_query_handle.h" />
<ClInclude Include="..\..\include\ignite\cache\mutable_cache_entry.h" />
<ClInclude Include="..\..\include\ignite\cache\query\query.h" />
- <ClInclude Include="..\..\include\ignite\cache\query\query_argument.h" />
<ClInclude Include="..\..\include\ignite\cache\query\query_cursor.h" />
<ClInclude Include="..\..\include\ignite\cache\query\query_fields_cursor.h" />
<ClInclude Include="..\..\include\ignite\cache\query\query_fields_row.h" />
@@ -215,6 +214,7 @@
<ClInclude Include="..\..\include\ignite\impl\binary\binary_type_updater_impl.h" />
<ClInclude Include="..\..\include\ignite\impl\cache\cache_entry_processor_holder.h" />
<ClInclude Include="..\..\include\ignite\impl\cache\cache_impl.h" />
+ <ClInclude Include="..\..\include\ignite\impl\cache\query\query_argument.h" />
<ClInclude Include="..\..\include\ignite\impl\cache\query\query_batch.h" />
<ClInclude Include="..\..\include\ignite\impl\cache\query\continuous\continuous_query_handle_impl.h" />
<ClInclude Include="..\..\include\ignite\impl\cache\query\continuous\continuous_query_impl.h" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/15c97807/modules/platforms/cpp/core/project/vs/core.vcxproj.filters
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/project/vs/core.vcxproj.filters b/modules/platforms/cpp/core/project/vs/core.vcxproj.filters
index fc58633..b75b3b2 100644
--- a/modules/platforms/cpp/core/project/vs/core.vcxproj.filters
+++ b/modules/platforms/cpp/core/project/vs/core.vcxproj.filters
@@ -87,9 +87,6 @@
<ClInclude Include="..\..\include\ignite\impl\cache\query\query_impl.h">
<Filter>Code\impl\cache\query</Filter>
</ClInclude>
- <ClInclude Include="..\..\include\ignite\cache\query\query_argument.h">
- <Filter>Code\cache\query</Filter>
- </ClInclude>
<ClInclude Include="..\..\include\ignite\cache\query\query_cursor.h">
<Filter>Code\cache\query</Filter>
</ClInclude>
@@ -192,6 +189,9 @@
<ClInclude Include="..\..\include\ignite\ignite_binding_context.h">
<Filter>Code</Filter>
</ClInclude>
+ <ClInclude Include="..\..\include\ignite\impl\cache\query\query_argument.h">
+ <Filter>Code\impl\cache\query</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="Code">
[28/33] ignite git commit: IGNITE-4830 Implemented better SQL errors
handling.
Posted by vo...@apache.org.
IGNITE-4830 Implemented better SQL errors handling.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/fbb99408
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/fbb99408
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/fbb99408
Branch: refs/heads/ignite-4565-ddl
Commit: fbb994081f13091b1442b0f882312341471dcc5a
Parents: 83579ce
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Tue Mar 21 10:20:39 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Tue Mar 21 10:20:39 2017 +0700
----------------------------------------------------------------------
.../frontend/app/modules/sql/sql.controller.js | 84 +++++++++++++++-----
.../web-console/frontend/views/sql/sql.tpl.pug | 9 ++-
.../frontend/views/templates/message.tpl.pug | 4 +-
3 files changed, 71 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/fbb99408/modules/web-console/frontend/app/modules/sql/sql.controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/sql/sql.controller.js b/modules/web-console/frontend/app/modules/sql/sql.controller.js
index 7ded2d5..a3a5a5f 100644
--- a/modules/web-console/frontend/app/modules/sql/sql.controller.js
+++ b/modules/web-console/frontend/app/modules/sql/sql.controller.js
@@ -18,7 +18,7 @@
import paragraphRateTemplateUrl from 'views/sql/paragraph-rate.tpl.pug';
import cacheMetadataTemplateUrl from 'views/sql/cache-metadata.tpl.pug';
import chartSettingsTemplateUrl from 'views/sql/chart-settings.tpl.pug';
-import showQueryTemplateUrl from 'views/templates/message.tpl.pug';
+import messageTemplateUrl from 'views/templates/message.tpl.pug';
// Time line X axis descriptor.
const TIME_LINE = {value: -1, type: 'java.sql.Date', label: 'TIME_LINE'};
@@ -53,7 +53,7 @@ const _fullColName = (col) => {
let paragraphId = 0;
class Paragraph {
- constructor($animate, $timeout, paragraph) {
+ constructor($animate, $timeout, JavaTypes, paragraph) {
const self = this;
self.id = 'paragraph-' + paragraphId++;
@@ -140,13 +140,36 @@ class Paragraph {
}});
Object.defineProperty(this, 'chartHistory', {value: []});
+
+ Object.defineProperty(this, 'error', {value: {
+ root: {},
+ message: ''
+ }});
+
+ this.setError = (err) => {
+ this.error.root = err;
+ this.error.message = err.message;
+
+ let cause = err;
+
+ while (_.nonNil(cause)) {
+ if (_.nonEmpty(cause.className) &&
+ _.includes(['SQLException', 'JdbcSQLException'], JavaTypes.shortClassName(cause.className))) {
+ this.error.message = cause.message;
+
+ break;
+ }
+
+ cause = cause.cause;
+ }
+ };
}
resultType() {
if (_.isNil(this.queryArgs))
return null;
- if (!_.isEmpty(this.errMsg))
+ if (_.nonEmpty(this.error.message))
return 'error';
if (_.isEmpty(this.rows))
@@ -172,7 +195,7 @@ class Paragraph {
}
queryExecuted() {
- return !_.isEmpty(this.meta) || !_.isEmpty(this.errMsg);
+ return _.nonEmpty(this.meta) || _.nonEmpty(this.error.message);
}
scanExplain() {
@@ -184,17 +207,17 @@ class Paragraph {
}
chartColumnsConfigured() {
- return !_.isEmpty(this.chartKeyCols) && !_.isEmpty(this.chartValCols);
+ return _.nonEmpty(this.chartKeyCols) && _.nonEmpty(this.chartValCols);
}
chartTimeLineEnabled() {
- return !_.isEmpty(this.chartKeyCols) && _.eq(this.chartKeyCols[0], TIME_LINE);
+ return _.nonEmpty(this.chartKeyCols) && _.eq(this.chartKeyCols[0], TIME_LINE);
}
}
// Controller for SQL notebook screen.
-export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval', '$animate', '$location', '$anchorScroll', '$state', '$filter', '$modal', '$popover', 'IgniteLoading', 'IgniteLegacyUtils', 'IgniteMessages', 'IgniteConfirm', 'IgniteAgentMonitor', 'IgniteChartColors', 'IgniteNotebook', 'IgniteNodes', 'uiGridExporterConstants', 'IgniteVersion', 'IgniteActivitiesData',
- function($root, $scope, $http, $q, $timeout, $interval, $animate, $location, $anchorScroll, $state, $filter, $modal, $popover, Loading, LegacyUtils, Messages, Confirm, agentMonitor, IgniteChartColors, Notebook, Nodes, uiGridExporterConstants, Version, ActivitiesData) {
+export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval', '$animate', '$location', '$anchorScroll', '$state', '$filter', '$modal', '$popover', 'IgniteLoading', 'IgniteLegacyUtils', 'IgniteMessages', 'IgniteConfirm', 'IgniteAgentMonitor', 'IgniteChartColors', 'IgniteNotebook', 'IgniteNodes', 'uiGridExporterConstants', 'IgniteVersion', 'IgniteActivitiesData', 'JavaTypes',
+ function($root, $scope, $http, $q, $timeout, $interval, $animate, $location, $anchorScroll, $state, $filter, $modal, $popover, Loading, LegacyUtils, Messages, Confirm, agentMonitor, IgniteChartColors, Notebook, Nodes, uiGridExporterConstants, Version, ActivitiesData, JavaTypes) {
const $ctrl = this;
// Define template urls.
@@ -909,7 +932,7 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
$scope.notebook.paragraphs = [];
$scope.notebook.paragraphs = _.map($scope.notebook.paragraphs,
- (paragraph) => new Paragraph($animate, $timeout, paragraph));
+ (paragraph) => new Paragraph($animate, $timeout, JavaTypes, paragraph));
if (_.isEmpty($scope.notebook.paragraphs))
$scope.addQuery();
@@ -981,7 +1004,7 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
ActivitiesData.post({ action: '/queries/add/query' });
- const paragraph = new Paragraph($animate, $timeout, {
+ const paragraph = new Paragraph($animate, $timeout, JavaTypes, {
name: 'Query' + (sz === 0 ? '' : sz),
query: '',
pageSize: $scope.pageSizes[1],
@@ -1009,7 +1032,7 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
ActivitiesData.post({ action: '/queries/add/scan' });
- const paragraph = new Paragraph($animate, $timeout, {
+ const paragraph = new Paragraph($animate, $timeout, JavaTypes, {
name: 'Scan' + (sz === 0 ? '' : sz),
query: '',
pageSize: $scope.pageSizes[1],
@@ -1246,7 +1269,7 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
paragraph.resNodeId = res.responseNodeId;
- delete paragraph.errMsg;
+ paragraph.setError({message: ''});
// Prepare explain results for display in table.
if (paragraph.queryArgs.query && paragraph.queryArgs.query.startsWith('EXPLAIN') && res.rows) {
@@ -1341,7 +1364,7 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
.then((nid) => agentMonitor.query(nid, args.cacheName, args.query, args.nonCollocatedJoins,
args.enforceJoinOrder, !!args.localNid, args.pageSize))
.then(_processQueryResult.bind(this, paragraph, false))
- .catch((err) => paragraph.errMsg = err.message);
+ .catch((err) => paragraph.setError(err));
};
const _tryStartRefresh = function(paragraph) {
@@ -1419,7 +1442,7 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
_tryStartRefresh(paragraph);
})
.catch((err) => {
- paragraph.errMsg = err.message;
+ paragraph.setError(err);
_showLoading(paragraph, false);
@@ -1468,7 +1491,7 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
})
.then(_processQueryResult.bind(this, paragraph, true))
.catch((err) => {
- paragraph.errMsg = err.message;
+ paragraph.setError(err);
_showLoading(paragraph, false);
})
@@ -1506,7 +1529,7 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
})
.then((res) => _processQueryResult(paragraph, true, res))
.catch((err) => {
- paragraph.errMsg = err.message;
+ paragraph.setError(err);
_showLoading(paragraph, false);
});
@@ -1560,7 +1583,7 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
delete paragraph.queryId;
})
.catch((err) => {
- paragraph.errMsg = err.message;
+ paragraph.setError(err);
_showLoading(paragraph, false);
})
@@ -1756,15 +1779,36 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
}
else if (paragraph.queryArgs.query .startsWith('EXPLAIN ')) {
scope.title = 'Explain query';
- scope.content = [paragraph.queryArgs.query];
+ scope.content = paragraph.queryArgs.query.split(/\r?\n/);
}
else {
scope.title = 'SQL query';
- scope.content = [paragraph.queryArgs.query];
+ scope.content = paragraph.queryArgs.query.split(/\r?\n/);
+ }
+
+ // Show a basic modal from a controller
+ $modal({scope, templateUrl: messageTemplateUrl, placement: 'center', show: true});
+ }
+ };
+
+ $scope.showStackTrace = function(paragraph) {
+ if (!_.isNil(paragraph)) {
+ const scope = $scope.$new();
+
+ scope.title = 'Error details';
+ scope.content = [];
+
+ let cause = paragraph.error.root;
+
+ while (_.nonNil(cause)) {
+ scope.content.push((scope.content.length > 0 ? ' ' : '') +
+ '[' + JavaTypes.shortClassName(cause.className) + '] ' + cause.message);
+
+ cause = cause.cause;
}
// Show a basic modal from a controller
- $modal({scope, templateUrl: showQueryTemplateUrl, placement: 'center', show: true});
+ $modal({scope, templateUrl: messageTemplateUrl, placement: 'center', show: true});
}
};
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fbb99408/modules/web-console/frontend/views/sql/sql.tpl.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/sql/sql.tpl.pug b/modules/web-console/frontend/views/sql/sql.tpl.pug
index bc134a6..701ee14 100644
--- a/modules/web-console/frontend/views/sql/sql.tpl.pug
+++ b/modules/web-console/frontend/views/sql/sql.tpl.pug
@@ -199,7 +199,7 @@ mixin paragraph-scan
| Scan on selected node
.col-sm-12.sql-result(ng-if='paragraph.queryExecuted()' ng-switch='paragraph.resultType()')
- .error(ng-switch-when='error') Error: {{paragraph.errMsg}}
+ .error(ng-switch-when='error') Error: {{paragraph.error.message}}
.empty(ng-switch-when='empty') Result set is empty
.table(ng-switch-when='table')
+table-result-heading-scan
@@ -247,7 +247,7 @@ mixin paragraph-query
.pull-right
+query-settings
.col-sm-12.sql-result(ng-if='paragraph.queryExecuted()' ng-switch='paragraph.resultType()')
- .error(ng-switch-when='error') Error: {{paragraph.errMsg}}
+ .error(ng-switch-when='error') Error: {{paragraph.error.message}}
.empty(ng-switch-when='empty') Result set is empty
.table(ng-switch-when='table')
+table-result-heading-query
@@ -255,9 +255,10 @@ mixin paragraph-query
.chart(ng-switch-when='chart')
+chart-result
.footer.clearfix
- a.pull-left(ng-click='showResultQuery(paragraph)') Show query
+ a.pull-left(ng-show='paragraph.resultType() === "error"' ng-click='showStackTrace(paragraph)') Show error details
+ a.pull-left(ng-show='paragraph.resultType() !== "error"' ng-click='showResultQuery(paragraph)') Show query
- -var nextVisibleCondition = 'paragraph.resultType() != "error" && paragraph.queryId && paragraph.nonRefresh() && (paragraph.table() || paragraph.chart() && !paragraph.scanExplain())'
+ -var nextVisibleCondition = 'paragraph.resultType() !== "error" && paragraph.queryId && paragraph.nonRefresh() && (paragraph.table() || paragraph.chart() && !paragraph.scanExplain())'
.pull-right(ng-show=`${nextVisibleCondition}` ng-class='{disabled: paragraph.loading}' ng-click='!paragraph.loading && nextPage(paragraph)')
i.fa.fa-chevron-circle-right
http://git-wip-us.apache.org/repos/asf/ignite/blob/fbb99408/modules/web-console/frontend/views/templates/message.tpl.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/templates/message.tpl.pug b/modules/web-console/frontend/views/templates/message.tpl.pug
index 6eff74b..aa3615f 100644
--- a/modules/web-console/frontend/views/templates/message.tpl.pug
+++ b/modules/web-console/frontend/views/templates/message.tpl.pug
@@ -22,7 +22,7 @@
h4.modal-title
i.fa.fa-info-circle
| {{title}}
- .modal-body(ng-show='content')
- p(ng-bind-html='content.join("<br/>")' style='text-align: left;')
+ .modal-body(ng-show='content' style='overflow: auto; max-height: 300px;')
+ p(ng-bind-html='content.join("<br/>")' style='text-align: left; white-space: nowrap;')
.modal-footer
button.btn.btn-primary(id='confirm-btn-confirm' ng-click='$hide()') Ok
[09/33] ignite git commit: Implemented support for enforce join order
flag. (cherry picked from commit a7f77d4)
Posted by vo...@apache.org.
Implemented support for enforce join order flag.
(cherry picked from commit a7f77d4)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/57362479
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/57362479
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/57362479
Branch: refs/heads/ignite-4565-ddl
Commit: 573624796b171b2420b87657598198f40a91f6bb
Parents: 9fcb3e7
Author: Alexey Kuznetsov <ak...@gridgain.com>
Authored: Wed Mar 1 22:09:40 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Thu Mar 2 10:07:25 2017 +0700
----------------------------------------------------------------------
.../internal/visor/query/VisorQueryArgV3.java | 51 ++++++++++++++++++++
.../internal/visor/query/VisorQueryJob.java | 6 +--
.../resources/META-INF/classnames.properties | 1 +
3 files changed, 55 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/57362479/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryArgV3.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryArgV3.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryArgV3.java
new file mode 100644
index 0000000..f32c00a
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryArgV3.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.visor.query;
+
+/**
+ * Arguments for {@link VisorQueryTask}.
+ */
+public class VisorQueryArgV3 extends VisorQueryArgV2 {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Enforce join order flag. */
+ private final boolean enforceJoinOrder;
+
+ /**
+ * @param cacheName Cache name for query.
+ * @param qryTxt Query text.
+ * @param distributedJoins If {@code true} then distributed joins enabled.
+ * @param enforceJoinOrder If {@code true} then enforce join order.
+ * @param loc Flag whether to execute query locally.
+ * @param pageSize Result batch size.
+ */
+ public VisorQueryArgV3(String cacheName, String qryTxt,
+ boolean distributedJoins, boolean enforceJoinOrder, boolean loc, int pageSize) {
+ super(cacheName, qryTxt, distributedJoins, loc, pageSize);
+
+ this.enforceJoinOrder = enforceJoinOrder;
+ }
+
+ /**
+ * @return Enforce join order flag.
+ */
+ public boolean enforceJoinOrder() {
+ return enforceJoinOrder;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/57362479/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java
index c66b2dd..1ac90ad 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java
@@ -131,9 +131,8 @@ public class VisorQueryJob extends VisorJob<VisorQueryArg, IgniteBiTuple<? exten
if (scanWithFilter) {
boolean caseSensitive = qryTxt.startsWith(SCAN_CACHE_WITH_FILTER_CASE_SENSITIVE);
- String ptrn = caseSensitive
- ? qryTxt.substring(SCAN_CACHE_WITH_FILTER_CASE_SENSITIVE.length())
- : qryTxt.substring(SCAN_CACHE_WITH_FILTER.length());
+ String ptrn = qryTxt.substring(
+ caseSensitive ? SCAN_CACHE_WITH_FILTER_CASE_SENSITIVE.length() : SCAN_CACHE_WITH_FILTER.length());
filter = new VisorQueryScanSubstringFilter(caseSensitive, ptrn);
}
@@ -162,6 +161,7 @@ public class VisorQueryJob extends VisorJob<VisorQueryArg, IgniteBiTuple<? exten
qry.setPageSize(arg.pageSize());
qry.setLocal(arg.local());
qry.setDistributedJoins(arg instanceof VisorQueryArgV2 && ((VisorQueryArgV2)arg).distributedJoins());
+ qry.setEnforceJoinOrder(arg instanceof VisorQueryArgV3 && ((VisorQueryArgV3)arg).enforceJoinOrder());
long start = U.currentTimeMillis();
http://git-wip-us.apache.org/repos/asf/ignite/blob/57362479/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties
index 8a6dc66..db486a5 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -1792,6 +1792,7 @@ org.apache.ignite.internal.visor.node.VisorSpisConfiguration
org.apache.ignite.internal.visor.node.VisorTransactionConfiguration
org.apache.ignite.internal.visor.query.VisorQueryArg
org.apache.ignite.internal.visor.query.VisorQueryArgV2
+org.apache.ignite.internal.visor.query.VisorQueryArgV3
org.apache.ignite.internal.visor.query.VisorQueryCleanupTask
org.apache.ignite.internal.visor.query.VisorQueryCleanupTask$VisorQueryCleanupJob
org.apache.ignite.internal.visor.query.VisorQueryField
[32/33] ignite git commit: Compilation fixes after merge.
Posted by vo...@apache.org.
Compilation fixes after merge.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/92beda22
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/92beda22
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/92beda22
Branch: refs/heads/ignite-4565-ddl
Commit: 92beda22f0bed33035584c79f99a90a1f5d97f46
Parents: 7e6f214
Author: devozerov <vo...@gridgain.com>
Authored: Tue Mar 21 11:15:09 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Tue Mar 21 11:15:09 2017 +0300
----------------------------------------------------------------------
.../processors/cache/IncorrectCacheTypeMetadataTest.java | 4 ++--
.../internal/processors/cache/IncorrectQueryEntityTest.java | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/92beda22/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IncorrectCacheTypeMetadataTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IncorrectCacheTypeMetadataTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IncorrectCacheTypeMetadataTest.java
index 4178cde..9695ffb 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IncorrectCacheTypeMetadataTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IncorrectCacheTypeMetadataTest.java
@@ -23,7 +23,7 @@ import java.util.Map;
import org.apache.ignite.cache.CacheTypeMetadata;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.processors.query.GridQueryProcessor;
+import org.apache.ignite.internal.processors.query.QueryUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
/**
@@ -63,7 +63,7 @@ public class IncorrectCacheTypeMetadataTest extends GridCommonAbstractTest {
}
catch (Exception exception) {
if (!exception.getMessage().contains(
- GridQueryProcessor.propertyInitializationExceptionMessage(
+ QueryUtils.propertyInitializationExceptionMessage(
Object.class, Object.class, "exceptionOid", Object.class))) {
fail("property initialization exception must be thrown, but got " + exception.getMessage());
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/92beda22/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IncorrectQueryEntityTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IncorrectQueryEntityTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IncorrectQueryEntityTest.java
index 5d89a58..9bdadc6 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IncorrectQueryEntityTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IncorrectQueryEntityTest.java
@@ -23,7 +23,7 @@ import java.util.Set;
import org.apache.ignite.cache.QueryEntity;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.processors.query.GridQueryProcessor;
+import org.apache.ignite.internal.processors.query.QueryUtils;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
@@ -66,7 +66,7 @@ public class IncorrectQueryEntityTest extends GridCommonAbstractTest {
}
catch (Exception exception) {
if (!exception.getMessage().contains(
- GridQueryProcessor.propertyInitializationExceptionMessage(
+ QueryUtils.propertyInitializationExceptionMessage(
Object.class, Object.class, "exceptionOid", Object.class))) {
fail("property initialization exception must be thrown, but got " + exception.getMessage());
}
[05/33] ignite git commit: IGNITE-4436 API for collecting list of
running queries and cancel them. (cherry picked from commit
49237343d53ee33d44e5599cd7fe7da868ee30a1)
Posted by vo...@apache.org.
IGNITE-4436 API for collecting list of running queries and cancel them.
(cherry picked from commit 49237343d53ee33d44e5599cd7fe7da868ee30a1)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/11bbec48
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/11bbec48
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/11bbec48
Branch: refs/heads/ignite-4565-ddl
Commit: 11bbec487dc174fac1acd6b50c940840305bc75a
Parents: 382fbc9
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Fri Feb 17 17:57:50 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Feb 17 17:57:50 2017 +0700
----------------------------------------------------------------------
.../cache/query/GridCacheTwoStepQuery.java | 18 +-
.../processors/query/GridQueryIndexing.java | 17 +-
.../processors/query/GridQueryProcessor.java | 26 ++-
.../processors/query/GridRunningQueryInfo.java | 132 ++++++++++++
.../internal/visor/VisorMultiNodeTask.java | 2 +-
.../visor/query/VisorCancelQueriesTask.java | 72 +++++++
.../query/VisorCollectRunningQueriesTask.java | 96 +++++++++
.../internal/visor/query/VisorRunningQuery.java | 132 ++++++++++++
.../processors/query/h2/IgniteH2Indexing.java | 83 +++++++-
.../query/h2/sql/GridSqlQuerySplitter.java | 4 +-
.../h2/twostep/GridReduceQueryExecutor.java | 60 +++++-
.../cache/CacheSqlQueryValueCopySelfTest.java | 208 +++++++++++++++++--
.../cache/GridCacheCrossCacheQuerySelfTest.java | 2 +-
.../h2/GridIndexingSpiAbstractSelfTest.java | 7 +
14 files changed, 821 insertions(+), 38 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/11bbec48/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
index 8dcba2f..f53936f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheTwoStepQuery.java
@@ -46,6 +46,9 @@ public class GridCacheTwoStepQuery {
private boolean explain;
/** */
+ private String originalSql;
+
+ /** */
private Collection<String> spaces;
/** */
@@ -67,10 +70,12 @@ public class GridCacheTwoStepQuery {
private List<Integer> extraCaches;
/**
+ * @param originalSql Original query SQL.
* @param schemas Schema names in query.
* @param tbls Tables in query.
*/
- public GridCacheTwoStepQuery(Set<String> schemas, Set<String> tbls) {
+ public GridCacheTwoStepQuery(String originalSql, Set<String> schemas, Set<String> tbls) {
+ this.originalSql = originalSql;
this.schemas = schemas;
this.tbls = tbls;
}
@@ -196,6 +201,13 @@ public class GridCacheTwoStepQuery {
}
/**
+ * @return Original query SQL.
+ */
+ public String originalSql() {
+ return originalSql;
+ }
+
+ /**
* @return Spaces.
*/
public Collection<String> spaces() {
@@ -223,7 +235,7 @@ public class GridCacheTwoStepQuery {
public GridCacheTwoStepQuery copy(Object[] args) {
assert !explain;
- GridCacheTwoStepQuery cp = new GridCacheTwoStepQuery(schemas, tbls);
+ GridCacheTwoStepQuery cp = new GridCacheTwoStepQuery(originalSql, schemas, tbls);
cp.caches = caches;
cp.extraCaches = extraCaches;
@@ -250,4 +262,4 @@ public class GridCacheTwoStepQuery {
@Override public String toString() {
return S.toString(GridCacheTwoStepQuery.class, this);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/11bbec48/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
index 539ebc0..1cebbb0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
@@ -224,7 +224,22 @@ public interface GridQueryIndexing {
public void onDisconnected(IgniteFuture<?> reconnectFut);
/**
+ * Collect queries that already running more than specified duration.
+ *
+ * @param duration Duration to check.
+ * @return Collection of long running queries.
+ */
+ public Collection<GridRunningQueryInfo> runningQueries(long duration);
+
+ /**
+ * Cancel specified queries.
+ *
+ * @param queries Queries ID's to cancel.
+ */
+ public void cancelQueries(Collection<Long> queries);
+
+ /**
* Cancels all executing queries.
*/
public void cancelAllQueries();
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/11bbec48/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index c2e5717..0a0d166 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -44,7 +44,6 @@ import javax.cache.Cache;
import javax.cache.CacheException;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
-import org.apache.ignite.IgniteSystemProperties;
import org.apache.ignite.binary.BinaryField;
import org.apache.ignite.binary.BinaryObject;
import org.apache.ignite.binary.BinaryType;
@@ -118,7 +117,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
private static final int QRY_DETAIL_METRICS_EVICTION_FREQ = 3_000;
/** */
- private static Set<Class<?>> SQL_TYPES = new HashSet<>(F.<Class<?>>asList(
+ private static final Set<Class<?>> SQL_TYPES = new HashSet<>(F.<Class<?>>asList(
Integer.class,
Boolean.class,
Byte.class,
@@ -913,6 +912,29 @@ public class GridQueryProcessor extends GridProcessorAdapter {
}
/**
+ * Collect queries that already running more than specified duration.
+ *
+ * @param duration Duration to check.
+ * @return Collection of long running queries.
+ */
+ public Collection<GridRunningQueryInfo> runningQueries(long duration) {
+ if (moduleEnabled())
+ return idx.runningQueries(duration);
+
+ return Collections.emptyList();
+ }
+
+ /**
+ * Cancel specified queries.
+ *
+ * @param queries Queries ID's to cancel.
+ */
+ public void cancelQueries(Collection<Long> queries) {
+ if (moduleEnabled())
+ idx.cancelQueries(queries);
+ }
+
+ /**
* @param sqlQry Sql query.
* @param params Params.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/11bbec48/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridRunningQueryInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridRunningQueryInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridRunningQueryInfo.java
new file mode 100644
index 0000000..d77c8c0
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridRunningQueryInfo.java
@@ -0,0 +1,132 @@
+/*
+ * 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.internal.processors.cache.query.GridCacheQueryType;
+
+/**
+ * Query descriptor.
+ */
+public class GridRunningQueryInfo {
+ /** */
+ private final long id;
+
+ /** */
+ private final String qry;
+
+ /** Query type. */
+ private final GridCacheQueryType qryType;
+
+ /** */
+ private final String cache;
+
+ /** */
+ private final long startTime;
+
+ /** */
+ private final GridQueryCancel cancel;
+
+ /** */
+ private final boolean loc;
+
+ /**
+ * @param id Query ID.
+ * @param qry Query text.
+ * @param qryType Query type.
+ * @param cache Cache where query was executed.
+ * @param startTime Query start time.
+ * @param cancel Query cancel.
+ * @param loc Local query flag.
+ */
+ public GridRunningQueryInfo(Long id, String qry, GridCacheQueryType qryType, String cache, long startTime,
+ GridQueryCancel cancel, boolean loc) {
+ this.id = id;
+ this.qry = qry;
+ this.qryType = qryType;
+ this.cache = cache;
+ this.startTime = startTime;
+ this.cancel = cancel;
+ this.loc = loc;
+ }
+
+ /**
+ * @return Query ID.
+ */
+ public Long id() {
+ return id;
+ }
+
+ /**
+ * @return Query text.
+ */
+ public String query() {
+ return qry;
+ }
+
+ /**
+ * @return Query type.
+ */
+ public GridCacheQueryType queryType() {
+ return qryType;
+ }
+
+ /**
+ * @return Cache where query was executed.
+ */
+ public String cache() {
+ return cache;
+ }
+
+ /**
+ * @return Query start time.
+ */
+ public long startTime() {
+ return startTime;
+ }
+
+ /**
+ * @param curTime Current time.
+ * @param duration Duration of long query.
+ * @return {@code true} if this query should be considered as long running query.
+ */
+ public boolean longQuery(long curTime, long duration) {
+ return curTime - startTime > duration;
+ }
+
+ /**
+ * Cancel query.
+ */
+ public void cancel() {
+ if (cancel != null)
+ cancel.cancel();
+ }
+
+ /**
+ * @return {@code true} if query can be cancelled.
+ */
+ public boolean cancelable() {
+ return cancel != null;
+ }
+
+ /**
+ * @return {@code true} if query is local.
+ */
+ public boolean local() {
+ return loc;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/11bbec48/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorMultiNodeTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorMultiNodeTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorMultiNodeTask.java
index 57f1346..ece1a17 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorMultiNodeTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/VisorMultiNodeTask.java
@@ -130,4 +130,4 @@ public abstract class VisorMultiNodeTask<A, R, J> implements ComputeTask<VisorTa
logFinish(ignite.log(), getClass(), start);
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/11bbec48/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorCancelQueriesTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorCancelQueriesTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorCancelQueriesTask.java
new file mode 100644
index 0000000..a6f2d82
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorCancelQueriesTask.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.visor.query;
+
+import java.util.Collection;
+import java.util.List;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.compute.ComputeJobResult;
+import org.apache.ignite.internal.processors.task.GridInternal;
+import org.apache.ignite.internal.visor.VisorJob;
+import org.apache.ignite.internal.visor.VisorOneNodeTask;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Task to cancel queries.
+ */
+@GridInternal
+public class VisorCancelQueriesTask extends VisorOneNodeTask<Collection<Long>, Void> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** {@inheritDoc} */
+ @Override protected VisorCancelQueriesJob job(Collection<Long> arg) {
+ return new VisorCancelQueriesJob(arg, debug);
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override protected Void reduce0(List<ComputeJobResult> results) throws IgniteException {
+ return null;
+ }
+
+ /**
+ * Job to cancel queries on node.
+ */
+ private static class VisorCancelQueriesJob extends VisorJob<Collection<Long>, Void> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * Create job with specified argument.
+ *
+ * @param arg Job argument.
+ * @param debug Flag indicating whether debug information should be printed into node log.
+ */
+ protected VisorCancelQueriesJob(@Nullable Collection<Long> arg, boolean debug) {
+ super(arg, debug);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected Void run(@Nullable Collection<Long> queries) throws IgniteException {
+ ignite.context().query().cancelQueries(queries);
+
+ return null;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/11bbec48/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorCollectRunningQueriesTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorCollectRunningQueriesTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorCollectRunningQueriesTask.java
new file mode 100644
index 0000000..2b40e61
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorCollectRunningQueriesTask.java
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.visor.query;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.compute.ComputeJobResult;
+import org.apache.ignite.internal.processors.query.GridRunningQueryInfo;
+import org.apache.ignite.internal.processors.task.GridInternal;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorJob;
+import org.apache.ignite.internal.visor.VisorMultiNodeTask;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Task to collect currently running queries.
+ */
+@GridInternal
+public class VisorCollectRunningQueriesTask extends VisorMultiNodeTask<Long, Map<UUID, Collection<VisorRunningQuery>>, Collection<VisorRunningQuery>> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** {@inheritDoc} */
+ @Override protected VisorCollectRunningQueriesJob job(Long arg) {
+ return new VisorCollectRunningQueriesJob(arg, debug);
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override protected Map<UUID, Collection<VisorRunningQuery>> reduce0(List<ComputeJobResult> results) throws IgniteException {
+ Map<UUID, Collection<VisorRunningQuery>> map = new HashMap<>();
+
+ for (ComputeJobResult res : results)
+ if (res.getException() == null) {
+ Collection<VisorRunningQuery> queries = res.getData();
+
+ map.put(res.getNode().id(), queries);
+ }
+
+ return map;
+ }
+
+ /**
+ * Job to collect currently running queries from node.
+ */
+ private static class VisorCollectRunningQueriesJob extends VisorJob<Long, Collection<VisorRunningQuery>> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * Create job with specified argument.
+ *
+ * @param arg Job argument.
+ * @param debug Flag indicating whether debug information should be printed into node log.
+ */
+ protected VisorCollectRunningQueriesJob(@Nullable Long arg, boolean debug) {
+ super(arg, debug);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected Collection<VisorRunningQuery> run(@Nullable Long duration) throws IgniteException {
+ Collection<GridRunningQueryInfo> queries = ignite.context().query()
+ .runningQueries(duration != null ? duration : 0);
+
+ Collection<VisorRunningQuery> res = new ArrayList<>(queries.size());
+
+ long curTime = U.currentTimeMillis();
+
+ for (GridRunningQueryInfo qry : queries)
+ res.add(new VisorRunningQuery(qry.id(), qry.query(), qry.queryType(), qry.cache(),
+ qry.startTime(), curTime - qry.startTime(),
+ qry.cancelable(), qry.local()));
+
+ return res;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/11bbec48/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorRunningQuery.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorRunningQuery.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorRunningQuery.java
new file mode 100644
index 0000000..fc6bc7a
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorRunningQuery.java
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.visor.query;
+
+import java.io.Serializable;
+import org.apache.ignite.internal.processors.cache.query.GridCacheQueryType;
+
+/**
+ * Descriptor of running query.
+ */
+public class VisorRunningQuery implements Serializable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private long id;
+
+ /** Query text. */
+ private String qry;
+
+ /** Query type. */
+ private GridCacheQueryType qryType;
+
+ /** Cache name for query. */
+ private String cache;
+
+ /** */
+ private long startTime;
+
+ /** */
+ private long duration;
+
+ /** */
+ private boolean cancellable;
+
+ /** */
+ private boolean loc;
+
+ /**
+ * @param id Query ID.
+ * @param qry Query text.
+ * @param qryType Query type.
+ * @param cache Cache where query was executed.
+ * @param startTime Query start time.
+ * @param duration Query current duration.
+ * @param cancellable {@code true} if query can be canceled.
+ * @param loc {@code true} if query is local.
+ */
+ public VisorRunningQuery(long id, String qry, GridCacheQueryType qryType, String cache,
+ long startTime, long duration,
+ boolean cancellable, boolean loc) {
+ this.id = id;
+ this.qry = qry;
+ this.qryType = qryType;
+ this.cache = cache;
+ this.startTime = startTime;
+ this.duration = duration;
+ this.cancellable = cancellable;
+ this.loc = loc;
+ }
+
+ /**
+ * @return Query ID.
+ */
+ public long getId() {
+ return id;
+ }
+
+ /**
+ * @return Query txt.
+ */
+ public String getQuery() {
+ return qry;
+ }
+
+ /**
+ * @return Query type.
+ */
+ public GridCacheQueryType getQueryType() {
+ return qryType;
+ }
+
+ /**
+ * @return Cache name.
+ */
+ public String getCache() {
+ return cache;
+ }
+
+ /**
+ * @return Query start time.
+ */
+ public long getStartTime() {
+ return startTime;
+ }
+
+ /**
+ * @return Query duration.
+ */
+ public long getDuration() {
+ return duration;
+ }
+
+ /**
+ * @return {@code true} if query can be cancelled.
+ */
+ public boolean isCancelable() {
+ return cancellable;
+ }
+
+ /**
+ * @return {@code true} if query is local.
+ */
+ public boolean isLocal() {
+ return loc;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/11bbec48/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index cbf2ebd..62b47b8 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -52,6 +52,7 @@ import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicLong;
import javax.cache.Cache;
import javax.cache.CacheException;
import org.apache.ignite.IgniteCheckedException;
@@ -79,6 +80,7 @@ import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
import org.apache.ignite.internal.processors.cache.QueryCursorImpl;
import org.apache.ignite.internal.processors.cache.query.GridCacheQueryMarshallable;
import org.apache.ignite.internal.processors.cache.query.GridCacheTwoStepQuery;
+import org.apache.ignite.internal.processors.query.GridRunningQueryInfo;
import org.apache.ignite.internal.processors.query.GridQueryCancel;
import org.apache.ignite.internal.processors.query.GridQueryFieldMetadata;
import org.apache.ignite.internal.processors.query.GridQueryFieldsResult;
@@ -172,6 +174,9 @@ import static org.apache.ignite.IgniteSystemProperties.IGNITE_H2_DEBUG_CONSOLE;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_H2_INDEXING_CACHE_CLEANUP_PERIOD;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_H2_INDEXING_CACHE_THREAD_USAGE_TIMEOUT;
import static org.apache.ignite.IgniteSystemProperties.getString;
+import static org.apache.ignite.internal.processors.cache.query.GridCacheQueryType.SQL;
+import static org.apache.ignite.internal.processors.cache.query.GridCacheQueryType.SQL_FIELDS;
+import static org.apache.ignite.internal.processors.cache.query.GridCacheQueryType.TEXT;
import static org.apache.ignite.internal.processors.query.GridQueryIndexType.FULLTEXT;
import static org.apache.ignite.internal.processors.query.GridQueryIndexType.GEO_SPATIAL;
import static org.apache.ignite.internal.processors.query.GridQueryIndexType.SORTED;
@@ -279,9 +284,15 @@ public class IgniteH2Indexing implements GridQueryIndexing {
private final Map<String, String> space2schema = new ConcurrentHashMap8<>();
/** */
+ private AtomicLong qryIdGen;
+
+ /** */
private GridSpinBusyLock busyLock;
/** */
+ private final ConcurrentMap<Long, GridRunningQueryInfo> runs = new ConcurrentHashMap8<>();
+
+ /** */
private final ThreadLocal<ConnectionWrapper> connCache = new ThreadLocal<ConnectionWrapper>() {
@Nullable @Override public ConnectionWrapper get() {
ConnectionWrapper c = super.get();
@@ -751,8 +762,19 @@ public class IgniteH2Indexing implements GridQueryIndexing {
IndexingQueryFilter filters) throws IgniteCheckedException {
TableDescriptor tbl = tableDescriptor(spaceName, type);
- if (tbl != null && tbl.luceneIdx != null)
- return tbl.luceneIdx.query(qry, filters);
+ if (tbl != null && tbl.luceneIdx != null) {
+ GridRunningQueryInfo run = new GridRunningQueryInfo(qryIdGen.incrementAndGet(), qry, TEXT, spaceName,
+ U.currentTimeMillis(), null, true);
+
+ try {
+ runs.put(run.id(), run);
+
+ return tbl.luceneIdx.query(qry, filters);
+ }
+ finally {
+ runs.remove(run.id());
+ }
+ }
return new GridEmptyCloseableIterator<>();
}
@@ -796,6 +818,11 @@ public class IgniteH2Indexing implements GridQueryIndexing {
GridH2QueryContext.set(ctx);
+ GridRunningQueryInfo run = new GridRunningQueryInfo(qryIdGen.incrementAndGet(), qry, SQL_FIELDS,
+ spaceName, U.currentTimeMillis(), cancel, true);
+
+ runs.putIfAbsent(run.id(), run);
+
try {
ResultSet rs = executeSqlQueryWithTimer(spaceName, stmt, conn, qry, params, timeout, cancel);
@@ -803,6 +830,8 @@ public class IgniteH2Indexing implements GridQueryIndexing {
}
finally {
GridH2QueryContext.clearThreadLocal();
+
+ runs.remove(run.id());
}
}
};
@@ -1061,6 +1090,11 @@ public class IgniteH2Indexing implements GridQueryIndexing {
GridH2QueryContext.set(new GridH2QueryContext(nodeId, nodeId, 0, LOCAL).filter(filter).distributedJoins(false));
+ GridRunningQueryInfo run = new GridRunningQueryInfo(qryIdGen.incrementAndGet(), qry, SQL, spaceName,
+ U.currentTimeMillis(), null, true);
+
+ runs.put(run.id(), run);
+
try {
ResultSet rs = executeSqlQueryWithTimer(spaceName, conn, sql, params, true, 0, null);
@@ -1068,6 +1102,8 @@ public class IgniteH2Indexing implements GridQueryIndexing {
}
finally {
GridH2QueryContext.clearThreadLocal();
+
+ runs.remove(run.id());
}
}
@@ -1692,6 +1728,8 @@ public class IgniteH2Indexing implements GridQueryIndexing {
this.busyLock = busyLock;
+ qryIdGen = new AtomicLong();
+
if (SysProperties.serializeJavaObject) {
U.warn(log, "Serialization of Java objects in H2 was enabled.");
@@ -1742,7 +1780,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
marshaller = ctx.config().getMarshaller();
mapQryExec = new GridMapQueryExecutor(busyLock);
- rdcQryExec = new GridReduceQueryExecutor(busyLock);
+ rdcQryExec = new GridReduceQueryExecutor(qryIdGen, busyLock);
mapQryExec.start(ctx, this);
rdcQryExec.start(ctx, this);
@@ -2196,6 +2234,37 @@ public class IgniteH2Indexing implements GridQueryIndexing {
return cols;
}
+
+ /** {@inheritDoc} */
+ @Override public Collection<GridRunningQueryInfo> runningQueries(long duration) {
+ Collection<GridRunningQueryInfo> res = new ArrayList<>();
+
+ res.addAll(runs.values());
+ res.addAll(rdcQryExec.longRunningQueries(duration));
+
+ return res;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void cancelQueries(Collection<Long> queries) {
+ if (!F.isEmpty(queries)) {
+ for (Long qryId : queries) {
+ GridRunningQueryInfo run = runs.get(qryId);
+
+ if (run != null)
+ run.cancel();
+ }
+
+ rdcQryExec.cancelQueries(queries);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void cancelAllQueries() {
+ for (Connection conn : conns)
+ U.close(conn, log);
+ }
+
/**
* Wrapper to store connection and flag is schema set or not.
*/
@@ -3086,10 +3155,4 @@ public class IgniteH2Indexing implements GridQueryIndexing {
lastUsage = U.currentTimeMillis();
}
}
-
- /** {@inheritDoc} */
- @Override public void cancelAllQueries() {
- for (Connection conn : conns)
- U.close(conn, log);
- }
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/11bbec48/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 7d43bf6..8284c45 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
@@ -170,7 +170,7 @@ public class GridSqlQuerySplitter {
qry = collectAllTables(qry, schemas, tbls);
// Build resulting two step query.
- GridCacheTwoStepQuery res = new GridCacheTwoStepQuery(schemas, tbls);
+ GridCacheTwoStepQuery res = new GridCacheTwoStepQuery(qry.getSQL(), schemas, tbls);
// Map query will be direct reference to the original query AST.
// Thus all the modifications will be performed on the original AST, so we should be careful when
@@ -954,4 +954,4 @@ public class GridSqlQuerySplitter {
private static GridSqlFunction function(GridSqlFunctionType type) {
return new GridSqlFunction(type);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/11bbec48/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
index 40b11973..3f886ee 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
@@ -62,6 +62,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartit
import org.apache.ignite.internal.processors.cache.query.GridCacheQueryMarshallable;
import org.apache.ignite.internal.processors.cache.query.GridCacheSqlQuery;
import org.apache.ignite.internal.processors.cache.query.GridCacheTwoStepQuery;
+import org.apache.ignite.internal.processors.query.GridRunningQueryInfo;
import org.apache.ignite.internal.processors.query.GridQueryCacheObjectsIterator;
import org.apache.ignite.internal.processors.query.GridQueryCancel;
import org.apache.ignite.internal.processors.query.h2.GridH2ResultSetIterator;
@@ -99,6 +100,7 @@ import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentHashMap8;
import static org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion.NONE;
+import static org.apache.ignite.internal.processors.cache.query.GridCacheQueryType.SQL_FIELDS;
import static org.apache.ignite.internal.processors.query.h2.opt.GridH2QueryType.REDUCE;
/**
@@ -121,7 +123,7 @@ public class GridReduceQueryExecutor {
private IgniteLogger log;
/** */
- private final AtomicLong reqIdGen = new AtomicLong();
+ private final AtomicLong qryIdGen;
/** */
private final ConcurrentMap<Long, QueryRun> runs = new ConcurrentHashMap8<>();
@@ -168,9 +170,11 @@ public class GridReduceQueryExecutor {
};
/**
+ * @param qryIdGen Query ID generator.
* @param busyLock Busy lock.
*/
- public GridReduceQueryExecutor(GridSpinBusyLock busyLock) {
+ public GridReduceQueryExecutor(AtomicLong qryIdGen, GridSpinBusyLock busyLock) {
+ this.qryIdGen = qryIdGen;
this.busyLock = busyLock;
}
@@ -494,11 +498,13 @@ public class GridReduceQueryExecutor {
}
}
- final long qryReqId = reqIdGen.incrementAndGet();
+ final long qryReqId = qryIdGen.incrementAndGet();
final String space = cctx.name();
- final QueryRun r = new QueryRun(h2.connectionForSpace(space), qry.mapQueries().size(), qry.pageSize());
+ final QueryRun r = new QueryRun(qryReqId, qry.originalSql(), space,
+ h2.connectionForSpace(space), qry.mapQueries().size(), qry.pageSize(),
+ U.currentTimeMillis(), cancel);
AffinityTopologyVersion topVer = h2.readyTopologyVersion();
@@ -1304,10 +1310,46 @@ public class GridReduceQueryExecutor {
}
/**
+ * Collect queries that already running more than specified duration.
+ *
+ * @param duration Duration to check.
+ * @return Collection of IDs and statements of long running queries.
+ */
+ public Collection<GridRunningQueryInfo> longRunningQueries(long duration) {
+ Collection<GridRunningQueryInfo> res = new ArrayList<>();
+
+ long curTime = U.currentTimeMillis();
+
+ for (QueryRun run : runs.values()) {
+ if (run.qry.longQuery(curTime, duration))
+ res.add(run.qry);
+ }
+
+ return res;
+ }
+
+ /**
+ * Cancel specified queries.
+ *
+ * @param queries Queries IDs to cancel.
+ */
+ public void cancelQueries(Collection<Long> queries) {
+ for (Long qryId : queries) {
+ QueryRun run = runs.get(qryId);
+
+ if (run != null)
+ run.qry.cancel();
+ }
+ }
+
+ /**
* Query run.
*/
private static class QueryRun {
/** */
+ private final GridRunningQueryInfo qry;
+
+ /** */
private final List<GridMergeIndex> idxs;
/** */
@@ -1323,11 +1365,17 @@ public class GridReduceQueryExecutor {
private final AtomicReference<Object> state = new AtomicReference<>();
/**
+ * @param id Query ID.
+ * @param qry Query text.
+ * @param cache Cache where query was executed.
* @param conn Connection.
* @param idxsCnt Number of indexes.
* @param pageSize Page size.
+ * @param startTime Start time.
+ * @param cancel Query cancel handler.
*/
- private QueryRun(Connection conn, int idxsCnt, int pageSize) {
+ private QueryRun(Long id, String qry, String cache, Connection conn, int idxsCnt, int pageSize, long startTime, GridQueryCancel cancel) {
+ this.qry = new GridRunningQueryInfo(id, qry, SQL_FIELDS, cache, startTime, cancel, false);
this.conn = (JdbcConnection)conn;
this.idxs = new ArrayList<>(idxsCnt);
this.pageSize = pageSize > 0 ? pageSize : GridCacheTwoStepQuery.DFLT_PAGE_SIZE;
@@ -1410,4 +1458,4 @@ public class GridReduceQueryExecutor {
return copy(msg, n, partsMap);
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/11bbec48/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheSqlQueryValueCopySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheSqlQueryValueCopySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheSqlQueryValueCopySelfTest.java
index e47e893..66e7e4a 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheSqlQueryValueCopySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheSqlQueryValueCopySelfTest.java
@@ -17,15 +17,23 @@
package org.apache.ignite.internal.processors.cache;
+import java.util.Collection;
+import java.util.Collections;
import java.util.List;
import javax.cache.Cache;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.query.Query;
import org.apache.ignite.cache.query.QueryCursor;
import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.SqlQuery;
+import org.apache.ignite.cache.query.annotations.QuerySqlField;
+import org.apache.ignite.cache.query.annotations.QuerySqlFunction;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.processors.query.GridQueryProcessor;
+import org.apache.ignite.internal.processors.query.GridRunningQueryInfo;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
@@ -54,6 +62,7 @@ public class CacheSqlQueryValueCopySelfTest extends GridCommonAbstractTest {
cc.setCopyOnRead(true);
cc.setIndexedTypes(Integer.class, Value.class);
+ cc.setSqlFunctionClasses(TestSQLFunctions.class);
cfg.setCacheConfiguration(cc);
@@ -72,7 +81,7 @@ public class CacheSqlQueryValueCopySelfTest extends GridCommonAbstractTest {
IgniteCache<Integer, Value> cache = grid(0).cache(null);
for (int i = 0; i < KEYS; i++)
- cache.put(i, new Value("before"));
+ cache.put(i, new Value(i, "before-" + i));
}
/** {@inheritDoc} */
@@ -195,17 +204,148 @@ public class CacheSqlQueryValueCopySelfTest extends GridCommonAbstractTest {
check(cache);
}
- /** */
- private static class Value {
- /** */
- private String str;
+ /**
+ * Run specified query in separate thread.
+ *
+ * @param qry Query to execute.
+ */
+ private IgniteInternalFuture<?> runQueryAsync(final Query<?> qry) throws Exception {
+ return multithreadedAsync(new Runnable() {
+ @Override public void run() {
+ try {
+ log.info(">>> Query started");
+
+ grid(0).cache(null).query(qry).getAll();
+
+ log.info(">>> Query finished");
+ }
+ catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+ }, 1, "run-query");
+ }
- /**
- * @param str String.
- */
- public Value(String str) {
- this.str = str;
+ /**
+ * Test collecting info about running.
+ *
+ * @throws Exception If failed.
+ */
+ public void testRunningSqlFieldsQuery() throws Exception {
+ IgniteInternalFuture<?> fut = runQueryAsync(new SqlFieldsQuery("select _val, sleep(1000) from Value limit 3"));
+
+ Thread.sleep(500);
+
+ GridQueryProcessor qryProc = grid(0).context().query();
+
+ Collection<GridRunningQueryInfo> queries = qryProc.runningQueries(0);
+
+ assertEquals(1, queries.size());
+
+ fut.get();
+
+ queries = qryProc.runningQueries(0);
+
+ assertEquals(0, queries.size());
+
+ SqlFieldsQuery qry = new SqlFieldsQuery("select _val, sleep(1000) from Value limit 3");
+ qry.setLocal(true);
+
+ fut = runQueryAsync(qry);
+
+ Thread.sleep(500);
+
+ queries = qryProc.runningQueries(0);
+
+ assertEquals(1, queries.size());
+
+ fut.get();
+
+ queries = qryProc.runningQueries(0);
+
+ assertEquals(0, queries.size());
+ }
+
+ /**
+ * Test collecting info about running.
+ *
+ * @throws Exception If failed.
+ */
+ public void testRunningSqlQuery() throws Exception {
+ IgniteInternalFuture<?> fut = runQueryAsync(new SqlQuery<Integer, Value>(Value.class, "id > sleep(100)"));
+
+ Thread.sleep(500);
+
+ GridQueryProcessor qryProc = grid(0).context().query();
+
+ Collection<GridRunningQueryInfo> queries = qryProc.runningQueries(0);
+
+ assertEquals(1, queries.size());
+
+ fut.get();
+
+ queries = qryProc.runningQueries(0);
+
+ assertEquals(0, queries.size());
+
+ SqlQuery<Integer, Value> qry = new SqlQuery<>(Value.class, "id > sleep(100)");
+ qry.setLocal(true);
+
+ fut = runQueryAsync(qry);
+
+ Thread.sleep(500);
+
+ queries = qryProc.runningQueries(0);
+
+ assertEquals(1, queries.size());
+
+ fut.get();
+
+ queries = qryProc.runningQueries(0);
+
+ assertEquals(0, queries.size());
+ }
+
+ /**
+ * Test collecting info about running.
+ *
+ * @throws Exception If failed.
+ */
+ public void testCancelingSqlFieldsQuery() throws Exception {
+ runQueryAsync(new SqlFieldsQuery("select * from (select _val, sleep(100) from Value limit 50)"));
+
+ Thread.sleep(500);
+
+ final GridQueryProcessor qryProc = grid(0).context().query();
+
+ Collection<GridRunningQueryInfo> queries = qryProc.runningQueries(0);
+
+ assertEquals(1, queries.size());
+
+ final Collection<GridRunningQueryInfo> finalQueries = queries;
+
+ for (GridRunningQueryInfo query : finalQueries)
+ qryProc.cancelQueries(Collections.singleton(query.id()));
+
+ int n = 100;
+
+ // Give cluster some time to cancel query and cleanup resources.
+ while (n > 0) {
+ Thread.sleep(100);
+
+ queries = qryProc.runningQueries(0);
+
+ if (queries.isEmpty())
+ break;
+
+ log.info(">>>> Wait for cancel: " + n);
+
+ n--;
}
+
+ queries = qryProc.runningQueries(0);
+
+ assertEquals(0, queries.size());
}
/**
@@ -218,9 +358,53 @@ public class CacheSqlQueryValueCopySelfTest extends GridCommonAbstractTest {
for (Cache.Entry<Integer, Value> entry : cache) {
cnt++;
- assertEquals("before", entry.getValue().str);
+ assertEquals("before-" + entry.getKey(), entry.getValue().str);
}
assertEquals(KEYS, cnt);
}
-}
\ No newline at end of file
+
+ /** */
+ private static class Value {
+ /** */
+ @QuerySqlField
+ private int id;
+
+ /** */
+ @QuerySqlField
+ private String str;
+
+ /**
+ * @param id ID.
+ * @param str String.
+ */
+ public Value(int id, String str) {
+ this.id = id;
+ this.str = str;
+ }
+ }
+
+ /**
+ * Utility class with custom SQL functions.
+ */
+ public static class TestSQLFunctions {
+ /**
+ * Sleep function to simulate long running queries.
+ *
+ * @param x Time to sleep.
+ * @return Return specified argument.
+ */
+ @QuerySqlFunction
+ public static long sleep(long x) {
+ if (x >= 0)
+ try {
+ Thread.sleep(x);
+ }
+ catch (InterruptedException ignored) {
+ // No-op.
+ }
+
+ return x;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/11bbec48/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java
index 1f10593..01fefa3 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java
@@ -477,4 +477,4 @@ public class GridCacheCrossCacheQuerySelfTest extends GridCommonAbstractTest {
return storeId;
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/11bbec48/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
index ad8a7e3..814d0e0 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
@@ -106,6 +106,9 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract
spi.registerCache(null, cacheCfg("B"));
}
+ /**
+ * @param name Name.
+ */
private CacheConfiguration cacheCfg(String name) {
CacheConfiguration<?,?> cfg = new CacheConfiguration<>();
@@ -114,6 +117,7 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract
return cfg;
}
+ /** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
idx.stop();
@@ -182,6 +186,9 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract
return idx;
}
+ /**
+ * @return {@code true} if OFF-HEAP mode should be tested.
+ */
protected boolean offheap() {
return false;
}
[21/33] ignite git commit: IGNITE-4666 Clone to Input service.
Posted by vo...@apache.org.
IGNITE-4666 Clone to Input service.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/83579ce8
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/83579ce8
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/83579ce8
Branch: refs/heads/ignite-4565-ddl
Commit: 83579ce80abf3960cfe4eb07019f8ce6154df5c2
Parents: 84880a8
Author: Andrey Novikov <an...@gridgain.com>
Authored: Fri Mar 17 11:08:39 2017 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Fri Mar 17 11:08:39 2017 +0700
----------------------------------------------------------------------
modules/web-console/frontend/app/app.js | 10 +--
.../app/components/input-dialog/index.js | 24 ++++++
.../input-dialog/input-dialog.controller.js | 35 ++++++++
.../input-dialog/input-dialog.service.js | 88 ++++++++++++++++++++
.../input-dialog/input-dialog.tpl.pug | 39 +++++++++
.../frontend/app/services/Clone.service.js | 66 ---------------
.../frontend/controllers/caches-controller.js | 10 +--
.../frontend/controllers/clusters-controller.js | 6 +-
.../frontend/controllers/domains-controller.js | 12 ++-
.../frontend/controllers/igfs-controller.js | 10 +--
.../frontend/views/templates/clone.tpl.pug | 39 ---------
11 files changed, 207 insertions(+), 132 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/83579ce8/modules/web-console/frontend/app/app.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/app.js b/modules/web-console/frontend/app/app.js
index 5e3bb07..1e21d24 100644
--- a/modules/web-console/frontend/app/app.js
+++ b/modules/web-console/frontend/app/app.js
@@ -16,9 +16,9 @@
*/
import '../public/stylesheets/style.scss';
-import '../app/components/ui-grid-header/ui-grid-header.scss';
-import '../app/components/ui-grid-settings/ui-grid-settings.scss';
-import '../app/components/form-field-datepicker/form-field-datepicker.scss';
+import './components/ui-grid-header/ui-grid-header.scss';
+import './components/ui-grid-settings/ui-grid-settings.scss';
+import './components/form-field-datepicker/form-field-datepicker.scss';
import './app.config';
@@ -80,7 +80,6 @@ import igniteRetainSelection from './directives/retain-selection.directive';
// Services.
import ChartColors from './services/ChartColors.service';
-import Clone from './services/Clone.service.js';
import Confirm from './services/Confirm.service.js';
import ConfirmBatch from './services/ConfirmBatch.service.js';
import CopyToClipboard from './services/CopyToClipboard.service';
@@ -117,6 +116,7 @@ import resetPassword from './controllers/reset-password.controller';
// Components
import igniteListOfRegisteredUsers from './components/list-of-registered-users';
import IgniteActivitiesUserDialog from './components/activities-user-dialog';
+import './components/input-dialog';
// Inject external modules.
import 'ignite_modules_temp/index';
@@ -149,6 +149,7 @@ angular
'ignite-console.core',
'ignite-console.ace',
'ignite-console.Form',
+ 'ignite-console.input-dialog',
'ignite-console.user',
'ignite-console.branding',
'ignite-console.socket',
@@ -203,7 +204,6 @@ angular
.service('JavaTypes', JavaTypes)
.service('SqlTypes', SqlTypes)
.service(...ChartColors)
-.service(...Clone)
.service(...Confirm)
.service(...ConfirmBatch)
.service(...CopyToClipboard)
http://git-wip-us.apache.org/repos/asf/ignite/blob/83579ce8/modules/web-console/frontend/app/components/input-dialog/index.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/input-dialog/index.js b/modules/web-console/frontend/app/components/input-dialog/index.js
new file mode 100644
index 0000000..4bb9642
--- /dev/null
+++ b/modules/web-console/frontend/app/components/input-dialog/index.js
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+
+import angular from 'angular';
+
+import inputDialog from './input-dialog.service';
+
+angular
+ .module('ignite-console.input-dialog', [])
+ .service('IgniteInput', inputDialog);
http://git-wip-us.apache.org/repos/asf/ignite/blob/83579ce8/modules/web-console/frontend/app/components/input-dialog/input-dialog.controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/input-dialog/input-dialog.controller.js b/modules/web-console/frontend/app/components/input-dialog/input-dialog.controller.js
new file mode 100644
index 0000000..3f6e97b
--- /dev/null
+++ b/modules/web-console/frontend/app/components/input-dialog/input-dialog.controller.js
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+export default class InputDialogController {
+ static $inject = ['deferred', 'ui'];
+
+ constructor(deferred, {title, label, value, toValidValue}) {
+ this.deferred = deferred;
+ this.title = title;
+ this.label = label;
+ this.value = value;
+ this.toValidValue = toValidValue;
+ }
+
+ confirm() {
+ if (_.isFunction(this.toValidValue))
+ return this.deferred.resolve(this.toValidValue(this.value));
+
+ this.deferred.resolve(this.value);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/83579ce8/modules/web-console/frontend/app/components/input-dialog/input-dialog.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/input-dialog/input-dialog.service.js b/modules/web-console/frontend/app/components/input-dialog/input-dialog.service.js
new file mode 100644
index 0000000..fc3cb85
--- /dev/null
+++ b/modules/web-console/frontend/app/components/input-dialog/input-dialog.service.js
@@ -0,0 +1,88 @@
+/*
+ * 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.
+ */
+
+import controller from './input-dialog.controller';
+import templateUrl from './input-dialog.tpl.pug';
+
+export default class InputDialog {
+ static $inject = ['$modal', '$q'];
+
+ constructor($modal, $q) {
+ this.$modal = $modal;
+ this.$q = $q;
+ }
+
+ /**
+ * Open input dialog to configure custom value.
+ *
+ * @param {String} title Dialog title.
+ * @param {String} label Input field label.
+ * @param {String} value Default value.
+ * @param {Function} [toValidValue] Validator function.
+ * @returns {Promise.<String>} User input.
+ */
+ input(title, label, value, toValidValue) {
+ const deferred = this.$q.defer();
+
+ const modal = this.$modal({
+ templateUrl,
+ resolve: {
+ deferred: () => deferred,
+ ui: () => ({
+ title,
+ label,
+ value,
+ toValidValue
+ })
+ },
+ placement: 'center',
+ controller,
+ controllerAs: 'ctrl'
+ });
+
+ const modalHide = modal.hide;
+
+ modal.hide = () => deferred.reject('cancelled');
+
+ return deferred.promise
+ .finally(modalHide);
+ }
+
+ /**
+ * Open input dialog to configure cloned object name.
+ *
+ * @param {String} srcName Name of source object.
+ * @param {Array.<String>} names List of already exist names.
+ * @returns {Promise.<String>} New name
+ */
+ clone(srcName, names) {
+ const uniqueName = (value) => {
+ let num = 1;
+ let tmpName = value;
+
+ while (_.includes(names, tmpName)) {
+ tmpName = `${value}_${num}`;
+
+ num++;
+ }
+
+ return tmpName;
+ };
+
+ return this.input('Clone', 'New name', uniqueName(srcName), uniqueName);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/83579ce8/modules/web-console/frontend/app/components/input-dialog/input-dialog.tpl.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/input-dialog/input-dialog.tpl.pug b/modules/web-console/frontend/app/components/input-dialog/input-dialog.tpl.pug
new file mode 100644
index 0000000..95549d7
--- /dev/null
+++ b/modules/web-console/frontend/app/components/input-dialog/input-dialog.tpl.pug
@@ -0,0 +1,39 @@
+//-
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+include /app/helpers/jade/mixins
+
+.modal(tabindex='-1' role='dialog')
+ .modal-dialog
+ .modal-content
+ .modal-header
+ button.close(ng-click='$hide()') ×
+ h4.modal-title
+ i.fa.fa-clone
+ | {{ ctrl.title }}
+ form.form-horizontal.modal-body.row(name='ui.inputForm' novalidate)
+ div
+ .col-sm-2
+ label.required.labelFormField {{ ctrl.label }}:
+ .col-sm-10
+ .input-tip
+ +ignite-form-field-input('"input-field"', 'ctrl.value', false, 'true', 'Enter value')(
+ data-ignite-form-field-input-autofocus='true'
+ ignite-on-enter='form.$valid && ctrl.confirm()'
+ )
+ .modal-footer
+ button.btn.btn-default(id='copy-btn-cancel' ng-click='$hide()') Cancel
+ button.btn.btn-primary(id='copy-btn-confirm' ng-disabled='ui.inputForm.$invalid' ng-click='ctrl.confirm()') Confirm
http://git-wip-us.apache.org/repos/asf/ignite/blob/83579ce8/modules/web-console/frontend/app/services/Clone.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/services/Clone.service.js b/modules/web-console/frontend/app/services/Clone.service.js
deleted file mode 100644
index d079141..0000000
--- a/modules/web-console/frontend/app/services/Clone.service.js
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import templateUrl from 'views/templates/clone.tpl.pug';
-
-// Service for clone objects.
-export default ['IgniteClone', ['$rootScope', '$q', '$modal', ($root, $q, $modal) => {
- const scope = $root.$new();
-
- let _names = [];
- let deferred;
- let _validator;
-
- function _nextAvailableName(name) {
- let num = 1;
- let tmpName = name;
-
- while (_.includes(_names, tmpName)) {
- tmpName = name + '_' + num.toString();
-
- num++;
- }
-
- return tmpName;
- }
-
- const cloneModal = $modal({templateUrl, scope, placement: 'center', show: false});
-
- scope.ok = function(newName) {
- if (!_validator || _validator(newName)) {
- deferred.resolve(_nextAvailableName(newName));
-
- cloneModal.hide();
- }
- };
-
- cloneModal.confirm = function(oldName, names, validator) {
- _names = names;
-
- scope.newName = _nextAvailableName(oldName);
-
- _validator = validator;
-
- deferred = $q.defer();
-
- cloneModal.$promise.then(cloneModal.show);
-
- return deferred.promise;
- };
-
- return cloneModal;
-}]];
http://git-wip-us.apache.org/repos/asf/ignite/blob/83579ce8/modules/web-console/frontend/controllers/caches-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/controllers/caches-controller.js b/modules/web-console/frontend/controllers/caches-controller.js
index b50fde3..d4a13e5 100644
--- a/modules/web-console/frontend/controllers/caches-controller.js
+++ b/modules/web-console/frontend/controllers/caches-controller.js
@@ -19,8 +19,8 @@ import infoMessageTemplateUrl from 'views/templates/message.tpl.pug';
// Controller for Caches screen.
export default ['cachesController', [
- '$scope', '$http', '$state', '$filter', '$timeout', '$modal', 'IgniteLegacyUtils', 'IgniteMessages', 'IgniteConfirm', 'IgniteClone', 'IgniteLoading', 'IgniteModelNormalizer', 'IgniteUnsavedChangesGuard', 'IgniteConfigurationResource', 'IgniteErrorPopover', 'IgniteFormUtils', 'IgniteLegacyTable',
- function($scope, $http, $state, $filter, $timeout, $modal, LegacyUtils, Messages, Confirm, Clone, Loading, ModelNormalizer, UnsavedChangesGuard, Resource, ErrorPopover, FormUtils, LegacyTable) {
+ '$scope', '$http', '$state', '$filter', '$timeout', '$modal', 'IgniteLegacyUtils', 'IgniteMessages', 'IgniteConfirm', 'IgniteInput', 'IgniteLoading', 'IgniteModelNormalizer', 'IgniteUnsavedChangesGuard', 'IgniteConfigurationResource', 'IgniteErrorPopover', 'IgniteFormUtils', 'IgniteLegacyTable',
+ function($scope, $http, $state, $filter, $timeout, $modal, LegacyUtils, Messages, Confirm, Input, Loading, ModelNormalizer, UnsavedChangesGuard, Resource, ErrorPopover, FormUtils, LegacyTable) {
UnsavedChangesGuard.install($scope);
const emptyCache = {empty: true};
@@ -517,15 +517,13 @@ export default ['cachesController', [
};
function _cacheNames() {
- return _.map($scope.caches, function(cache) {
- return cache.name;
- });
+ return _.map($scope.caches, (cache) => cache.name);
}
// Clone cache with new name.
$scope.cloneItem = function() {
if (validate($scope.backupItem)) {
- Clone.confirm($scope.backupItem.name, _cacheNames()).then(function(newName) {
+ Input.clone($scope.backupItem.name, _cacheNames()).then((newName) => {
const item = angular.copy($scope.backupItem);
delete item._id;
http://git-wip-us.apache.org/repos/asf/ignite/blob/83579ce8/modules/web-console/frontend/controllers/clusters-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/controllers/clusters-controller.js b/modules/web-console/frontend/controllers/clusters-controller.js
index 7f90b90..c8392cf 100644
--- a/modules/web-console/frontend/controllers/clusters-controller.js
+++ b/modules/web-console/frontend/controllers/clusters-controller.js
@@ -17,8 +17,8 @@
// Controller for Clusters screen.
export default ['clustersController', [
- '$rootScope', '$scope', '$http', '$state', '$timeout', 'IgniteLegacyUtils', 'IgniteMessages', 'IgniteConfirm', 'IgniteClone', 'IgniteLoading', 'IgniteModelNormalizer', 'IgniteUnsavedChangesGuard', 'IgniteEventGroups', 'DemoInfo', 'IgniteLegacyTable', 'IgniteConfigurationResource', 'IgniteErrorPopover', 'IgniteFormUtils',
- function($root, $scope, $http, $state, $timeout, LegacyUtils, Messages, Confirm, Clone, Loading, ModelNormalizer, UnsavedChangesGuard, igniteEventGroups, DemoInfo, LegacyTable, Resource, ErrorPopover, FormUtils) {
+ '$rootScope', '$scope', '$http', '$state', '$timeout', 'IgniteLegacyUtils', 'IgniteMessages', 'IgniteConfirm', 'IgniteInput', 'IgniteLoading', 'IgniteModelNormalizer', 'IgniteUnsavedChangesGuard', 'IgniteEventGroups', 'DemoInfo', 'IgniteLegacyTable', 'IgniteConfigurationResource', 'IgniteErrorPopover', 'IgniteFormUtils',
+ function($root, $scope, $http, $state, $timeout, LegacyUtils, Messages, Confirm, Input, Loading, ModelNormalizer, UnsavedChangesGuard, igniteEventGroups, DemoInfo, LegacyTable, Resource, ErrorPopover, FormUtils) {
UnsavedChangesGuard.install($scope);
const emptyCluster = {empty: true};
@@ -774,7 +774,7 @@ export default ['clustersController', [
// Clone cluster with new name.
$scope.cloneItem = function() {
if (validate($scope.backupItem)) {
- Clone.confirm($scope.backupItem.name, _clusterNames()).then(function(newName) {
+ Input.clone($scope.backupItem.name, _clusterNames()).then((newName) => {
const item = angular.copy($scope.backupItem);
delete item._id;
http://git-wip-us.apache.org/repos/asf/ignite/blob/83579ce8/modules/web-console/frontend/controllers/domains-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/controllers/domains-controller.js b/modules/web-console/frontend/controllers/domains-controller.js
index 5c9e511..806dd45 100644
--- a/modules/web-console/frontend/controllers/domains-controller.js
+++ b/modules/web-console/frontend/controllers/domains-controller.js
@@ -19,8 +19,8 @@ import templateUrl from 'views/configuration/domains-import.tpl.pug';
// Controller for Domain model screen.
export default ['domainsController', [
- '$rootScope', '$scope', '$http', '$state', '$filter', '$timeout', '$modal', 'IgniteLegacyUtils', 'IgniteMessages', 'IgniteFocus', 'IgniteConfirm', 'IgniteConfirmBatch', 'IgniteClone', 'IgniteLoading', 'IgniteModelNormalizer', 'IgniteUnsavedChangesGuard', 'IgniteAgentMonitor', 'IgniteLegacyTable', 'IgniteConfigurationResource', 'IgniteErrorPopover', 'IgniteFormUtils', 'JavaTypes', 'SqlTypes', 'IgniteActivitiesData',
- function($root, $scope, $http, $state, $filter, $timeout, $modal, LegacyUtils, Messages, Focus, Confirm, ConfirmBatch, Clone, Loading, ModelNormalizer, UnsavedChangesGuard, IgniteAgentMonitor, LegacyTable, Resource, ErrorPopover, FormUtils, JavaTypes, SqlTypes, ActivitiesData) {
+ '$rootScope', '$scope', '$http', '$state', '$filter', '$timeout', '$modal', 'IgniteLegacyUtils', 'IgniteMessages', 'IgniteFocus', 'IgniteConfirm', 'IgniteConfirmBatch', 'IgniteInput', 'IgniteLoading', 'IgniteModelNormalizer', 'IgniteUnsavedChangesGuard', 'IgniteAgentMonitor', 'IgniteLegacyTable', 'IgniteConfigurationResource', 'IgniteErrorPopover', 'IgniteFormUtils', 'JavaTypes', 'SqlTypes', 'IgniteActivitiesData',
+ function($root, $scope, $http, $state, $filter, $timeout, $modal, LegacyUtils, Messages, Focus, Confirm, ConfirmBatch, Input, Loading, ModelNormalizer, UnsavedChangesGuard, IgniteAgentMonitor, LegacyTable, Resource, ErrorPopover, FormUtils, JavaTypes, SqlTypes, ActivitiesData) {
UnsavedChangesGuard.install($scope);
const emptyDomain = {empty: true};
@@ -1429,7 +1429,7 @@ export default ['domainsController', [
item.cacheStoreChanges = [];
- _.forEach(item.caches, function(cacheId) {
+ _.forEach(item.caches, (cacheId) => {
const cache = _.find($scope.caches, {value: cacheId}).cache;
const change = LegacyUtils.autoCacheStoreConfiguration(cache, [item]);
@@ -1444,9 +1444,7 @@ export default ['domainsController', [
};
function _domainNames() {
- return _.map($scope.domains, function(domain) {
- return domain.valueType;
- });
+ return _.map($scope.domains, (domain) => domain.valueType);
}
function _newNameIsValidJavaClass(newName) {
@@ -1457,7 +1455,7 @@ export default ['domainsController', [
// Save domain model with new name.
$scope.cloneItem = function() {
if ($scope.tableReset(true) && validate($scope.backupItem)) {
- Clone.confirm($scope.backupItem.valueType, _domainNames(), _newNameIsValidJavaClass).then(function(newName) {
+ Input.clone($scope.backupItem.valueType, _domainNames(), _newNameIsValidJavaClass).then((newName) => {
const item = angular.copy($scope.backupItem);
delete item._id;
http://git-wip-us.apache.org/repos/asf/ignite/blob/83579ce8/modules/web-console/frontend/controllers/igfs-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/controllers/igfs-controller.js b/modules/web-console/frontend/controllers/igfs-controller.js
index b3c6043..504e28d 100644
--- a/modules/web-console/frontend/controllers/igfs-controller.js
+++ b/modules/web-console/frontend/controllers/igfs-controller.js
@@ -17,8 +17,8 @@
// Controller for IGFS screen.
export default ['igfsController', [
- '$scope', '$http', '$state', '$filter', '$timeout', 'IgniteLegacyUtils', 'IgniteMessages', 'IgniteConfirm', 'IgniteClone', 'IgniteLoading', 'IgniteModelNormalizer', 'IgniteUnsavedChangesGuard', 'IgniteLegacyTable', 'IgniteConfigurationResource', 'IgniteErrorPopover', 'IgniteFormUtils',
- function($scope, $http, $state, $filter, $timeout, LegacyUtils, Messages, Confirm, Clone, Loading, ModelNormalizer, UnsavedChangesGuard, LegacyTable, Resource, ErrorPopover, FormUtils) {
+ '$scope', '$http', '$state', '$filter', '$timeout', 'IgniteLegacyUtils', 'IgniteMessages', 'IgniteConfirm', 'IgniteInput', 'IgniteLoading', 'IgniteModelNormalizer', 'IgniteUnsavedChangesGuard', 'IgniteLegacyTable', 'IgniteConfigurationResource', 'IgniteErrorPopover', 'IgniteFormUtils',
+ function($scope, $http, $state, $filter, $timeout, LegacyUtils, Messages, Confirm, Input, Loading, ModelNormalizer, UnsavedChangesGuard, LegacyTable, Resource, ErrorPopover, FormUtils) {
UnsavedChangesGuard.install($scope);
const emptyIgfs = {empty: true};
@@ -328,15 +328,13 @@ export default ['igfsController', [
};
function _igfsNames() {
- return _.map($scope.igfss, function(igfs) {
- return igfs.name;
- });
+ return _.map($scope.igfss, (igfs) => igfs.name);
}
// Clone IGFS with new name.
$scope.cloneItem = function() {
if ($scope.tableReset(true) && validate($scope.backupItem)) {
- Clone.confirm($scope.backupItem.name, _igfsNames()).then(function(newName) {
+ Input.clone($scope.backupItem.name, _igfsNames()).then((newName) => {
const item = angular.copy($scope.backupItem);
delete item._id;
http://git-wip-us.apache.org/repos/asf/ignite/blob/83579ce8/modules/web-console/frontend/views/templates/clone.tpl.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/templates/clone.tpl.pug b/modules/web-console/frontend/views/templates/clone.tpl.pug
deleted file mode 100644
index e62cb18..0000000
--- a/modules/web-console/frontend/views/templates/clone.tpl.pug
+++ /dev/null
@@ -1,39 +0,0 @@
-//-
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-include /app/helpers/jade/mixins
-
-.modal(tabindex='-1' role='dialog')
- .modal-dialog
- .modal-content
- .modal-header
- button.close(ng-click='$hide()') ×
- h4.modal-title
- i.fa.fa-clone
- | Clone
- form.form-horizontal.modal-body.row(name='ui.inputForm' novalidate)
- div
- .col-sm-2
- label.required.labelFormField New name:
- .col-sm-10
- .input-tip
- +ignite-form-field-input('"copy-new-name"','newName', false, 'true', 'Enter new name')(
- data-ignite-form-field-input-autofocus='true'
- ignite-on-enter='form.$valid && ok(newName)'
- )
- .modal-footer
- button.btn.btn-default(id='copy-btn-cancel' ng-click='$hide()') Cancel
- button.btn.btn-primary(id='copy-btn-confirm' ng-disabled='ui.inputForm.$invalid' ng-click='ok(newName)') Confirm
[30/33] ignite git commit: Merge branch 'master' into ignite-2.0
Posted by vo...@apache.org.
Merge branch 'master' into ignite-2.0
# Conflicts:
# modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
# modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
# modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0b6b8383
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0b6b8383
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0b6b8383
Branch: refs/heads/ignite-4565-ddl
Commit: 0b6b83839086171e06a00d518159ede17cdda3d8
Parents: 99bb87a 92bce6e
Author: devozerov <vo...@gridgain.com>
Authored: Tue Mar 21 11:09:29 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Tue Mar 21 11:09:29 2017 +0300
----------------------------------------------------------------------
.../cache/eviction/AbstractEvictionPolicy.java | 203 +++++++++++++++++++
.../ignite/cache/eviction/EvictionPolicy.java | 2 -
.../cache/eviction/fifo/FifoEvictionPolicy.java | 158 +--------------
.../cache/eviction/lru/LruEvictionPolicy.java | 159 ++-------------
.../eviction/random/RandomEvictionPolicy.java | 124 -----------
.../random/RandomEvictionPolicyMBean.java | 42 ----
.../eviction/sorted/SortedEvictionPolicy.java | 159 ++-------------
.../cache/GridCacheAffinityManager.java | 21 +-
.../cache/GridCacheManagerAdapter.java | 2 +-
.../processors/cache/GridCacheProcessor.java | 1 +
.../internal/visor/util/VisorTaskUtils.java | 8 +-
.../resources/META-INF/classnames.properties | 1 -
...ridFailFastNodeFailureDetectionSelfTest.java | 2 +-
...idCacheConfigurationConsistencySelfTest.java | 6 +-
.../cache/eviction/EvictionAbstractTest.java | 4 +-
.../cache/IncorrectCacheTypeMetadataTest.java | 72 +++++++
.../cache/IncorrectQueryEntityTest.java | 75 +++++++
.../IgniteCacheQuerySelfTestSuite.java | 4 +
modules/web-console/backend/app/agent.js | 14 +-
modules/web-console/backend/app/browser.js | 8 +-
modules/web-console/frontend/app/app.js | 10 +-
.../app/components/input-dialog/index.js | 24 +++
.../input-dialog/input-dialog.controller.js | 35 ++++
.../input-dialog/input-dialog.service.js | 88 ++++++++
.../input-dialog/input-dialog.tpl.pug | 39 ++++
.../ui-grid-settings/ui-grid-settings.scss | 35 ++++
.../frontend/app/modules/agent/agent.module.js | 10 +-
.../frontend/app/modules/sql/sql.controller.js | 109 +++++++---
.../frontend/app/services/Clone.service.js | 66 ------
.../frontend/controllers/caches-controller.js | 10 +-
.../frontend/controllers/clusters-controller.js | 6 +-
.../frontend/controllers/domains-controller.js | 12 +-
.../frontend/controllers/igfs-controller.js | 10 +-
.../frontend/public/stylesheets/style.scss | 8 +-
.../web-console/frontend/views/sql/sql.tpl.pug | 48 +++--
.../frontend/views/templates/clone.tpl.pug | 39 ----
.../frontend/views/templates/message.tpl.pug | 4 +-
parent/pom.xml | 2 -
38 files changed, 813 insertions(+), 807 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0b6b8383/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index a7d38a7,b016883..d383ce8
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@@ -101,7 -99,9 +101,8 @@@ import org.apache.ignite.internal.proce
import org.apache.ignite.internal.processors.cache.version.GridCacheVersionManager;
import org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessor;
import org.apache.ignite.internal.processors.plugin.CachePluginManager;
-import org.apache.ignite.internal.processors.query.GridQueryProcessor;
import org.apache.ignite.internal.processors.timeout.GridTimeoutObject;
+ import org.apache.ignite.internal.suggestions.GridPerformanceSuggestions;
import org.apache.ignite.internal.util.F0;
import org.apache.ignite.internal.util.future.GridCompoundFuture;
import org.apache.ignite.internal.util.future.GridFinishedFuture;
http://git-wip-us.apache.org/repos/asf/ignite/blob/0b6b8383/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0b6b8383/modules/core/src/test/java/org/apache/ignite/internal/GridFailFastNodeFailureDetectionSelfTest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0b6b8383/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0b6b8383/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/EvictionAbstractTest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0b6b8383/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
----------------------------------------------------------------------
[08/33] ignite git commit: IGNITE-4740 - Fix. Service could be
deployed/undeployed twice on concurrent cancel and discovery event.
Posted by vo...@apache.org.
IGNITE-4740 - Fix. Service could be deployed/undeployed twice on concurrent cancel and discovery event.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9fcb3e74
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9fcb3e74
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9fcb3e74
Branch: refs/heads/ignite-4565-ddl
Commit: 9fcb3e74f91c8497b7b1358cdff40950cdf5c568
Parents: c0e2df2
Author: dkarachentsev <dk...@gridgain.com>
Authored: Tue Feb 28 16:05:06 2017 +0300
Committer: dkarachentsev <dk...@gridgain.com>
Committed: Tue Feb 28 16:05:06 2017 +0300
----------------------------------------------------------------------
.../cache/DynamicCacheChangeBatch.java | 14 ++
.../service/GridServiceProcessor.java | 49 +++---
.../GridServiceContinuousQueryRedeploy.java | 167 +++++++++++++++++++
.../testsuites/IgniteKernalSelfTestSuite.java | 2 +
4 files changed, 208 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/9fcb3e74/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeBatch.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeBatch.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeBatch.java
index 4dcff9b..a250063 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeBatch.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeBatch.java
@@ -113,6 +113,20 @@ public class DynamicCacheChangeBatch implements DiscoveryCustomMessage {
return clientReconnect;
}
+ /**
+ * @return {@code True} if request should trigger partition exchange.
+ */
+ public boolean exchangeNeeded() {
+ if (reqs != null) {
+ for (DynamicCacheChangeRequest req : reqs) {
+ if (req.exchangeNeeded())
+ return true;
+ }
+ }
+
+ return false;
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(DynamicCacheChangeBatch.class, this);
http://git-wip-us.apache.org/repos/asf/ignite/blob/9fcb3e74/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
index 3690f35..4eeafed 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
@@ -65,10 +65,12 @@ import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.CacheAffinityChangeMessage;
import org.apache.ignite.internal.processors.cache.CacheEntryImpl;
import org.apache.ignite.internal.processors.cache.CacheIteratorConverter;
+import org.apache.ignite.internal.processors.cache.DynamicCacheChangeBatch;
import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
import org.apache.ignite.internal.processors.cache.query.CacheQuery;
import org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager;
import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
+import org.apache.ignite.internal.processors.continuous.AbstractContinuousMessage;
import org.apache.ignite.internal.processors.task.GridInternal;
import org.apache.ignite.internal.processors.timeout.GridTimeoutObject;
import org.apache.ignite.internal.util.GridEmptyIterator;
@@ -1468,19 +1470,7 @@ public class GridServiceProcessor extends GridProcessorAdapter {
else {
String name = e.getKey().name();
- svcName.set(name);
-
- Collection<ServiceContextImpl> ctxs;
-
- synchronized (locSvcs) {
- ctxs = locSvcs.remove(name);
- }
-
- if (ctxs != null) {
- synchronized (ctxs) {
- cancel(ctxs, ctxs.size());
- }
- }
+ undeploy(name);
// Finish deployment futures if undeployment happened.
GridFutureAdapter<?> fut = depFuts.remove(name);
@@ -1586,6 +1576,12 @@ public class GridServiceProcessor extends GridProcessorAdapter {
if (!((CacheAffinityChangeMessage)msg).exchangeNeeded())
return;
}
+ else if (msg instanceof DynamicCacheChangeBatch) {
+ if (!((DynamicCacheChangeBatch)msg).exchangeNeeded())
+ return;
+ }
+ else
+ return;
}
else
topVer = new AffinityTopologyVersion(((DiscoveryEvent)evt).topologyVersion(), 0);
@@ -1771,21 +1767,26 @@ public class GridServiceProcessor extends GridProcessorAdapter {
}
}
// Handle undeployment.
- else {
- String name = e.getKey().name();
+ else
+ undeploy(e.getKey().name());
+ }
- svcName.set(name);
- Collection<ServiceContextImpl> ctxs;
+ /**
+ * @param name Name.
+ */
+ private void undeploy(String name) {
+ svcName.set(name);
- synchronized (locSvcs) {
- ctxs = locSvcs.remove(name);
- }
+ Collection<ServiceContextImpl> ctxs;
- if (ctxs != null) {
- synchronized (ctxs) {
- cancel(ctxs, ctxs.size());
- }
+ synchronized (locSvcs) {
+ ctxs = locSvcs.remove(name);
+ }
+
+ if (ctxs != null) {
+ synchronized (ctxs) {
+ cancel(ctxs, ctxs.size());
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9fcb3e74/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceContinuousQueryRedeploy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceContinuousQueryRedeploy.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceContinuousQueryRedeploy.java
new file mode 100644
index 0000000..1a9ef3a
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceContinuousQueryRedeploy.java
@@ -0,0 +1,167 @@
+/*
+ * 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.service;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.UUID;
+import java.util.concurrent.Callable;
+import javax.cache.event.CacheEntryEvent;
+import javax.cache.event.CacheEntryListenerException;
+import javax.cache.event.CacheEntryUpdatedListener;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.query.ContinuousQuery;
+import org.apache.ignite.cache.query.QueryCursor;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.resources.IgniteInstanceResource;
+import org.apache.ignite.services.Service;
+import org.apache.ignite.services.ServiceConfiguration;
+import org.apache.ignite.services.ServiceContext;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ * Tests whether concurrent service cancel and registering ContinuousQuery doesn't causes
+ * service redeployment.
+ */
+public class GridServiceContinuousQueryRedeploy extends GridCommonAbstractTest {
+ /** */
+ private static final String CACHE_NAME = "TEST_CACHE";
+
+ /** */
+ private static final String TEST_KEY = "TEST_KEY";
+
+ /** */
+ private static final String SERVICE_NAME = "service1";
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testServiceRedeploymentAfterCancel() throws Exception {
+ final Ignite ignite = startGrid(0);
+
+ final IgniteCache<Object, Object> managementCache = ignite.getOrCreateCache(CACHE_NAME);
+
+ final ContinuousQuery<Object, Object> qry = new ContinuousQuery<>();
+ final List<Object> evts = Collections.synchronizedList(new ArrayList<>());
+
+ qry.setLocalListener(new CacheEntryUpdatedListener<Object, Object>() {
+ @Override public void onUpdated(
+ Iterable<CacheEntryEvent<?, ?>> iterable) throws CacheEntryListenerException {
+ for (CacheEntryEvent<?, ?> event : iterable)
+ evts.add(event);
+ }
+ });
+
+ int iterations = 100;
+
+ while (iterations-- > 0) {
+ QueryCursor quorumCursor = managementCache.query(qry);
+
+ IgniteInternalFuture<?> fut1 = GridTestUtils.runAsync(new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ System.out.println("Deploy " + SERVICE_NAME);
+ deployService(ignite);
+
+ return null;
+ }
+ });
+
+ IgniteInternalFuture<?> fut2 = GridTestUtils.runAsync(new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ System.out.println("Undeploy " + SERVICE_NAME);
+ ignite.services().cancel(SERVICE_NAME);
+
+ return null;
+ }
+ });
+
+ fut1.get();
+ fut2.get();
+
+ U.sleep(100);
+
+ assert evts.size() <= 1 : evts.size();
+
+ ignite.services().cancel("service1");
+
+ evts.clear();
+
+ quorumCursor.close();
+ }
+
+ }
+
+ /**
+ * @param ignite Ignite.
+ */
+ private void deployService(final Ignite ignite) {
+ ServiceConfiguration svcCfg = new ServiceConfiguration();
+
+ svcCfg.setService(new ManagementService());
+ svcCfg.setName(SERVICE_NAME);
+ svcCfg.setTotalCount(1);
+ svcCfg.setMaxPerNodeCount(1);
+ svcCfg.setNodeFilter(new IgnitePredicate<ClusterNode>() {
+ @Override public boolean apply(ClusterNode node) {
+ return !node.isClient();
+ }
+ });
+
+ ignite.services().deploy(svcCfg);
+ }
+
+ /**
+ *
+ */
+ public static class ManagementService implements Service {
+ /** */
+ private final String name = UUID.randomUUID().toString();
+
+ /** */
+ @IgniteInstanceResource
+ private Ignite ignite;
+
+ /** {@inheritDoc} */
+ @Override public void cancel(ServiceContext ctx) {
+ System.out.println(name + " shutdown.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public synchronized void init(ServiceContext ctx) throws Exception {
+ System.out.println(name + " initializing.");
+
+ ignite.cache(CACHE_NAME).put(TEST_KEY, name + " init");
+ }
+
+ /** {@inheritDoc} */
+ @Override public void execute(ServiceContext ctx) throws Exception {
+ // No-op
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9fcb3e74/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
index 350b715..5977702 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
@@ -50,6 +50,7 @@ import org.apache.ignite.internal.processors.cluster.GridAddressResolverSelfTest
import org.apache.ignite.internal.processors.cluster.GridUpdateNotifierSelfTest;
import org.apache.ignite.internal.processors.port.GridPortProcessorSelfTest;
import org.apache.ignite.internal.processors.service.GridServiceClientNodeTest;
+import org.apache.ignite.internal.processors.service.GridServiceContinuousQueryRedeploy;
import org.apache.ignite.internal.processors.service.GridServicePackagePrivateSelfTest;
import org.apache.ignite.internal.processors.service.GridServiceProcessorMultiNodeConfigSelfTest;
import org.apache.ignite.internal.processors.service.GridServiceProcessorMultiNodeSelfTest;
@@ -143,6 +144,7 @@ public class IgniteKernalSelfTestSuite extends TestSuite {
suite.addTestSuite(GridServiceProxyClientReconnectSelfTest.class);
suite.addTestSuite(IgniteServiceReassignmentTest.class);
suite.addTestSuite(IgniteServiceProxyTimeoutInitializedTest.class);
+ suite.addTestSuite(GridServiceContinuousQueryRedeploy.class);
suite.addTestSuite(IgniteServiceDeploymentClassLoadingDefaultMarshallerTest.class);
suite.addTestSuite(IgniteServiceDeploymentClassLoadingOptimizedMarshallerTest.class);
[22/33] ignite git commit: Added NearCacheUpdates.serialVersionUID.
Posted by vo...@apache.org.
Added NearCacheUpdates.serialVersionUID.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5f790d07
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5f790d07
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5f790d07
Branch: refs/heads/ignite-4565-ddl
Commit: 5f790d073d7198927db029c0ec45bcfca60d4a8a
Parents: 09f64e5
Author: sboikov <sb...@gridgain.com>
Authored: Mon Mar 20 14:55:44 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Mar 20 14:55:44 2017 +0300
----------------------------------------------------------------------
.../processors/cache/distributed/dht/atomic/NearCacheUpdates.java | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/5f790d07/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/NearCacheUpdates.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/NearCacheUpdates.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/NearCacheUpdates.java
index f4ecedf..a340a62 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/NearCacheUpdates.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/NearCacheUpdates.java
@@ -36,6 +36,9 @@ import org.jetbrains.annotations.Nullable;
*
*/
public class NearCacheUpdates implements Message {
+ /** */
+ private static final long serialVersionUID = 0L;
+
/** Indexes of keys for which values were generated on primary node (used if originating node has near cache). */
@GridDirectCollection(int.class)
private List<Integer> nearValsIdxs;
[33/33] ignite git commit: Merge branch 'master' into ignite-4565-ddl
Posted by vo...@apache.org.
Merge branch 'master' into ignite-4565-ddl
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d5b41960
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d5b41960
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d5b41960
Branch: refs/heads/ignite-4565-ddl
Commit: d5b41960da60ae81ee2a6343b1025190862f9ded
Parents: 1b2a3de 92beda2
Author: devozerov <vo...@gridgain.com>
Authored: Tue Mar 21 14:29:30 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Tue Mar 21 14:29:30 2017 +0300
----------------------------------------------------------------------
assembly/release-fabric-base.xml | 6 +
.../cache/eviction/AbstractEvictionPolicy.java | 203 +++++++++++++++++++
.../ignite/cache/eviction/EvictionPolicy.java | 2 -
.../cache/eviction/fifo/FifoEvictionPolicy.java | 158 +--------------
.../cache/eviction/lru/LruEvictionPolicy.java | 159 ++-------------
.../eviction/random/RandomEvictionPolicy.java | 124 -----------
.../random/RandomEvictionPolicyMBean.java | 42 ----
.../eviction/sorted/SortedEvictionPolicy.java | 159 ++-------------
.../internal/managers/GridManagerAdapter.java | 4 +
.../cache/DynamicCacheChangeBatch.java | 14 ++
.../cache/GridCacheAffinityManager.java | 21 +-
.../cache/GridCacheManagerAdapter.java | 2 +-
.../dht/atomic/NearCacheUpdates.java | 3 +
.../internal/processors/query/QueryUtils.java | 20 +-
.../service/GridServiceProcessor.java | 50 +++--
.../internal/visor/util/VisorTaskUtils.java | 8 +-
.../org/apache/ignite/spi/IgniteSpiAdapter.java | 5 +
.../org/apache/ignite/spi/IgniteSpiContext.java | 6 +
.../ignite/spi/discovery/tcp/ClientImpl.java | 32 ++-
.../ignite/spi/discovery/tcp/ServerImpl.java | 19 ++
.../spi/discovery/tcp/TcpDiscoverySpi.java | 5 +
.../tcp/internal/TcpDiscoveryNode.java | 6 +-
.../resources/META-INF/classnames.properties | 1 -
...ridFailFastNodeFailureDetectionSelfTest.java | 2 +-
...idCacheConfigurationConsistencySelfTest.java | 6 +-
.../cache/eviction/EvictionAbstractTest.java | 4 +-
.../GridServiceContinuousQueryRedeployTest.java | 167 +++++++++++++++
...veryNodeAttributesUpdateOnReconnectTest.java | 110 ++++++++++
.../TcpDiscoverySslSecuredUnsecuredTest.java | 185 +++++++++++++++++
.../tcp/TestReconnectPluginProvider.java | 111 ++++++++++
.../discovery/tcp/TestReconnectProcessor.java | 93 +++++++++
.../testframework/GridSpiTestContext.java | 5 +
.../testsuites/IgniteKernalSelfTestSuite.java | 2 +
.../IgniteSpiDiscoverySelfTestSuite.java | 5 +
.../org.apache.ignite.plugin.PluginProvider | 1 +
.../processors/query/h2/IgniteH2Indexing.java | 1 +
.../cache/IncorrectCacheTypeMetadataTest.java | 72 +++++++
.../cache/IncorrectQueryEntityTest.java | 75 +++++++
.../IgniteCacheQuerySelfTestSuite.java | 4 +
modules/platforms/cpp/core/include/Makefile.am | 2 +-
.../include/ignite/cache/query/query_argument.h | 134 ------------
.../core/include/ignite/cache/query/query_sql.h | 16 +-
.../ignite/cache/query/query_sql_fields.h | 16 +-
.../ignite/impl/cache/query/query_argument.h | 137 +++++++++++++
.../platforms/cpp/core/project/vs/core.vcxproj | 2 +-
.../cpp/core/project/vs/core.vcxproj.filters | 6 +-
.../cpp/odbc/install/install_amd64.cmd | 10 +-
.../platforms/cpp/odbc/install/install_x86.cmd | 6 +-
modules/web-console/backend/app/agent.js | 14 +-
modules/web-console/backend/app/browser.js | 8 +-
modules/web-console/frontend/app/app.js | 10 +-
.../app/components/input-dialog/index.js | 24 +++
.../input-dialog/input-dialog.controller.js | 35 ++++
.../input-dialog/input-dialog.service.js | 88 ++++++++
.../input-dialog/input-dialog.tpl.pug | 39 ++++
.../ui-grid-settings/ui-grid-settings.scss | 35 ++++
.../frontend/app/modules/agent/agent.module.js | 10 +-
.../frontend/app/modules/sql/sql.controller.js | 109 +++++++---
.../frontend/app/services/Clone.service.js | 66 ------
.../frontend/controllers/caches-controller.js | 10 +-
.../frontend/controllers/clusters-controller.js | 6 +-
.../frontend/controllers/domains-controller.js | 12 +-
.../frontend/controllers/igfs-controller.js | 10 +-
.../frontend/public/stylesheets/style.scss | 8 +-
.../web-console/frontend/views/sql/sql.tpl.pug | 48 +++--
.../frontend/views/templates/clone.tpl.pug | 39 ----
.../frontend/views/templates/message.tpl.pug | 4 +-
parent/pom.xml | 3 +-
68 files changed, 1803 insertions(+), 996 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d5b41960/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d5b41960/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d5b41960/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
[23/33] ignite git commit: Merge remote-tracking branch
'origin/ignite-2.0' into ignite-2.0
Posted by vo...@apache.org.
Merge remote-tracking branch 'origin/ignite-2.0' into ignite-2.0
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2544bfd3
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2544bfd3
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2544bfd3
Branch: refs/heads/ignite-4565-ddl
Commit: 2544bfd3477c0da9f6357d857c35802e7bc7cd05
Parents: 5f790d0 ea8c95a
Author: sboikov <sb...@gridgain.com>
Authored: Mon Mar 20 14:58:09 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Mar 20 14:58:09 2017 +0300
----------------------------------------------------------------------
.../cache/GridCacheDeploymentManager.java | 6 ---
.../cache/query/GridCacheQueryManager.java | 22 -----------
.../processors/query/GridQueryProcessor.java | 41 --------------------
.../cache/CacheIndexingOffheapCleanupTest.java | 21 ----------
4 files changed, 90 deletions(-)
----------------------------------------------------------------------
[16/33] ignite git commit: IGNITE-1178 fix for NPE in
GridCacheProcessor.onKernalStop(). Fixes #1517
Posted by vo...@apache.org.
IGNITE-1178 fix for NPE in GridCacheProcessor.onKernalStop(). Fixes #1517
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0b996e62
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0b996e62
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0b996e62
Branch: refs/heads/ignite-4565-ddl
Commit: 0b996e62119b316f9758da09623c722ec2fb7921
Parents: e670351
Author: voipp <al...@gmail.com>
Authored: Mon Mar 13 17:23:07 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Mon Mar 13 17:23:07 2017 +0300
----------------------------------------------------------------------
.../cache/GridCacheAffinityManager.java | 21 +++---
.../cache/GridCacheManagerAdapter.java | 2 +-
.../processors/cache/GridCacheProcessor.java | 2 +-
.../processors/query/GridQueryProcessor.java | 20 +++++-
.../cache/IncorrectCacheTypeMetadataTest.java | 72 +++++++++++++++++++
.../cache/IncorrectQueryEntityTest.java | 75 ++++++++++++++++++++
.../IgniteCacheQuerySelfTestSuite.java | 4 ++
7 files changed, 183 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0b996e62/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityManager.java
index 17c9319..621634c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityManager.java
@@ -17,6 +17,11 @@
package org.apache.ignite.internal.processors.cache;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.binary.BinaryObject;
@@ -33,12 +38,6 @@ import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.lang.IgniteFuture;
import org.jetbrains.annotations.Nullable;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-import java.util.UUID;
-
/**
* Cache affinity manager.
*/
@@ -88,10 +87,15 @@ public class GridCacheAffinityManager extends GridCacheManagerAdapter {
*
*/
public void cancelFutures() {
+ if (!starting.get())
+ // Ignoring attempt to stop manager that has never been started.
+ return;
+
IgniteCheckedException err =
new IgniteCheckedException("Failed to wait for topology update, cache (or node) is stopping.");
- aff.cancelFutures(err);
+ if (aff != null)
+ aff.cancelFutures(err);
}
/** {@inheritDoc} */
@@ -99,7 +103,8 @@ public class GridCacheAffinityManager extends GridCacheManagerAdapter {
IgniteCheckedException err = new IgniteClientDisconnectedCheckedException(reconnectFut,
"Failed to wait for topology update, client disconnected.");
- aff.cancelFutures(err);
+ if (aff != null)
+ aff.cancelFutures(err);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/0b996e62/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheManagerAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheManagerAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheManagerAdapter.java
index 8ad0ea8..ab965de 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheManagerAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheManagerAdapter.java
@@ -34,7 +34,7 @@ public class GridCacheManagerAdapter<K, V> implements GridCacheManager<K, V> {
protected IgniteLogger log;
/** Starting flag. */
- private final AtomicBoolean starting = new AtomicBoolean(false);
+ protected final AtomicBoolean starting = new AtomicBoolean(false);
/** {@inheritDoc} */
@Override public final void start(GridCacheContext<K, V> cctx) throws IgniteCheckedException {
http://git-wip-us.apache.org/repos/asf/ignite/blob/0b996e62/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index 50e1379..b016883 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -63,7 +63,6 @@ import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.configuration.TransactionConfiguration;
import org.apache.ignite.events.EventType;
import org.apache.ignite.internal.GridKernalContext;
-import org.apache.ignite.internal.suggestions.GridPerformanceSuggestions;
import org.apache.ignite.internal.IgniteClientDisconnectedCheckedException;
import org.apache.ignite.internal.IgniteComponentType;
import org.apache.ignite.internal.IgniteInternalFuture;
@@ -102,6 +101,7 @@ import org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProces
import org.apache.ignite.internal.processors.plugin.CachePluginManager;
import org.apache.ignite.internal.processors.query.GridQueryProcessor;
import org.apache.ignite.internal.processors.timeout.GridTimeoutObject;
+import org.apache.ignite.internal.suggestions.GridPerformanceSuggestions;
import org.apache.ignite.internal.util.F0;
import org.apache.ignite.internal.util.future.GridCompoundFuture;
import org.apache.ignite.internal.util.future.GridFinishedFuture;
http://git-wip-us.apache.org/repos/asf/ignite/blob/0b996e62/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index 17060fb..fddb8df 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -1653,14 +1653,28 @@ public class GridQueryProcessor extends GridProcessorAdapter {
res = buildClassProperty(false, valCls, pathStr, resType, aliases, coCtx);
if (res == null)
- throw new IgniteCheckedException("Failed to initialize property '" + pathStr + "' of type '" +
- resType.getName() + "' for key class '" + keyCls + "' and value class '" + valCls + "'. " +
- "Make sure that one of these classes contains respective getter method or field.");
+ throw new IgniteCheckedException(propertyInitializationExceptionMessage(keyCls, valCls, pathStr, resType));
return res;
}
/**
+ * Exception message to compare in tests.
+ *
+ * @param keyCls key class
+ * @param valCls value class
+ * @param pathStr property name
+ * @param resType property type
+ * @return
+ */
+ public static String propertyInitializationExceptionMessage(Class<?> keyCls, Class<?> valCls, String pathStr,
+ Class<?> resType) {
+ return "Failed to initialize property '" + pathStr + "' of type '" +
+ resType.getName() + "' for key class '" + keyCls + "' and value class '" + valCls + "'. " +
+ "Make sure that one of these classes contains respective getter method or field.";
+ }
+
+ /**
* @param key If this is a key property.
* @param cls Source type class.
* @param pathStr String representing path to the property. May contains dots '.' to identify nested fields.
http://git-wip-us.apache.org/repos/asf/ignite/blob/0b996e62/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IncorrectCacheTypeMetadataTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IncorrectCacheTypeMetadataTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IncorrectCacheTypeMetadataTest.java
new file mode 100644
index 0000000..4178cde
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IncorrectCacheTypeMetadataTest.java
@@ -0,0 +1,72 @@
+/*
+ * 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 java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.ignite.cache.CacheTypeMetadata;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.processors.query.GridQueryProcessor;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ * A test for {@link CacheTypeMetadata} initialization with incorrect query field name
+ */
+public class IncorrectCacheTypeMetadataTest extends GridCommonAbstractTest {
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ CacheConfiguration dfltCacheCfg = defaultCacheConfiguration();
+
+ CacheTypeMetadata cacheTypeMetadata = new CacheTypeMetadata();
+
+ Map<String, Class<?>> queryFieldsMap = new HashMap<>();
+
+ queryFieldsMap.put("exceptionOid", Object.class);
+
+ cacheTypeMetadata.setQueryFields(queryFieldsMap);
+ cacheTypeMetadata.setValueType(Object.class);
+
+ dfltCacheCfg.setTypeMetadata(Collections.singleton(cacheTypeMetadata));
+
+ cfg.setCacheConfiguration(dfltCacheCfg);
+
+ return cfg;
+ }
+
+ /**
+ * Grid must be stopped with property initialization exception.
+ *
+ * @throws Exception If failed.
+ */
+ public void testIncorrectQueryField() throws Exception {
+ try {
+ startGrid();
+ }
+ catch (Exception exception) {
+ if (!exception.getMessage().contains(
+ GridQueryProcessor.propertyInitializationExceptionMessage(
+ Object.class, Object.class, "exceptionOid", Object.class))) {
+ fail("property initialization exception must be thrown, but got " + exception.getMessage());
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0b996e62/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IncorrectQueryEntityTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IncorrectQueryEntityTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IncorrectQueryEntityTest.java
new file mode 100644
index 0000000..5d89a58
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IncorrectQueryEntityTest.java
@@ -0,0 +1,75 @@
+/*
+ * 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 java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.Set;
+import org.apache.ignite.cache.QueryEntity;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.processors.query.GridQueryProcessor;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+public class IncorrectQueryEntityTest extends GridCommonAbstractTest {
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ CacheConfiguration dfltCacheCfg = defaultCacheConfiguration();
+
+ QueryEntity queryEntity = new QueryEntity(Object.class.getName(), Object.class.getName());
+
+ LinkedHashMap<String, String> fields = new LinkedHashMap<>();
+
+ fields.put("exceptionOid", Object.class.getName());
+
+ queryEntity.setFields(fields);
+
+ Set<String> keyFields = new HashSet<>();
+
+ keyFields.add("exceptionOid");
+
+ queryEntity.setKeyFields(keyFields);
+
+ dfltCacheCfg.setQueryEntities(F.asList(queryEntity));
+
+ cfg.setCacheConfiguration(dfltCacheCfg);
+
+ return cfg;
+ }
+
+ /**
+ * Grid must be stopped with property initialization exception.
+ *
+ * @throws Exception If failed.
+ */
+ public void testIncorrectQueryField() throws Exception {
+ try {
+ startGrid();
+ }
+ catch (Exception exception) {
+ if (!exception.getMessage().contains(
+ GridQueryProcessor.propertyInitializationExceptionMessage(
+ Object.class, Object.class, "exceptionOid", Object.class))) {
+ fail("property initialization exception must be thrown, but got " + exception.getMessage());
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0b996e62/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 0c74f12..b7be713 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
@@ -68,6 +68,8 @@ import org.apache.ignite.internal.processors.cache.IgniteCacheQueryIndexSelfTest
import org.apache.ignite.internal.processors.cache.IgniteCacheQueryLoadSelfTest;
import org.apache.ignite.internal.processors.cache.IgniteCacheUpdateSqlQuerySelfTest;
import org.apache.ignite.internal.processors.cache.IgniteCrossCachesJoinsQueryTest;
+import org.apache.ignite.internal.processors.cache.IncorrectCacheTypeMetadataTest;
+import org.apache.ignite.internal.processors.cache.IncorrectQueryEntityTest;
import org.apache.ignite.internal.processors.cache.QueryEntityCaseMismatchTest;
import org.apache.ignite.internal.processors.cache.SqlFieldsQuerySelfTest;
import org.apache.ignite.internal.processors.cache.distributed.near.IgniteCacheAtomicFieldsQuerySelfTest;
@@ -133,6 +135,8 @@ public class IgniteCacheQuerySelfTestSuite extends TestSuite {
// Config.
suite.addTestSuite(IgniteCacheDuplicateEntityConfigurationSelfTest.class);
+ suite.addTestSuite(IncorrectCacheTypeMetadataTest.class);
+ suite.addTestSuite(IncorrectQueryEntityTest.class);
// Queries tests.
suite.addTestSuite(IgniteSqlSplitterSelfTest.class);
[26/33] ignite git commit: IGNITE-4002: Fixed warning messages during
ODBC driver installiation.
Posted by vo...@apache.org.
IGNITE-4002: Fixed warning messages during ODBC driver installiation.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/67bd32c2
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/67bd32c2
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/67bd32c2
Branch: refs/heads/ignite-4565-ddl
Commit: 67bd32c207b2334984fcbc47b20d8c52002a3e2a
Parents: 15c9780
Author: Igor Sapego <is...@gridgain.com>
Authored: Mon Mar 20 15:55:15 2017 +0300
Committer: Igor Sapego <is...@gridgain.com>
Committed: Mon Mar 20 15:55:15 2017 +0300
----------------------------------------------------------------------
modules/platforms/cpp/odbc/install/install_amd64.cmd | 10 ++++++++--
modules/platforms/cpp/odbc/install/install_x86.cmd | 6 +++++-
2 files changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/67bd32c2/modules/platforms/cpp/odbc/install/install_amd64.cmd
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/install/install_amd64.cmd b/modules/platforms/cpp/odbc/install/install_amd64.cmd
index 3b4b63f..2a2fff6 100644
--- a/modules/platforms/cpp/odbc/install/install_amd64.cmd
+++ b/modules/platforms/cpp/odbc/install/install_amd64.cmd
@@ -7,7 +7,9 @@ if [%ODBC_AMD64%] == [] (
echo error: 64-bit driver is not specified. Call format: install_amd64 abs_path_to_64_bit_driver [abs_path_to_32_bit_driver]
pause
exit /b 1
-) else if exist %ODBC_AMD64% (
+)
+
+if exist %ODBC_AMD64% (
if exist %ODBC_AMD64%\ (
echo warning: The path you have specified seems to be a directory. Note that you have to specify path to driver file itself instead.
)
@@ -26,7 +28,11 @@ if [%ODBC_AMD64%] == [] (
if [%ODBC_X86%] == [] (
echo warning: 32-bit driver is not specified. If you want to install 32-bit driver please specify path to it as a second argument.
-) else if exist %ODBC_X86% (
+ pause
+ exit /b 1
+)
+
+if exist %ODBC_X86% (
if exist %ODBC_X86%\ (
echo warning: The path you have specified seems to be a directory. Note that you have to specify path to driver file itself instead.
)
http://git-wip-us.apache.org/repos/asf/ignite/blob/67bd32c2/modules/platforms/cpp/odbc/install/install_x86.cmd
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/install/install_x86.cmd b/modules/platforms/cpp/odbc/install/install_x86.cmd
index 93ced4b..911dbdf 100644
--- a/modules/platforms/cpp/odbc/install/install_x86.cmd
+++ b/modules/platforms/cpp/odbc/install/install_x86.cmd
@@ -5,7 +5,10 @@ set ODBC=%1
if [%ODBC%] == [] (
echo error: driver is not specified. Call format: install_x86 abs_path_to_driver.
pause
-) else if exist %ODBC% (
+ exit /b 1
+)
+
+if exist %ODBC% (
if exist %ODBC%\ (
echo warning: The path you have specified seems to be a directory. Note that you have to specify path to driver file itself instead.
)
@@ -19,4 +22,5 @@ if [%ODBC%] == [] (
echo Driver can not be found: %ODBC%
echo Call format: install_x86 abs_path_to_driver
pause
+ exit /b 1
)
[24/33] ignite git commit: IGNITE-4200: Added copying of the C++
binaries during build.
Posted by vo...@apache.org.
IGNITE-4200: Added copying of the C++ binaries during build.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/89eb1759
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/89eb1759
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/89eb1759
Branch: refs/heads/ignite-4565-ddl
Commit: 89eb175915c0aa293742cad9e7374757be1acbe6
Parents: 2544bfd
Author: Igor Sapego <is...@gridgain.com>
Authored: Fri Mar 17 17:33:57 2017 +0300
Committer: Igor Sapego <is...@gridgain.com>
Committed: Mon Mar 20 15:20:22 2017 +0300
----------------------------------------------------------------------
assembly/release-fabric-base.xml | 6 ++++++
1 file changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/89eb1759/assembly/release-fabric-base.xml
----------------------------------------------------------------------
diff --git a/assembly/release-fabric-base.xml b/assembly/release-fabric-base.xml
index d7aa0a2..4f2a795 100644
--- a/assembly/release-fabric-base.xml
+++ b/assembly/release-fabric-base.xml
@@ -178,6 +178,12 @@
<directory>modules/clients/target/cppdoc/html</directory>
<outputDirectory>/platforms/cpp/docs</outputDirectory>
</fileSet>
+
+ <!-- Move CPP binaries. -->
+ <fileSet>
+ <directory>modules/platforms/cpp/bin</directory>
+ <outputDirectory>/platforms/cpp/bin</outputDirectory>
+ </fileSet>
<!-- Other files. -->
<fileSet>
[03/33] ignite git commit: IGNITE-4147 - Throw exception on
connecting node to cluster with different SSL configuration
Posted by vo...@apache.org.
IGNITE-4147 - Throw exception on connecting node to cluster with different SSL configuration
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1f881aa7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1f881aa7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1f881aa7
Branch: refs/heads/ignite-4565-ddl
Commit: 1f881aa70a3894af01135f4cc5e341a8130462c2
Parents: 8874f99
Author: dkarachentsev <dk...@gridgain.com>
Authored: Fri Feb 17 12:34:41 2017 +0300
Committer: dkarachentsev <dk...@gridgain.com>
Committed: Fri Feb 17 12:34:41 2017 +0300
----------------------------------------------------------------------
.../ignite/spi/discovery/tcp/ClientImpl.java | 30 ++-
.../ignite/spi/discovery/tcp/ServerImpl.java | 19 ++
.../TcpDiscoverySslSecuredUnsecuredTest.java | 185 +++++++++++++++++++
.../IgniteSpiDiscoverySelfTestSuite.java | 2 +
4 files changed, 235 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/1f881aa7/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
index 932e7d1..95e2cda 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
@@ -20,6 +20,7 @@ package org.apache.ignite.spi.discovery.tcp;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.io.StreamCorruptedException;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketTimeoutException;
@@ -44,6 +45,7 @@ import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.atomic.AtomicReference;
+import javax.net.ssl.SSLException;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteClientDisconnectedException;
import org.apache.ignite.IgniteException;
@@ -587,6 +589,8 @@ class ClientImpl extends TcpDiscoveryImpl {
int connectAttempts = 1;
+ int sslConnectAttempts = 3;
+
UUID locNodeId = getLocalNodeId();
IgniteSpiOperationTimeoutHelper timeoutHelper = new IgniteSpiOperationTimeoutHelper(spi);
@@ -662,6 +666,22 @@ class ClientImpl extends TcpDiscoveryImpl {
errs.add(e);
+ if (X.hasCause(e, SSLException.class)) {
+ if (--sslConnectAttempts == 0)
+ throw new IgniteSpiException("Unable to establish secure connection. " +
+ "Was remote cluster configured with SSL? [rmtAddr=" + addr + ", errMsg=\"" + e.getMessage() + "\"]", e);
+
+ continue;
+ }
+
+ if (X.hasCause(e, StreamCorruptedException.class)) {
+ if (--sslConnectAttempts == 0)
+ throw new IgniteSpiException("Unable to establish plain connection. " +
+ "Was remote cluster configured with SSL? [rmtAddr=" + addr + ", errMsg=\"" + e.getMessage() + "\"]", e);
+
+ continue;
+ }
+
if (timeoutHelper.checkFailureTimeoutReached(e))
break;
@@ -1593,7 +1613,15 @@ class ClientImpl extends TcpDiscoveryImpl {
joinCnt++;
- T2<SocketStream, Boolean> joinRes = joinTopology(false, spi.joinTimeout);
+ T2<SocketStream, Boolean> joinRes;
+ try {
+ joinRes = joinTopology(false, spi.joinTimeout);
+ }
+ catch (IgniteSpiException e) {
+ joinError(e);
+
+ return;
+ }
if (joinRes == null) {
if (join)
http://git-wip-us.apache.org/repos/asf/ignite/blob/1f881aa7/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 d462ac2..4600be0 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
@@ -24,6 +24,7 @@ import java.io.InputStream;
import java.io.ObjectStreamException;
import java.io.OutputStream;
import java.io.Serializable;
+import java.io.StreamCorruptedException;
import java.net.ConnectException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
@@ -1109,6 +1110,8 @@ class ServerImpl extends TcpDiscoveryImpl {
int connectAttempts = 1;
+ int sslConnectAttempts = 3;
+
boolean joinReqSent;
UUID locNodeId = getLocalNodeId();
@@ -1220,6 +1223,22 @@ class ServerImpl extends TcpDiscoveryImpl {
errs.add(e);
+ if (X.hasCause(e, SSLException.class)) {
+ if (--sslConnectAttempts == 0)
+ throw new IgniteException("Unable to establish secure connection. " +
+ "Was remote cluster configured with SSL? [rmtAddr=" + addr + ", errMsg=\"" + e.getMessage() + "\"]", e);
+
+ continue;
+ }
+
+ if (X.hasCause(e, StreamCorruptedException.class)) {
+ if (--sslConnectAttempts == 0)
+ throw new IgniteException("Unable to establish plain connection. " +
+ "Was remote cluster configured with SSL? [rmtAddr=" + addr + ", errMsg=\"" + e.getMessage() + "\"]", e);
+
+ continue;
+ }
+
if (timeoutHelper.checkFailureTimeoutReached(e))
break;
http://git-wip-us.apache.org/repos/asf/ignite/blob/1f881aa7/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySslSecuredUnsecuredTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySslSecuredUnsecuredTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySslSecuredUnsecuredTest.java
new file mode 100644
index 0000000..ca34f77
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySslSecuredUnsecuredTest.java
@@ -0,0 +1,185 @@
+/*
+ * 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.spi.discovery.tcp;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StreamCorruptedException;
+import java.net.Socket;
+import java.util.concurrent.Callable;
+import javax.net.ssl.SSLException;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Tests cases when node connects to cluster with different SSL configuration.
+ * Exception with meaningful message should be thrown.
+ */
+public class TcpDiscoverySslSecuredUnsecuredTest extends GridCommonAbstractTest {
+ /** */
+ private volatile TcpDiscoverySpi spi;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(final String gridName) throws Exception {
+ final IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ cfg.setClientMode(gridName.contains("client"));
+
+ if (gridName.contains("ssl"))
+ cfg.setSslContextFactory(GridTestUtils.sslFactory());
+
+ if (spi != null) {
+ final TcpDiscoveryIpFinder finder = ((TcpDiscoverySpi)cfg.getDiscoverySpi()).getIpFinder();
+
+ spi.setIpFinder(finder);
+
+ cfg.setDiscoverySpi(spi);
+ }
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testSecuredUnsecuredServerConnection() throws Exception {
+ checkConnection("plain-server", "ssl-server");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testUnsecuredSecuredServerConnection() throws Exception {
+ checkConnection("ssl-server", "plain-server");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testSecuredClientUnsecuredServerConnection() throws Exception {
+ checkConnection("plain-server", "ssl-client");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testUnsecuredClientSecuredServerConnection() throws Exception {
+ checkConnection("ssl-server", "plain-client");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPlainServerNodesRestart() throws Exception {
+ checkNodesRestart("plain-server-1", "plain-server-2");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testSslServerNodesRestart() throws Exception {
+ checkNodesRestart("ssl-server-1", "ssl-server-2");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPlainClientNodesRestart() throws Exception {
+ checkNodesRestart("plain-server", "plain-client");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testSslClientNodesRestart() throws Exception {
+ checkNodesRestart("ssl-server", "ssl-client");
+ }
+
+ /**
+ * @param name1 First grid name.
+ * @param name2 Second grid name.
+ * @throws Exception If failed.
+ */
+ private void checkNodesRestart(String name1, String name2) throws Exception {
+ startGrid(name1);
+
+ spi = new FailDiscoverySpi(!name1.contains("ssl"));
+
+ startGrid(name2);
+ }
+
+ /**
+ * @param name1 First grid name.
+ * @param name2 Second grid name.
+ * @throws Exception If failed.
+ */
+ @SuppressWarnings("ThrowableNotThrown")
+ private void checkConnection(final String name1, final String name2) throws Exception {
+ startGrid(name1);
+
+ GridTestUtils.assertThrows(null, new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ startGrid(name2);
+
+ return null;
+ }
+ }, IgniteCheckedException.class, null);
+ }
+
+ /**
+ *
+ */
+ private class FailDiscoverySpi extends TcpDiscoverySpi {
+ /** */
+ private int cnt = 1;
+
+ /** */
+ private final boolean plain;
+
+ /**
+ * @param plain Plain conection flag.
+ */
+ private FailDiscoverySpi(final boolean plain) {
+ this.plain = plain;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected <T> T readMessage(final Socket sock, @Nullable final InputStream in,
+ final long timeout) throws IOException, IgniteCheckedException {
+ if (cnt-- > 0) {
+ if (plain)
+ throw new StreamCorruptedException("Test exception");
+ else
+ throw new SSLException("Test SSL exception");
+ }
+
+ return super.readMessage(sock, in, timeout);
+ }
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1f881aa7/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiDiscoverySelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiDiscoverySelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiDiscoverySelfTestSuite.java
index 548e1a5..e6b39f7 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiDiscoverySelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiDiscoverySelfTestSuite.java
@@ -35,6 +35,7 @@ import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpiConfigSelfTest;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpiFailureTimeoutSelfTest;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpiSelfTest;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpiStartStopSelfTest;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySslSecuredUnsecuredTest;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySslSelfTest;
import org.apache.ignite.spi.discovery.tcp.ipfinder.jdbc.TcpDiscoveryJdbcIpFinderSelfTest;
import org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinderSelfTest;
@@ -89,6 +90,7 @@ public class IgniteSpiDiscoverySelfTestSuite extends TestSuite {
// SSL.
suite.addTest(new TestSuite(TcpDiscoverySslSelfTest.class));
+ suite.addTest(new TestSuite(TcpDiscoverySslSecuredUnsecuredTest.class));
return suite;
}