You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2016/10/28 12:17:32 UTC
[01/20] ignite git commit: GG-11360 - Implement SQL queries
cancellation (#18)
Repository: ignite
Updated Branches:
refs/heads/ignite-4111 [created] d1bc4cb2f
http://git-wip-us.apache.org/repos/asf/ignite/blob/80abd1b7/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest.java
new file mode 100644
index 0000000..f75c907
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest.java
@@ -0,0 +1,248 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.near;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.TimeUnit;
+import javax.cache.CacheException;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.query.QueryCursor;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.cache.query.QueryCancelledException;
+import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
+import org.apache.ignite.internal.util.typedef.G;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ * Tests distributed SQL queries cancel by user or timeout.
+ */
+public class IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest extends GridCommonAbstractTest {
+ /** Grids count. */
+ private static final int GRIDS_COUNT = 3;
+
+ /** IP finder. */
+ private static final TcpDiscoveryVmIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** Cache size. */
+ public static final int CACHE_SIZE = 10_000;
+
+ /** Value size. */
+ public static final int VAL_SIZE = 16;
+
+ /** */
+ private static final String QUERY_1 = "select a._val, b._val from String a, String b";
+
+ /** */
+ private static final String QUERY_2 = "select a._key, count(*) from String a group by a._key";
+
+ /** */
+ private static final String QUERY_3 = "select a._val from String a";
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ super.beforeTestsStarted();
+
+ startGridsMultiThreaded(GRIDS_COUNT);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+ TcpDiscoverySpi spi = (TcpDiscoverySpi)cfg.getDiscoverySpi();
+ spi.setIpFinder(IP_FINDER);
+
+ CacheConfiguration<Integer, String> ccfg = new CacheConfiguration<>();
+ ccfg.setIndexedTypes(Integer.class, String.class);
+
+ cfg.setCacheConfiguration(ccfg);
+
+ if ("client".equals(gridName))
+ cfg.setClientMode(true);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ super.afterTest();
+
+ for (Ignite g : G.allGrids())
+ g.cache(null).removeAll();
+ }
+
+ /** */
+ public void testRemoteQueryExecutionTimeout() throws Exception {
+ testQuery(CACHE_SIZE, VAL_SIZE, QUERY_1, 500, TimeUnit.MILLISECONDS, true);
+ }
+
+ /** */
+ public void testRemoteQueryWithMergeTableTimeout() throws Exception {
+ testQuery(CACHE_SIZE, VAL_SIZE, QUERY_2, 500, TimeUnit.MILLISECONDS, true);
+ }
+
+ /** */
+ public void testRemoteQueryExecutionCancel0() throws Exception {
+ testQuery(CACHE_SIZE, VAL_SIZE, QUERY_1, 1, TimeUnit.MILLISECONDS, false);
+ }
+
+ /** */
+ public void testRemoteQueryExecutionCancel1() throws Exception {
+ testQuery(CACHE_SIZE, VAL_SIZE, QUERY_1, 500, TimeUnit.MILLISECONDS, false);
+ }
+
+ /** */
+ public void testRemoteQueryExecutionCancel2() throws Exception {
+ testQuery(CACHE_SIZE, VAL_SIZE, QUERY_1, 1, TimeUnit.SECONDS, false);
+ }
+
+ /** */
+ public void testRemoteQueryExecutionCancel3() throws Exception {
+ testQuery(CACHE_SIZE, VAL_SIZE, QUERY_1, 3, TimeUnit.SECONDS, false);
+ }
+
+ /** */
+ public void testRemoteQueryWithMergeTableCancel0() throws Exception {
+ testQuery(CACHE_SIZE, VAL_SIZE, QUERY_2, 1, TimeUnit.MILLISECONDS, false);
+ }
+
+ /** */
+ public void testRemoteQueryWithMergeTableCancel1() throws Exception {
+ testQuery(CACHE_SIZE, VAL_SIZE, QUERY_2, 500, TimeUnit.MILLISECONDS, false);
+ }
+
+ /** */
+ public void testRemoteQueryWithMergeTableCancel2() throws Exception {
+ testQuery(CACHE_SIZE, VAL_SIZE, QUERY_2, 1_500, TimeUnit.MILLISECONDS, false);
+ }
+
+ /** */
+ public void testRemoteQueryWithMergeTableCancel3() throws Exception {
+ testQuery(CACHE_SIZE, VAL_SIZE, QUERY_2, 3, TimeUnit.SECONDS, false);
+ }
+
+ /** */
+ public void testRemoteQueryWithoutMergeTableCancel0() throws Exception {
+ testQuery(CACHE_SIZE, VAL_SIZE, QUERY_3, 1, TimeUnit.MILLISECONDS, false);
+ }
+
+ /** */
+ public void testRemoteQueryWithoutMergeTableCancel1() throws Exception {
+ testQuery(CACHE_SIZE, VAL_SIZE, QUERY_3, 500, TimeUnit.MILLISECONDS, false);
+ }
+
+ /** */
+ public void testRemoteQueryWithoutMergeTableCancel2() throws Exception {
+ testQuery(CACHE_SIZE, VAL_SIZE, QUERY_3, 1_000, TimeUnit.MILLISECONDS, false);
+ }
+
+ /** */
+ public void testRemoteQueryWithoutMergeTableCancel3() throws Exception {
+ testQuery(CACHE_SIZE, VAL_SIZE, QUERY_3, 3, TimeUnit.SECONDS, false);
+ }
+
+ /** */
+ public void testRemoteQueryAlreadyFinishedStop() throws Exception {
+ testQuery(100, VAL_SIZE, QUERY_3, 3, TimeUnit.SECONDS, false);
+ }
+
+ /** */
+ private void testQuery(int keyCnt, int valSize, String sql, int timeoutUnits, TimeUnit timeUnit,
+ boolean timeout) throws Exception {
+ try (Ignite client = startGrid("client")) {
+
+ IgniteCache<Object, Object> cache = client.cache(null);
+
+ assertEquals(0, cache.localSize());
+
+ int p = 1;
+ for (int i = 1; i <= keyCnt; i++) {
+ char[] tmp = new char[valSize];
+ Arrays.fill(tmp, ' ');
+ cache.put(i, new String(tmp));
+
+ if (i/(float)keyCnt >= p/10f) {
+ log().info("Loaded " + i + " of " + keyCnt);
+
+ p++;
+ }
+ }
+
+ assertEquals(0, cache.localSize());
+
+ SqlFieldsQuery qry = new SqlFieldsQuery(sql);
+
+ final QueryCursor<List<?>> cursor;
+ if (timeout) {
+ qry.setTimeout(timeoutUnits, timeUnit);
+
+ cursor = cache.query(qry);
+ } else {
+ cursor = cache.query(qry);
+
+ client.scheduler().runLocal(new Runnable() {
+ @Override public void run() {
+ cursor.close();
+ }
+ }, timeoutUnits, timeUnit);
+ }
+
+ try(QueryCursor<List<?>> ignored = cursor) {
+ cursor.iterator();
+ }
+ catch (CacheException ex) {
+ log().error("Got expected exception", ex);
+
+ assertTrue("Must throw correct exception", ex.getCause() instanceof QueryCancelledException);
+ }
+
+ // Give some time to clean up.
+ Thread.sleep(TimeUnit.MILLISECONDS.convert(timeoutUnits, timeUnit) + 3_000);
+
+ checkCleanState();
+ }
+ }
+
+ /**
+ * Validates clean state on all participating nodes after query cancellation.
+ */
+ private void checkCleanState() {
+ for (int i = 0; i < GRIDS_COUNT; i++) {
+ IgniteEx grid = grid(i);
+
+ // Validate everything was cleaned up.
+ ConcurrentMap<UUID, ConcurrentMap<Long, ?>> map = U.field(((IgniteH2Indexing)U.field(U.field(
+ grid.context(), "qryProc"), "idx")).mapQueryExecutor(), "qryRess");
+
+ String msg = "Map executor state is not cleared";
+
+ // TODO FIXME Current implementation leaves map entry for each node that's ever executed a query.
+ for (ConcurrentMap<Long, ?> results : map.values())
+ assertEquals(msg, 0, results.size());
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/80abd1b7/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java
index 2fa4750..8b33a46 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java
@@ -33,7 +33,10 @@ import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteFutureTimeoutCheckedException;
import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.IgniteInterruptedCheckedException;
+import org.apache.ignite.cache.query.QueryCancelledException;
import org.apache.ignite.internal.util.GridRandom;
import org.apache.ignite.internal.util.typedef.CAX;
import org.apache.ignite.internal.util.typedef.F;
@@ -224,58 +227,77 @@ public class IgniteCacheQueryNodeRestartSelfTest2 extends GridCommonAbstractTest
}
while (!locks.compareAndSet(g, 0, 1));
- if (rnd.nextBoolean()) { // Partitioned query.
- IgniteCache<?,?> cache = grid(g).cache("pu");
+ try {
+ if (rnd.nextBoolean()) { // Partitioned query.
+ IgniteCache<?,?> cache = grid(g).cache("pu");
- SqlFieldsQuery qry = new SqlFieldsQuery(PARTITIONED_QRY);
+ SqlFieldsQuery qry = new SqlFieldsQuery(PARTITIONED_QRY);
- boolean smallPageSize = rnd.nextBoolean();
+ boolean smallPageSize = rnd.nextBoolean();
- if (smallPageSize)
- qry.setPageSize(3);
+ if (smallPageSize)
+ qry.setPageSize(3);
- try {
- assertEquals(pRes, cache.query(qry).getAll());
- }
- catch (CacheException e) {
- if (!smallPageSize)
- e.printStackTrace();
+ try {
+ assertEquals(pRes, cache.query(qry).getAll());
+ } catch (CacheException e) {
+ // Interruptions are expected here.
+ if (e.getCause() instanceof IgniteInterruptedCheckedException)
+ continue;
- assertTrue("On large page size must retry.", smallPageSize);
+ if (e.getCause() instanceof QueryCancelledException)
+ fail("Retry is expected");
- boolean failedOnRemoteFetch = false;
+ if (!smallPageSize)
+ e.printStackTrace();
- for (Throwable th = e; th != null; th = th.getCause()) {
- if (!(th instanceof CacheException))
- continue;
+ assertTrue("On large page size must retry.", smallPageSize);
+
+ boolean failedOnRemoteFetch = false;
+ boolean failedOnInterruption = false;
+
+ for (Throwable th = e; th != null; th = th.getCause()) {
+ if (th instanceof InterruptedException) {
+ failedOnInterruption = true;
- if (th.getMessage() != null &&
- th.getMessage().startsWith("Failed to fetch data from node:")) {
- failedOnRemoteFetch = true;
+ break;
+ }
- break;
+ if (!(th instanceof CacheException))
+ continue;
+
+ if (th.getMessage() != null &&
+ th.getMessage().startsWith("Failed to fetch data from node:")) {
+ failedOnRemoteFetch = true;
+
+ break;
+ }
}
- }
- if (!failedOnRemoteFetch) {
- e.printStackTrace();
+ // Interruptions are expected here.
+ if (failedOnInterruption)
+ continue;
- fail("Must fail inside of GridResultPage.fetchNextPage or subclass.");
- }
- }
- }
- else { // Replicated query.
- IgniteCache<?,?> cache = grid(g).cache("co");
+ if (!failedOnRemoteFetch) {
+ e.printStackTrace();
- assertEquals(rRes, cache.query(new SqlFieldsQuery(REPLICATED_QRY)).getAll());
- }
+ fail("Must fail inside of GridResultPage.fetchNextPage or subclass.");
+ }
+ }
+ } else { // Replicated query.
+ IgniteCache<?, ?> cache = grid(g).cache("co");
- locks.set(g, 0);
+ assertEquals(rRes, cache.query(new SqlFieldsQuery(REPLICATED_QRY)).getAll());
+ }
+ } finally {
+ // Clearing lock in final handler to avoid endless loop if exception is thrown.
+ locks.set(g, 0);
- int c = qryCnt.incrementAndGet();
+ int c = qryCnt.incrementAndGet();
- if (c % logFreq == 0)
- info("Executed queries: " + c);
+ if (c % logFreq == 0)
+ info("Executed queries: " + c);
+ }
}
}
}, qryThreadNum, "query-thread");
@@ -297,24 +319,26 @@ public class IgniteCacheQueryNodeRestartSelfTest2 extends GridCommonAbstractTest
}
while (!locks.compareAndSet(g, 0, -1));
- log.info("Stop node: " + g);
-
- stopGrid(g);
+ try {
+ log.info("Stop node: " + g);
- Thread.sleep(rnd.nextInt(nodeLifeTime));
+ stopGrid(g);
- log.info("Start node: " + g);
+ Thread.sleep(rnd.nextInt(nodeLifeTime));
- startGrid(g);
+ log.info("Start node: " + g);
- Thread.sleep(rnd.nextInt(nodeLifeTime));
+ startGrid(g);
- locks.set(g, 0);
+ Thread.sleep(rnd.nextInt(nodeLifeTime));
+ } finally {
+ locks.set(g, 0);
- int c = restartCnt.incrementAndGet();
+ int c = restartCnt.incrementAndGet();
- if (c % logFreq == 0)
- info("Node restarts: " + c);
+ if (c % logFreq == 0)
+ info("Node restarts: " + c);
+ }
}
return true;
@@ -333,7 +357,12 @@ public class IgniteCacheQueryNodeRestartSelfTest2 extends GridCommonAbstractTest
qrysDone.set(true);
- fut1.get();
+ // Query thread can stuck in next page waiting loop because all nodes are left.
+ try {
+ fut1.get(5_000);
+ } catch (IgniteFutureTimeoutCheckedException e) {
+ fut1.cancel();
+ }
info("Queries stopped.");
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/80abd1b7/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/local/IgniteCacheLocalQueryCancelOrTimeoutSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/local/IgniteCacheLocalQueryCancelOrTimeoutSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/local/IgniteCacheLocalQueryCancelOrTimeoutSelfTest.java
new file mode 100644
index 0000000..68ecdff
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/local/IgniteCacheLocalQueryCancelOrTimeoutSelfTest.java
@@ -0,0 +1,158 @@
+/*
+ * 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.local;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.query.QueryCursor;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.cache.query.QueryCancelledException;
+import org.apache.ignite.internal.util.typedef.G;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+import static org.apache.ignite.cache.CacheMode.LOCAL;
+
+/**
+ * Tests local query cancellations and timeouts.
+ */
+public class IgniteCacheLocalQueryCancelOrTimeoutSelfTest extends GridCommonAbstractTest {
+ /** Cache size. */
+ private static final int CACHE_SIZE = 10_000;
+
+ /** */
+ private static final String QUERY = "select a._val, b._val from String a, String b";
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ CacheConfiguration<Integer, String> ccfg = new CacheConfiguration<>();
+ ccfg.setIndexedTypes(Integer.class, String.class);
+ ccfg.setCacheMode(LOCAL);
+
+ cfg.setCacheConfiguration(ccfg);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ super.beforeTestsStarted();
+
+ startGrid(0);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ super.afterTest();
+
+ for (Ignite g : G.allGrids())
+ g.cache(null).removeAll();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ super.afterTestsStopped();
+
+ stopAllGrids();
+ }
+
+ /**
+ * @param cache Cache.
+ */
+ private void loadCache(IgniteCache<Integer, String> cache) {
+ int p = 1;
+
+ for (int i = 1; i <= CACHE_SIZE; i++) {
+ char[] tmp = new char[256];
+ Arrays.fill(tmp, ' ');
+ cache.put(i, new String(tmp));
+
+ if (i / (float)CACHE_SIZE >= p / 10f) {
+ log().info("Loaded " + i + " of " + CACHE_SIZE);
+
+ p++;
+ }
+ }
+ }
+
+ /**
+ * Tests cancellation.
+ */
+ public void testQueryCancel() {
+ testQuery(false, 1, TimeUnit.SECONDS);
+ }
+
+ /**
+ * Tests cancellation with zero timeout.
+ */
+ public void testQueryCancelZeroTimeout() {
+ testQuery(false, 1, TimeUnit.MILLISECONDS);
+ }
+
+ /**
+ * Tests timeout.
+ */
+ public void testQueryTimeout() {
+ testQuery(true, 1, TimeUnit.SECONDS);
+ }
+
+ /**
+ * Tests cancellation.
+ */
+ private void testQuery(boolean timeout, int timeoutUnits, TimeUnit timeUnit) {
+ Ignite ignite = grid(0);
+
+ IgniteCache<Integer, String> cache = ignite.cache(null);
+
+ loadCache(cache);
+
+ SqlFieldsQuery qry = new SqlFieldsQuery(QUERY);
+
+ final QueryCursor<List<?>> cursor;
+ if (timeout) {
+ qry.setTimeout(timeoutUnits, timeUnit);
+
+ cursor = cache.query(qry);
+ } else {
+ cursor = cache.query(qry);
+
+ ignite.scheduler().runLocal(new Runnable() {
+ @Override public void run() {
+ cursor.close();
+ }
+ }, timeoutUnits, timeUnit);
+ }
+
+ try(QueryCursor<List<?>> ignored = cursor) {
+ cursor.iterator();
+
+ fail("Expecting timeout");
+ }
+ catch (Exception e) {
+ assertTrue("Must throw correct exception", e.getCause() instanceof QueryCancelledException);
+ }
+
+ // Test must exit gracefully.
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/80abd1b7/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 0da71c8..289c7d7 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
@@ -347,8 +347,8 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract
// Fields query
GridQueryFieldsResult fieldsRes =
- spi.queryFields("A", "select a.a.name n1, a.a.age a1, b.a.name n2, " +
- "b.a.age a2 from a.a, b.a where a.a.id = b.a.id ", Collections.emptySet(), null);
+ spi.execute("A", "select a.a.name n1, a.a.age a1, b.a.name n2, " +
+ "b.a.age a2 from a.a, b.a where a.a.id = b.a.id ", Collections.emptySet(), null, 0, null);
String[] aliases = {"N1", "A1", "N2", "A2"};
Object[] vals = { "Valera", 19, "Kolya", 25};
@@ -447,7 +447,7 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract
time = now;
range *= 3;
- GridQueryFieldsResult res = spi.queryFields("A", sql, Arrays.<Object>asList(1, range), null);
+ GridQueryFieldsResult res = spi.execute("A", sql, Arrays.<Object>asList(1, range), null, 0, null);
assert res.iterator().hasNext();
@@ -552,8 +552,7 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract
return name;
}
- @Override
- public Class<?> type() {
+ @Override public Class<?> type() {
return Object.class;
}
};
http://git-wip-us.apache.org/repos/asf/ignite/blob/80abd1b7/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite2.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite2.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite2.java
index 40fc157..9128f76 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite2.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite2.java
@@ -34,11 +34,14 @@ import org.apache.ignite.internal.processors.cache.IgniteCacheP2pUnmarshallingQu
import org.apache.ignite.internal.processors.cache.SqlFieldsQuerySelfTest;
import org.apache.ignite.internal.processors.cache.distributed.near.IgniteCacheAtomicFieldsQuerySelfTest;
import org.apache.ignite.internal.processors.cache.distributed.near.IgniteCacheAtomicNearEnabledFieldsQuerySelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.near.IgniteCacheDistributedQueryCancelSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.near.IgniteCachePartitionedFieldsQueryP2PEnabledSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.near.IgniteCachePartitionedFieldsQuerySelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.near.IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.replicated.IgniteCacheReplicatedFieldsQueryP2PEnabledSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.replicated.IgniteCacheReplicatedFieldsQuerySelfTest;
import org.apache.ignite.internal.processors.cache.local.IgniteCacheLocalFieldsQuerySelfTest;
+import org.apache.ignite.internal.processors.cache.local.IgniteCacheLocalQueryCancelOrTimeoutSelfTest;
import org.apache.ignite.internal.processors.cache.query.GridCacheSwapScanQuerySelfTest;
import org.apache.ignite.internal.processors.cache.reducefields.GridCacheReduceFieldsQueryAtomicSelfTest;
import org.apache.ignite.internal.processors.cache.reducefields.GridCacheReduceFieldsQueryLocalSelfTest;
@@ -103,6 +106,11 @@ public class IgniteCacheQuerySelfTestSuite2 extends TestSuite {
suite.addTestSuite(IgniteCacheP2pUnmarshallingQueryErrorTest.class);
suite.addTestSuite(IgniteCacheNoClassQuerySelfTest.class);
+ // Cancellation.
+ suite.addTestSuite(IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest.class);
+ suite.addTestSuite(IgniteCacheDistributedQueryCancelSelfTest.class);
+ suite.addTestSuite(IgniteCacheLocalQueryCancelOrTimeoutSelfTest.class);
+
// Other.
suite.addTestSuite(CacheQueryNewClientSelfTest.class);
suite.addTestSuite(CacheOffheapBatchIndexingSingleTypeTest.class);
[04/20] ignite git commit: Fixed indexing test in according to
changes from #80abd1b.
Posted by sb...@apache.org.
Fixed indexing test in according to changes from #80abd1b.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d3f042b9
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d3f042b9
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d3f042b9
Branch: refs/heads/ignite-4111
Commit: d3f042b9ba6c605500ab7155c40a41850babefdb
Parents: 43ac3f5
Author: sboikov <sb...@gridgain.com>
Authored: Mon Oct 17 12:28:31 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Oct 17 12:28:31 2016 +0300
----------------------------------------------------------------------
.../query/h2/GridIndexingSpiAbstractSelfTest.java | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d3f042b9/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 289c7d7..6e493ea 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
@@ -40,6 +40,7 @@ import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.plugin.extensions.communication.MessageReader;
import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+import org.apache.ignite.spi.IgniteSpiCloseableIterator;
import org.apache.ignite.spi.IgniteSpiException;
import org.apache.ignite.testframework.GridStringLogger;
import org.apache.ignite.testframework.GridTestUtils;
@@ -353,9 +354,11 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract
String[] aliases = {"N1", "A1", "N2", "A2"};
Object[] vals = { "Valera", 19, "Kolya", 25};
- assertTrue(fieldsRes.iterator().hasNext());
+ IgniteSpiCloseableIterator<List<?>> it = fieldsRes.iterator();
- List<?> fields = fieldsRes.iterator().next();
+ assertTrue(it.hasNext());
+
+ List<?> fields = it.next();
assertEquals(4, fields.size());
@@ -366,7 +369,7 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract
assertEquals(vals[i++], f);
}
- assertFalse(fieldsRes.iterator().hasNext());
+ assertFalse(it.hasNext());
// Remove
spi.remove(typeAA.space(), key(2), aa(2, "Valera", 19));
[07/20] ignite git commit: IGNITE-4090: CPP: Fixed compilation for
GCC 4.4.7. This closes #1165.
Posted by sb...@apache.org.
IGNITE-4090: CPP: Fixed compilation for GCC 4.4.7. This closes #1165.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/44eff48f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/44eff48f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/44eff48f
Branch: refs/heads/ignite-4111
Commit: 44eff48f72d2a4c5c6a9a2ba6ed903834bcb63f9
Parents: 717e91f
Author: Igor Sapego <is...@gridgain.com>
Authored: Tue Oct 18 11:53:46 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Oct 18 11:53:46 2016 +0300
----------------------------------------------------------------------
modules/platforms/cpp/common/Makefile.am | 4 +++-
.../cpp/common/include/ignite/common/concurrent.h | 5 +++--
.../platforms/cpp/common/include/ignite/ignite_error.h | 4 ++--
modules/platforms/cpp/common/src/ignite_error.cpp | 4 ++--
modules/platforms/cpp/core-test/Makefile.am | 10 ++++++----
modules/platforms/cpp/core-test/src/decimal_test.cpp | 2 +-
.../platforms/cpp/core-test/src/interop_memory_test.cpp | 5 +++--
modules/platforms/cpp/jni/src/java.cpp | 2 +-
modules/platforms/cpp/odbc-test/Makefile.am | 4 +++-
modules/platforms/cpp/odbc-test/src/queries_test.cpp | 4 ++--
modules/platforms/cpp/odbc/src/config/configuration.cpp | 2 +-
11 files changed, 27 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/44eff48f/modules/platforms/cpp/common/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/Makefile.am b/modules/platforms/cpp/common/Makefile.am
index c230384..2d16c2d 100644
--- a/modules/platforms/cpp/common/Makefile.am
+++ b/modules/platforms/cpp/common/Makefile.am
@@ -26,7 +26,9 @@ SUBDIRS = \
AM_CPPFLAGS = \
-I$(srcdir)/include \
-I$(srcdir)/os/linux/include \
- -DIGNITE_IMPL
+ -DIGNITE_IMPL \
+ -D__STDC_LIMIT_MACROS \
+ -D__STDC_CONSTANT_MACROS
AM_CXXFLAGS = \
-Wall \
http://git-wip-us.apache.org/repos/asf/ignite/blob/44eff48f/modules/platforms/cpp/common/include/ignite/common/concurrent.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/include/ignite/common/concurrent.h b/modules/platforms/cpp/common/include/ignite/common/concurrent.h
index 465e02e..35c2209 100644
--- a/modules/platforms/cpp/common/include/ignite/common/concurrent.h
+++ b/modules/platforms/cpp/common/include/ignite/common/concurrent.h
@@ -138,7 +138,8 @@ namespace ignite
{
if (ptr)
{
- impl = new SharedPointerImpl(ptr, reinterpret_cast<SharedPointerImpl::DeleterType>(&SharedPointerDefaultDeleter<T>));
+ void(*deleter)(T*) = (void(*)(T*)) &SharedPointerDefaultDeleter<T>;
+ impl = new SharedPointerImpl(ptr, reinterpret_cast<SharedPointerImpl::DeleterType>(deleter));
ImplEnableShared(ptr, impl);
}
else
@@ -360,4 +361,4 @@ namespace ignite
}
}
-#endif //_IGNITE_COMMON_CONCURRENT
\ No newline at end of file
+#endif //_IGNITE_COMMON_CONCURRENT
http://git-wip-us.apache.org/repos/asf/ignite/blob/44eff48f/modules/platforms/cpp/common/include/ignite/ignite_error.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/include/ignite/ignite_error.h b/modules/platforms/cpp/common/include/ignite/ignite_error.h
index 17a24dc..4c5c06e 100644
--- a/modules/platforms/cpp/common/include/ignite/ignite_error.h
+++ b/modules/platforms/cpp/common/include/ignite/ignite_error.h
@@ -245,7 +245,7 @@ namespace ignite
/**
* Destructor.
*/
- ~IgniteError();
+ ~IgniteError() IGNITE_NO_THROW;
/**
* Get error code.
@@ -291,4 +291,4 @@ namespace ignite
# pragma warning(pop)
#endif //_MSC_VER
-#endif //_IGNITE_IGNITE_ERROR
\ No newline at end of file
+#endif //_IGNITE_IGNITE_ERROR
http://git-wip-us.apache.org/repos/asf/ignite/blob/44eff48f/modules/platforms/cpp/common/src/ignite_error.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/src/ignite_error.cpp b/modules/platforms/cpp/common/src/ignite_error.cpp
index 8179184..3076d7a 100644
--- a/modules/platforms/cpp/common/src/ignite_error.cpp
+++ b/modules/platforms/cpp/common/src/ignite_error.cpp
@@ -70,7 +70,7 @@ namespace ignite
return *this;
}
- IgniteError::~IgniteError()
+ IgniteError::~IgniteError() IGNITE_NO_THROW
{
ReleaseChars(msg);
}
@@ -223,4 +223,4 @@ namespace ignite
else if (jniCode == IGNITE_JNI_ERR_JVM_ATTACH)
*err = IgniteError(IGNITE_ERR_JVM_ATTACH, "Failed to attach to JVM.");
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/44eff48f/modules/platforms/cpp/core-test/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/Makefile.am b/modules/platforms/cpp/core-test/Makefile.am
index 7a62e8e..b118639 100644
--- a/modules/platforms/cpp/core-test/Makefile.am
+++ b/modules/platforms/cpp/core-test/Makefile.am
@@ -33,7 +33,9 @@ AM_CPPFLAGS = \
-I@top_srcdir@/jni/os/linux/include \
-I$(JAVA_HOME)/include \
-I$(JAVA_HOME)/include/linux \
- -DIGNITE_IMPL
+ -DIGNITE_IMPL \
+ -D__STDC_LIMIT_MACROS \
+ -D__STDC_CONSTANT_MACROS
AM_CXXFLAGS = \
-Wall \
@@ -54,13 +56,13 @@ ignite_tests_SOURCES = \
src/ignition_test.cpp \
src/interop_memory_test.cpp \
src/handle_registry_test.cpp \
- src/ignite_error_test.cpp \
+ src/ignite_error_test.cpp \
src/binary_test_defs.cpp \
src/binary_reader_writer_raw_test.cpp \
src/binary_reader_writer_test.cpp \
src/binary_session_test.cpp \
- src/decimal_test.cpp \
- src/dynamic_size_array_test.cpp \
+ src/decimal_test.cpp \
+ src/dynamic_size_array_test.cpp \
src/fixed_size_array_test.cpp \
src/transactions_test.cpp \
src/teamcity_messages.cpp \
http://git-wip-us.apache.org/repos/asf/ignite/blob/44eff48f/modules/platforms/cpp/core-test/src/decimal_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/decimal_test.cpp b/modules/platforms/cpp/core-test/src/decimal_test.cpp
index 47fe8fc..9d0bacf 100644
--- a/modules/platforms/cpp/core-test/src/decimal_test.cpp
+++ b/modules/platforms/cpp/core-test/src/decimal_test.cpp
@@ -1098,4 +1098,4 @@ BOOST_AUTO_TEST_CASE(TestDoubleCast)
CheckDoubleCast(-0.000000000000001);
}
-BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file
+BOOST_AUTO_TEST_SUITE_END()
http://git-wip-us.apache.org/repos/asf/ignite/blob/44eff48f/modules/platforms/cpp/core-test/src/interop_memory_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/interop_memory_test.cpp b/modules/platforms/cpp/core-test/src/interop_memory_test.cpp
index 07e928c..1c782b5 100644
--- a/modules/platforms/cpp/core-test/src/interop_memory_test.cpp
+++ b/modules/platforms/cpp/core-test/src/interop_memory_test.cpp
@@ -39,7 +39,8 @@ BOOST_AUTO_TEST_CASE(MemoryReallocationTest)
SharedPointer<InteropMemory> mem = env.AllocateMemory();
- BOOST_CHECK_EQUAL(mem.Get()->Capacity(), IgniteEnvironment::DEFAULT_ALLOCATION_SIZE);
+ BOOST_CHECK_EQUAL(mem.Get()->Capacity(),
+ static_cast<int32_t>(IgniteEnvironment::DEFAULT_ALLOCATION_SIZE));
BOOST_CHECK(mem.Get()->Data() != NULL);
@@ -92,4 +93,4 @@ BOOST_AUTO_TEST_CASE(MemoryReallocationTest)
memset(mem.Get()->Data(), 0xF0F0F0F0, mem.Get()->Capacity());
}
-BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file
+BOOST_AUTO_TEST_SUITE_END()
http://git-wip-us.apache.org/repos/asf/ignite/blob/44eff48f/modules/platforms/cpp/jni/src/java.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/src/java.cpp b/modules/platforms/cpp/jni/src/java.cpp
index 56fc4b1..5bbaac4 100644
--- a/modules/platforms/cpp/jni/src/java.cpp
+++ b/modules/platforms/cpp/jni/src/java.cpp
@@ -1794,7 +1794,7 @@ namespace ignite
}
JNIEXPORT jlong JNICALL JniAffinityFunctionInit(JNIEnv *env, jclass cls, jlong envPtr, jlong memPtr, jobject baseFunc) {
- void* baseFuncRef = baseFunc ? env->NewGlobalRef(baseFunc) : nullptr;
+ void* baseFuncRef = baseFunc ? env->NewGlobalRef(baseFunc) : 0;
IGNITE_SAFE_FUNC(env, envPtr, AffinityFunctionInitHandler, affinityFunctionInit, memPtr, baseFuncRef);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/44eff48f/modules/platforms/cpp/odbc-test/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/Makefile.am b/modules/platforms/cpp/odbc-test/Makefile.am
index ccf1192..e10ef7a 100644
--- a/modules/platforms/cpp/odbc-test/Makefile.am
+++ b/modules/platforms/cpp/odbc-test/Makefile.am
@@ -34,7 +34,9 @@ AM_CPPFLAGS = \
-I@top_srcdir@/core/os/linux/include \
-I$(JAVA_HOME)/include \
-I$(JAVA_HOME)/include/linux \
- -DIGNITE_IMPL
+ -DIGNITE_IMPL \
+ -D__STDC_LIMIT_MACROS \
+ -D__STDC_CONSTANT_MACROS
AM_CXXFLAGS = \
-Wall \
http://git-wip-us.apache.org/repos/asf/ignite/blob/44eff48f/modules/platforms/cpp/odbc-test/src/queries_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/queries_test.cpp b/modules/platforms/cpp/odbc-test/src/queries_test.cpp
index f0168bd..b7ea967 100644
--- a/modules/platforms/cpp/odbc-test/src/queries_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/queries_test.cpp
@@ -196,10 +196,10 @@ struct QueriesTestSuiteFixture
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
}
- SQLCHAR request[] = "SELECT i8Field, i16Field, i32Field, i64Field, strField, "
+ char request[] = "SELECT i8Field, i16Field, i32Field, i64Field, strField, "
"floatField, doubleField, boolField, guidField, dateField, timestampField FROM TestType";
- ret = SQLExecDirect(stmt, request, SQL_NTS);
+ ret = SQLExecDirect(stmt, reinterpret_cast<SQLCHAR*>(request), SQL_NTS);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
http://git-wip-us.apache.org/repos/asf/ignite/blob/44eff48f/modules/platforms/cpp/odbc/src/config/configuration.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/config/configuration.cpp b/modules/platforms/cpp/odbc/src/config/configuration.cpp
index cc2cc5d..f687695 100644
--- a/modules/platforms/cpp/odbc/src/config/configuration.cpp
+++ b/modules/platforms/cpp/odbc/src/config/configuration.cpp
@@ -237,7 +237,7 @@ namespace ignite
utility::IntoLower(key);
- if (value.front() == '{' && value.back() == '}')
+ if (value[0] == '{' && value[value.size() - 1] == '}')
value = value.substr(1, value.size() - 2);
args[key] = value;
[17/20] ignite git commit: Minor fix for flags passed to
GridCacheMapEntry.initialValue from data streamer isolated updater.
Posted by sb...@apache.org.
Minor fix for flags passed to GridCacheMapEntry.initialValue from data streamer isolated updater.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ec12a9db
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ec12a9db
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ec12a9db
Branch: refs/heads/ignite-4111
Commit: ec12a9db2265180f96be72e2217e60ced856164e
Parents: 551a4df
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Mon Oct 24 17:52:36 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Mon Oct 24 17:52:36 2016 +0300
----------------------------------------------------------------------
.../internal/processors/datastreamer/DataStreamerImpl.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ec12a9db/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
index c2f226c..a6065dd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
@@ -1656,13 +1656,15 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
expiryTime = CU.toExpireTime(ttl);
}
+ boolean primary = cctx.affinity().primary(cctx.localNode(), entry.key(), topVer);
+
entry.initialValue(e.getValue(),
ver,
ttl,
expiryTime,
false,
topVer,
- GridDrType.DR_LOAD,
+ primary ? GridDrType.DR_LOAD : GridDrType.DR_PRELOAD,
false);
cctx.evicts().touch(entry, topVer);
[09/20] ignite git commit: IGNITE-2355 Fixed the test
HadoopClientProtocolMultipleServersSelfTest. Close FileSystem after each test
to prevent using the one Client delegate for all tests.
Posted by sb...@apache.org.
IGNITE-2355 Fixed the test HadoopClientProtocolMultipleServersSelfTest. Close FileSystem after each test to prevent using the one Client delegate for all tests.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ccae52cc
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ccae52cc
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ccae52cc
Branch: refs/heads/ignite-4111
Commit: ccae52cc1af3fa2077ece6f6a9c4146e3ba72cb4
Parents: d3f042b
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Tue Oct 18 15:01:03 2016 +0500
Committer: tledkov-gridgain <tl...@gridgain.com>
Committed: Tue Oct 18 15:01:03 2016 +0500
----------------------------------------------------------------------
...opClientProtocolMultipleServersSelfTest.java | 93 ++++++++++++--------
1 file changed, 55 insertions(+), 38 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ccae52cc/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java
index 04747d0..0e51938 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java
@@ -24,6 +24,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.concurrent.Callable;
import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
@@ -40,7 +41,7 @@ import org.apache.hadoop.mapreduce.TaskAttemptContext;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.input.TextInputFormat;
import org.apache.ignite.IgniteFileSystem;
-import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.hadoop.mapreduce.IgniteHadoopClientProtocolProvider;
import org.apache.ignite.igfs.IgfsPath;
import org.apache.ignite.internal.client.GridServerUnreachableException;
@@ -61,6 +62,9 @@ public class HadoopClientProtocolMultipleServersSelfTest extends HadoopAbstractS
/** Job name. */
private static final String JOB_NAME = "myJob";
+ /** Rest port. */
+ private static int restPort;
+
/** {@inheritDoc} */
@Override protected boolean igfsEnabled() {
return true;
@@ -72,15 +76,6 @@ public class HadoopClientProtocolMultipleServersSelfTest extends HadoopAbstractS
}
/** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- super.beforeTest();
-
- startGrids(gridCount());
-
- awaitPartitionMapExchange();
- }
-
- /** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
stopAllGrids();
@@ -88,10 +83,10 @@ public class HadoopClientProtocolMultipleServersSelfTest extends HadoopAbstractS
}
/** {@inheritDoc} */
- @Override protected CacheConfiguration dataCacheConfiguration() {
- CacheConfiguration cfg = super.dataCacheConfiguration();
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
- cfg.setBackups(1);
+ cfg.getConnectorConfiguration().setPort(restPort++);
return cfg;
}
@@ -149,15 +144,22 @@ public class HadoopClientProtocolMultipleServersSelfTest extends HadoopAbstractS
*/
@SuppressWarnings("ConstantConditions")
public void testMultipleAddresses() throws Exception {
- beforeJob();
+ try {
+ restPort = REST_PORT;
+
+ startGrids(gridCount());
- stopGrid(0);
+ beforeJob();
- U.sleep(5000);
+ U.sleep(5000);
- checkJobSubmit(configMultipleAddrs(gridCount()));
+ checkJobSubmit(configMultipleAddrs(gridCount()));
+ }
+ finally {
+ FileSystem fs = FileSystem.get(configMultipleAddrs(gridCount()));
- startGrid(0);
+ fs.close();
+ }
}
/**
@@ -165,21 +167,25 @@ public class HadoopClientProtocolMultipleServersSelfTest extends HadoopAbstractS
*/
@SuppressWarnings({"ConstantConditions", "ThrowableResultOfMethodCallIgnored"})
public void testSingleAddress() throws Exception {
- stopGrid(0);
-
- U.sleep(5000);
-
- GridTestUtils.assertThrowsAnyCause(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- checkJobSubmit(configSingleAddress());
- return null;
- }
- },
- GridServerUnreachableException.class, "Failed to connect to any of the servers in list");
-
- startGrid(0);
+ try {
+ // Don't use REST_PORT to test connection fails if the only this port is configured
+ restPort = REST_PORT + 1;
+
+ startGrids(gridCount());
+
+ GridTestUtils.assertThrowsAnyCause(log, new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ checkJobSubmit(configSingleAddress());
+ return null;
+ }
+ },
+ GridServerUnreachableException.class, "Failed to connect to any of the servers in list");
+ }
+ finally {
+ FileSystem fs = FileSystem.get(configSingleAddress());
- awaitPartitionMapExchange();
+ fs.close();
+ }
}
/**
@@ -187,17 +193,28 @@ public class HadoopClientProtocolMultipleServersSelfTest extends HadoopAbstractS
*/
@SuppressWarnings("ConstantConditions")
public void testMixedAddrs() throws Exception {
- beforeJob();
+ try {
+ restPort = REST_PORT;
+
+ startGrids(gridCount());
- stopGrid(1);
+ beforeJob();
- U.sleep(5000);
+ stopGrid(1);
- checkJobSubmit(configMixed());
+ U.sleep(5000);
- startGrid(1);
+ checkJobSubmit(configMixed());
- awaitPartitionMapExchange();
+ startGrid(1);
+
+ awaitPartitionMapExchange();
+ }
+ finally {
+ FileSystem fs = FileSystem.get(configMixed());
+
+ fs.close();
+ }
}
/**
[19/20] ignite git commit: IGNITE-2079 GridCacheIoManager eats
exception trail if it falls into the directed case merger from ignite-2079-2
Posted by sb...@apache.org.
IGNITE-2079 GridCacheIoManager eats exception trail if it falls into the directed case
merger from ignite-2079-2
# Conflicts:
# modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryMetricsAdapter.java
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9ddb8be1
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9ddb8be1
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9ddb8be1
Branch: refs/heads/ignite-4111
Commit: 9ddb8be1243df8e489f7ebc716d315415775439a
Parents: 4474046
Author: Dmitriy Govorukhin <dg...@gridgain.com>
Authored: Thu Oct 27 17:52:22 2016 +0300
Committer: Dmitriy Govorukhin <dg...@gridgain.com>
Committed: Thu Oct 27 17:52:22 2016 +0300
----------------------------------------------------------------------
.../org/apache/ignite/events/EventType.java | 6 +
.../ignite/events/UnhandledExceptionEvent.java | 61 ++++
.../processors/cache/GridCacheIoManager.java | 70 +++--
.../cache/query/GridCacheQueryManager.java | 10 +
.../query/GridCacheQueryMetricsAdapter.java | 9 +-
.../cache/query/GridCacheQueryResponse.java | 2 +-
.../continuous/CacheContinuousQueryHandler.java | 50 +--
...2pUnmarshallingContinuousQueryErrorTest.java | 302 +++++++++++++++++++
...niteCacheP2pUnmarshallingErrorTestSuite.java | 6 +-
9 files changed, 455 insertions(+), 61 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/9ddb8be1/modules/core/src/main/java/org/apache/ignite/events/EventType.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/events/EventType.java b/modules/core/src/main/java/org/apache/ignite/events/EventType.java
index 103dbd4..7778f67 100644
--- a/modules/core/src/main/java/org/apache/ignite/events/EventType.java
+++ b/modules/core/src/main/java/org/apache/ignite/events/EventType.java
@@ -859,6 +859,12 @@ public interface EventType {
public static final int EVT_IGFS_FILE_PURGED = 127;
/**
+ * Built-in event type: event for unhandled exception.
+ *
+ */
+ public static final int EVT_UNHANDLED_EXCEPTION = 128;
+
+ /**
* All checkpoint events. This array can be directly passed into
* {@link IgniteEvents#localListen(IgnitePredicate, int...)} method to
* subscribe to all checkpoint events.
http://git-wip-us.apache.org/repos/asf/ignite/blob/9ddb8be1/modules/core/src/main/java/org/apache/ignite/events/UnhandledExceptionEvent.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/events/UnhandledExceptionEvent.java b/modules/core/src/main/java/org/apache/ignite/events/UnhandledExceptionEvent.java
new file mode 100644
index 0000000..cb6cd85
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/events/UnhandledExceptionEvent.java
@@ -0,0 +1,61 @@
+/*
+ * 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.events;
+
+import org.apache.ignite.cluster.ClusterNode;
+
+/**
+ * Cache fail event.
+ */
+public class UnhandledExceptionEvent extends EventAdapter {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private Exception ex;
+
+ /**
+ * Default constructor.
+ */
+ public UnhandledExceptionEvent() {
+ }
+
+ /**
+ * @param node Node.
+ * @param msg Message.
+ * @param ex Exception.
+ * @param type Type.
+ */
+ public UnhandledExceptionEvent(ClusterNode node, String msg, Exception ex, int type) {
+ super(node, msg, type);
+ this.ex = ex;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return "msg=" + message() + ", type=" + type() + "ex=" + ex;
+ }
+
+ /**
+ *
+ * @return inner exception
+ */
+ public Exception getException() {
+ return ex;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9ddb8be1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
index 78dddd3..5d7cb00 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
@@ -17,50 +17,26 @@
package org.apache.ignite.internal.processors.cache;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicLong;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.binary.BinaryObjectException;
import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.events.UnhandledExceptionEvent;
+import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
import org.apache.ignite.internal.managers.communication.GridMessageListener;
import org.apache.ignite.internal.managers.deployment.GridDeploymentInfo;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.distributed.dht.CacheGetFuture;
-import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtAffinityAssignmentRequest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLockRequest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLockResponse;
-import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxFinishRequest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxFinishResponse;
-import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareRequest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareResponse;
-import org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedSingleGetFuture;
+import org.apache.ignite.internal.processors.cache.distributed.dht.*;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponse;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysResponse;
-import org.apache.ignite.internal.processors.cache.distributed.near.GridNearGetRequest;
-import org.apache.ignite.internal.processors.cache.distributed.near.GridNearGetResponse;
-import org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockRequest;
-import org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockResponse;
-import org.apache.ignite.internal.processors.cache.distributed.near.GridNearSingleGetRequest;
-import org.apache.ignite.internal.processors.cache.distributed.near.GridNearSingleGetResponse;
-import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxFinishRequest;
-import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxFinishResponse;
-import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareRequest;
-import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareResponse;
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
import org.apache.ignite.internal.processors.cache.query.GridCacheQueryRequest;
import org.apache.ignite.internal.processors.cache.query.GridCacheQueryResponse;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
@@ -79,6 +55,12 @@ import org.apache.ignite.lang.IgniteUuid;
import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentHashMap8;
+import java.util.*;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicLong;
+
+import static org.apache.ignite.events.EventType.EVT_UNHANDLED_EXCEPTION;
import static org.apache.ignite.internal.GridTopic.TOPIC_CACHE;
/**
@@ -693,6 +675,11 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
break;
+ case 59:
+ // No additional actions required, just skipping default switch section,
+ // since UnhandledException already registered.
+ break;
+
case 114: {
processMessage(nodeId,msg,c);// Will be handled by Rebalance Demander.
}
@@ -737,13 +724,34 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
break;
- default:
- throw new IgniteCheckedException("Failed to send response to node. Unsupported direct type [message="
- + msg + "]", msg.classError());
+ default:{
+ String shortMsg = "Failed to send response to node. Unsupported direct type [message=" + msg + "]";
+
+ IgniteCheckedException e = new IgniteCheckedException(shortMsg, msg.classError());
+
+ registerUnhandledException(ctx, shortMsg, e);
+ }
}
}
/**
+ * @param ctx Grid cache context.
+ * @param shortMsg Short message.
+ * @param ex Original Exception.
+ */
+ public static void registerUnhandledException(GridCacheContext ctx, String shortMsg, IgniteCheckedException ex) {
+ GridKernalContext kctx = ctx.kernalContext();
+
+ kctx.exceptionRegistry().onException(shortMsg, ex);
+
+ ClusterNode node = ctx.discovery().localNode();
+
+ UnhandledExceptionEvent evt = new UnhandledExceptionEvent(node, shortMsg, ex, EVT_UNHANDLED_EXCEPTION);
+
+ kctx.event().record(evt);
+ }
+
+ /**
* @param nodeId Node ID.
* @param msg Message.
* @param c Closure.
http://git-wip-us.apache.org/repos/asf/ignite/blob/9ddb8be1/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 7bd1a51..97e59c1 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
@@ -326,6 +326,16 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
}
/**
+ * Increment fails counter.
+ */
+ public void onUnhandledException() {
+ final boolean statsEnabled = cctx.config().isStatisticsEnabled();
+
+ if (statsEnabled)
+ metrics.incrementOnFails();
+ }
+
+ /**
* Processes cache query request.
*
* @param sndId Sender node id.
http://git-wip-us.apache.org/repos/asf/ignite/blob/9ddb8be1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryMetricsAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryMetricsAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryMetricsAdapter.java
index e70ea9f..d25b7c4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryMetricsAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryMetricsAdapter.java
@@ -172,4 +172,11 @@ public class GridCacheQueryMetricsAdapter implements QueryMetrics, Externalizabl
@Override public String toString() {
return S.toString(GridCacheQueryMetricsAdapter.class, this);
}
-}
+
+ /**
+ * Increment fails counter.
+ */
+ public void incrementOnFails() {
+ fails.increment();
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/9ddb8be1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java
index 8492c38..2b86efe 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java
@@ -357,6 +357,6 @@ public class GridCacheQueryResponse extends GridCacheMessage implements GridCach
/** {@inheritDoc} */
@Override public String toString() {
- return S.toString(GridCacheQueryResponse.class, this);
+ return S.toString(GridCacheQueryResponse.class, this, super.toString());
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9ddb8be1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
index 304d031..4c91ea7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
@@ -17,28 +17,6 @@
package org.apache.ignite.internal.processors.cache.query.continuous;
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.NavigableSet;
-import java.util.Set;
-import java.util.TreeMap;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.atomic.AtomicLong;
-import javax.cache.event.CacheEntryEvent;
-import javax.cache.event.CacheEntryEventFilter;
-import javax.cache.event.CacheEntryUpdatedListener;
-import javax.cache.event.EventType;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
@@ -61,6 +39,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCacheDeploymentManager;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateFuture;
import org.apache.ignite.internal.processors.cache.query.CacheQueryType;
+import org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager;
import org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryManager.JCacheQueryLocalListener;
import org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryManager.JCacheQueryRemoteFilter;
import org.apache.ignite.internal.processors.continuous.GridContinuousBatch;
@@ -82,8 +61,22 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentLinkedDeque8;
+import javax.cache.event.CacheEntryEvent;
+import javax.cache.event.CacheEntryEventFilter;
+import javax.cache.event.CacheEntryUpdatedListener;
+import javax.cache.event.EventType;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.atomic.AtomicLong;
+
import static org.apache.ignite.events.EventType.EVT_CACHE_QUERY_EXECUTED;
import static org.apache.ignite.events.EventType.EVT_CACHE_QUERY_OBJECT_READ;
+import static org.apache.ignite.internal.processors.cache.GridCacheIoManager.registerUnhandledException;
/**
* Continuous query handler.
@@ -688,8 +681,17 @@ public class CacheContinuousQueryHandler<K, V> implements GridContinuousHandler
catch (IgniteCheckedException ex) {
if (ignoreClsNotFound)
assert internal;
- else
- U.error(ctx.log(getClass()), "Failed to unmarshal entry.", ex);
+ else {
+ String shortMsg = "Failed to unmarshal entry.";
+
+ U.error(ctx.log(getClass()), shortMsg, ex);
+
+ GridCacheQueryManager qryMgr = cctx.queries();
+
+ qryMgr.onUnhandledException();
+
+ registerUnhandledException(cctx, shortMsg, ex);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9ddb8be1/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingContinuousQueryErrorTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingContinuousQueryErrorTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingContinuousQueryErrorTest.java
new file mode 100644
index 0000000..82f5f09
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingContinuousQueryErrorTest.java
@@ -0,0 +1,302 @@
+/*
+ * 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.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicInteger;
+import javax.cache.Cache;
+import javax.cache.event.CacheEntryEvent;
+import javax.cache.event.CacheEntryUpdatedListener;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.cache.query.ContinuousQuery;
+import org.apache.ignite.cache.query.QueryCursor;
+import org.apache.ignite.cache.query.ScanQuery;
+import org.apache.ignite.cache.query.annotations.QuerySqlField;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.events.Event;
+import org.apache.ignite.events.EventType;
+import org.apache.ignite.events.UnhandledExceptionEvent;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.processors.cache.query.GridCacheQueryMetricsAdapter;
+import org.apache.ignite.internal.util.lang.GridAbsPredicate;
+import org.apache.ignite.internal.util.typedef.X;
+import org.apache.ignite.lang.IgniteBiPredicate;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.thread.IgniteThread;
+
+/**
+ * Checks behavior on exception while unmarshalling key for continuous query.
+ */
+public class IgniteCacheP2pUnmarshallingContinuousQueryErrorTest extends IgniteCacheP2pUnmarshallingErrorTest {
+ /**
+ * {@inheritDoc}
+ */
+ @Override protected int gridCount() {
+ return 3;
+ }
+
+ /** Used inside InitialQuery listener. */
+ private static final CountDownLatch latch = new CountDownLatch(1);
+
+ /** Node where unmarshalling fails with exceptions. */
+ private static volatile String failNode;
+
+ /** Used to count UnhandledExceptionEvents at client node. */
+ private static final AtomicInteger cnt = new AtomicInteger();
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override protected CacheConfiguration cacheConfiguration(String gridName) throws Exception {
+ CacheConfiguration cacheCfg = super.cacheConfiguration(gridName);
+
+ cacheCfg.setStatisticsEnabled(true);
+
+ return cacheCfg;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override public void testResponseMessageOnUnmarshallingFailed() throws Exception {
+ IgniteEx client = grid(0);
+ IgniteEx node1 = grid(1);
+ IgniteEx node2 = grid(2);
+
+ assert client.configuration().isClientMode() &&
+ !node1.configuration().isClientMode() &&
+ !node2.configuration().isClientMode();
+
+ failNode = client.name();
+
+ client.events().localListen(new IgnitePredicate<Event>() {
+ @Override public boolean apply(Event evt) {
+ UnhandledExceptionEvent uex = (UnhandledExceptionEvent)evt;
+
+ assertTrue(X.getFullStackTrace(uex.getException()).
+ contains("IOException: Class can not be unmarshalled"));
+
+ cnt.incrementAndGet();
+
+ return true;
+ }
+ }, EventType.EVT_UNHANDLED_EXCEPTION);
+
+ node1.events().localListen(new IgnitePredicate<Event>() {
+ @Override public boolean apply(Event evt) {
+ fail("This line should newer calls.");
+
+ return true;
+ }
+ }, EventType.EVT_UNHANDLED_EXCEPTION);
+
+ ContinuousQuery<TestKey, String> qry = new ContinuousQuery<>();
+
+ qry.setInitialQuery(new ScanQuery<>(new IgniteBiPredicate<TestKey, String>() {
+ @Override public boolean apply(TestKey key, String val) {
+ latch.countDown(); // Gives guarantee query initialized.
+
+ return true;
+ }
+ }));
+
+ qry.setLocalListener(new CacheEntryUpdatedListener<TestKey, String>() {
+ @Override public void onUpdated(Iterable<CacheEntryEvent<? extends TestKey, ? extends String>> evts) {
+ fail("This line should newer calls.");
+ }
+ });
+
+ validate(
+ 0,//execs
+ 0,//evts
+ 0,//fails
+ client,
+ node1,
+ node2);
+
+ // Put element before creating QueryCursor.
+ putPrimary(node1);
+
+ try (QueryCursor<Cache.Entry<TestKey, String>> cur = client.cache(null).query(qry)) {
+ latch.await();
+
+ validate(
+ 1,//execs
+ 0,//evts
+ 0,//fails
+ client,
+ node1,
+ node2);
+
+ putPrimary(node1);
+
+ validate(
+ 1,//execs
+ 1,//evts
+ 1,//fails
+ client,
+ node1,
+ node2);
+
+ putPrimary(node2);
+
+ validate(
+ 1,//execs
+ 2,//evts
+ 2,//fails
+ client,
+ node1,
+ node2);
+ }
+ }
+
+ /**
+ * @param ignite Ignite.
+ */
+ private void putPrimary(IgniteEx ignite) {
+ IgniteCache<TestKey, Object> cache = ignite.cache(null);
+
+ cache.put(generateNodeKeys(ignite, cache), "value");
+ }
+
+ /**
+ * @param execs Executions.
+ * @param evts Events.
+ * @param failsNum Fails number.
+ * @param client Client.
+ * @param node1 Node 1.
+ * @param node2 Node 2.
+ */
+ private void validate(final int execs, final int evts, final int failsNum, final IgniteEx client, IgniteEx node1,
+ IgniteEx node2) throws Exception {
+ assertTrue(GridTestUtils.waitForCondition(new GridAbsPredicate() {
+ @Override public boolean apply() {
+ return client.cache(null).queryMetrics().fails() == failsNum;
+ }
+ }, 5_000));
+
+ assertEquals(evts, cnt.intValue());
+
+ validateCacheQueryMetrics(client, execs, failsNum);
+ validateCacheQueryMetrics(node1, 0, 0);
+ validateCacheQueryMetrics(node2, 0, 0);
+ }
+
+ /**
+ * @param ignite Ignite.
+ * @param executions Executions.
+ * @param fails Fails.
+ */
+ private void validateCacheQueryMetrics(IgniteEx ignite, int executions, int fails) {
+ IgniteCache<Object, Object> cache = ignite.cache(null);
+
+ GridCacheQueryMetricsAdapter metr = (GridCacheQueryMetricsAdapter)cache.queryMetrics();
+
+ assertEquals(metr.executions(), executions);
+
+ assertEquals(metr.fails(), fails);
+ }
+
+ /**
+ * @param node Node.
+ * @param cache Cache.
+ */
+ private TestKey generateNodeKeys(IgniteEx node, IgniteCache<TestKey, Object> cache) {
+
+ ClusterNode locNode = node.localNode();
+
+ for (int ind = 0; ind < 100_000; ind++) {
+ TestKey key = new TestKey("key" + ind);
+
+ if (affinity(cache).isPrimary(locNode, key))
+ return key;
+ }
+
+ throw new IgniteException("Unable to find key keys as primary for cache.");
+ }
+
+ /**
+ *
+ * */
+ private static class TestKey implements Externalizable {
+ /**
+ * Field.
+ */
+ @QuerySqlField(index = true)
+ private String field;
+
+ /**
+ * Required by {@link Externalizable}.
+ */
+ public TestKey() {
+ }
+
+ /**
+ * @param field Test key 1.
+ */
+ public TestKey(String field) {
+ this.field = field;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+
+ IgniteCacheP2pUnmarshallingContinuousQueryErrorTest.TestKey key = (IgniteCacheP2pUnmarshallingContinuousQueryErrorTest.TestKey)o;
+
+ return !(field != null ? !field.equals(key.field) : key.field != null);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override public int hashCode() {
+ return field != null ? field.hashCode() : 0;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeObject(field);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ field = (String)in.readObject();
+
+ if (((IgniteThread)Thread.currentThread()).getGridName().equals(failNode))
+ throw new IOException("Class can not be unmarshalled.");
+
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9ddb8be1/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheP2pUnmarshallingErrorTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheP2pUnmarshallingErrorTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheP2pUnmarshallingErrorTestSuite.java
index dfc96dc..b45d134 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheP2pUnmarshallingErrorTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheP2pUnmarshallingErrorTestSuite.java
@@ -19,10 +19,7 @@ package org.apache.ignite.testsuites;
import java.util.Set;
import junit.framework.TestSuite;
-import org.apache.ignite.internal.processors.cache.IgniteCacheP2pUnmarshallingErrorTest;
-import org.apache.ignite.internal.processors.cache.IgniteCacheP2pUnmarshallingNearErrorTest;
-import org.apache.ignite.internal.processors.cache.IgniteCacheP2pUnmarshallingRebalanceErrorTest;
-import org.apache.ignite.internal.processors.cache.IgniteCacheP2pUnmarshallingTxErrorTest;
+import org.apache.ignite.internal.processors.cache.*;
import org.apache.ignite.testframework.GridTestUtils;
/**
@@ -49,6 +46,7 @@ public class IgniteCacheP2pUnmarshallingErrorTestSuite extends TestSuite {
GridTestUtils.addTestIfNeeded(suite, IgniteCacheP2pUnmarshallingNearErrorTest.class, ignoredTests);
GridTestUtils.addTestIfNeeded(suite, IgniteCacheP2pUnmarshallingRebalanceErrorTest.class, ignoredTests);
GridTestUtils.addTestIfNeeded(suite, IgniteCacheP2pUnmarshallingTxErrorTest.class, ignoredTests);
+ GridTestUtils.addTestIfNeeded(suite, IgniteCacheP2pUnmarshallingContinuousQueryErrorTest.class, ignoredTests);
return suite;
}
[16/20] ignite git commit: IGNITE-2355 Fixed the test
HadoopClientProtocolMultipleServersSelfTest. Clear connection poll before and
after the test
Posted by sb...@apache.org.
IGNITE-2355 Fixed the test HadoopClientProtocolMultipleServersSelfTest. Clear connection poll before and after the test
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/551a4dfa
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/551a4dfa
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/551a4dfa
Branch: refs/heads/ignite-4111
Commit: 551a4dfae6169a07a5e28f9b266f90311f3216b7
Parents: 7ed2bb7
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Fri Oct 21 15:25:57 2016 +0500
Committer: tledkov-gridgain <tl...@gridgain.com>
Committed: Fri Oct 21 15:25:57 2016 +0500
----------------------------------------------------------------------
...oopClientProtocolMultipleServersSelfTest.java | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/551a4dfa/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java
index 51b6164..d6e0743 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java
@@ -40,6 +40,7 @@ import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.TaskAttemptContext;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.input.TextInputFormat;
+import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteFileSystem;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.hadoop.mapreduce.IgniteHadoopClientProtocolProvider;
@@ -81,6 +82,22 @@ public class HadoopClientProtocolMultipleServersSelfTest extends HadoopAbstractS
@Override protected void afterTest() throws Exception {
stopAllGrids();
+ clearConnectionMap();
+
+ super.afterTest();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ super.beforeTest();
+
+ clearConnectionMap();
+ }
+
+ /**
+ * @throws IgniteCheckedException If failed.
+ */
+ private void clearConnectionMap() throws IgniteCheckedException {
ConcurrentHashMap<String, IgniteInternalFuture<GridClient>> cliMap =
GridTestUtils.getFieldValue(IgniteHadoopClientProtocolProvider.class, "cliMap");
@@ -88,8 +105,6 @@ public class HadoopClientProtocolMultipleServersSelfTest extends HadoopAbstractS
fut.get().close();
cliMap.clear();
-
- super.afterTest();
}
/** {@inheritDoc} */
[12/20] ignite git commit: IGNITE-4030 Streamline PlatformTarget
operation methods
Posted by sb...@apache.org.
IGNITE-4030 Streamline PlatformTarget operation methods
This closes #1167
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7290d88e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7290d88e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7290d88e
Branch: refs/heads/ignite-4111
Commit: 7290d88e14a15a3d030b7381dbd0a3f14cb65a12
Parents: a863eee
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Tue Oct 18 17:17:17 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Tue Oct 18 17:17:17 2016 +0300
----------------------------------------------------------------------
.../platform/PlatformAbstractTarget.java | 54 --------------------
.../processors/platform/PlatformTarget.java | 20 --------
.../platform/cache/PlatformCache.java | 27 ++++------
.../cache/affinity/PlatformAffinity.java | 4 +-
.../query/PlatformAbstractQueryCursor.java | 4 +-
.../query/PlatformContinuousQueryProxy.java | 3 +-
.../platform/cluster/PlatformClusterGroup.java | 4 +-
.../platform/compute/PlatformCompute.java | 9 +---
.../datastreamer/PlatformDataStreamer.java | 9 +---
.../datastructures/PlatformAtomicLong.java | 27 ++++------
.../datastructures/PlatformAtomicReference.java | 8 ++-
.../datastructures/PlatformAtomicSequence.java | 31 +++++------
.../platform/services/PlatformServices.java | 13 +++--
.../transactions/PlatformTransactions.java | 17 ++----
.../core/src/impl/cache/query/query_impl.cpp | 6 +--
.../core/src/impl/interop/interop_target.cpp | 2 +-
.../cpp/jni/include/ignite/jni/exports.h | 2 -
.../platforms/cpp/jni/include/ignite/jni/java.h | 4 --
modules/platforms/cpp/jni/project/vs/module.def | 3 +-
modules/platforms/cpp/jni/src/exports.cpp | 8 ---
modules/platforms/cpp/jni/src/java.cpp | 23 ---------
.../Impl/Cache/CacheAffinityImpl.cs | 2 +-
.../Apache.Ignite.Core/Impl/Cache/CacheImpl.cs | 14 ++---
.../Impl/Cache/Query/AbstractQueryCursor.cs | 4 +-
.../Continuous/ContinuousQueryHandleImpl.cs | 2 +-
.../Impl/Compute/ComputeImpl.cs | 4 +-
.../Impl/DataStructures/AtomicLong.cs | 14 ++---
.../Impl/DataStructures/AtomicReference.cs | 4 +-
.../Impl/DataStructures/AtomicSequence.cs | 14 ++---
.../Impl/Datastream/DataStreamerImpl.cs | 20 ++++----
.../Apache.Ignite.Core/Impl/Events/Events.cs | 4 +-
.../dotnet/Apache.Ignite.Core/Impl/Ignite.cs | 2 +-
.../Apache.Ignite.Core/Impl/PlatformTarget.cs | 41 +--------------
.../Impl/Services/Services.cs | 4 +-
.../Impl/Transactions/TransactionsImpl.cs | 12 ++---
.../Impl/Unmanaged/IgniteJniNativeMethods.cs | 9 +---
.../Impl/Unmanaged/UnmanagedUtils.cs | 12 +----
37 files changed, 114 insertions(+), 326 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7290d88e/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractTarget.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractTarget.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractTarget.java
index 22adef8..09092c2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractTarget.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractTarget.java
@@ -99,16 +99,6 @@ public abstract class PlatformAbstractTarget implements PlatformTarget {
}
/** {@inheritDoc} */
- @Override public long outLong(int type) throws Exception {
- try {
- return processOutLong(type);
- }
- catch (Exception e) {
- throw convertException(e);
- }
- }
-
- /** {@inheritDoc} */
@Override public void outStream(int type, long memPtr) throws Exception {
try (PlatformMemory mem = platformCtx.memory().get(memPtr)) {
PlatformOutputStream out = mem.output();
@@ -155,26 +145,6 @@ public abstract class PlatformAbstractTarget implements PlatformTarget {
}
/** {@inheritDoc} */
- @Override public void inObjectStreamOutStream(int type, Object arg, long inMemPtr, long outMemPtr) throws Exception {
- try (PlatformMemory inMem = platformCtx.memory().get(inMemPtr)) {
- BinaryRawReaderEx reader = platformCtx.reader(inMem);
-
- try (PlatformMemory outMem = platformCtx.memory().get(outMemPtr)) {
- PlatformOutputStream out = outMem.output();
-
- BinaryRawWriterEx writer = platformCtx.writer(out);
-
- processInObjectStreamOutStream(type, arg, reader, writer);
-
- out.synchronize();
- }
- }
- catch (Exception e) {
- throw convertException(e);
- }
- }
-
- /** {@inheritDoc} */
@Override public Object inObjectStreamOutObjectStream(int type, Object arg, long inMemPtr, long outMemPtr)
throws Exception {
PlatformMemory inMem = null;
@@ -338,20 +308,6 @@ public abstract class PlatformAbstractTarget implements PlatformTarget {
* @param writer Binary writer.
* @throws IgniteCheckedException In case of exception.
*/
- protected void processInObjectStreamOutStream(int type, @Nullable Object arg, BinaryRawReaderEx reader,
- BinaryRawWriterEx writer) throws IgniteCheckedException {
- throwUnsupported(type);
- }
-
- /**
- * Process IN-OUT operation.
- *
- * @param type Type.
- * @param arg Argument.
- * @param reader Binary reader.
- * @param writer Binary writer.
- * @throws IgniteCheckedException In case of exception.
- */
protected Object processInObjectStreamOutObjectStream(int type, @Nullable Object arg, BinaryRawReaderEx reader,
BinaryRawWriterEx writer) throws IgniteCheckedException {
return throwUnsupported(type);
@@ -361,16 +317,6 @@ public abstract class PlatformAbstractTarget implements PlatformTarget {
* Process OUT operation.
*
* @param type Type.
- * @throws IgniteCheckedException In case of exception.
- */
- protected long processOutLong(int type) throws IgniteCheckedException {
- return throwUnsupported(type);
- }
-
- /**
- * Process OUT operation.
- *
- * @param type Type.
* @param writer Binary writer.
* @throws IgniteCheckedException In case of exception.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/7290d88e/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformTarget.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformTarget.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformTarget.java
index 40773d0..cde6402 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformTarget.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformTarget.java
@@ -67,17 +67,6 @@ public interface PlatformTarget {
public void inStreamOutStream(int type, long inMemPtr, long outMemPtr) throws Exception;
/**
- * Operation accepting an object and a memory stream and returning result to another memory stream.
- *
- * @param type Operation type.
- * @param arg Argument (optional).
- * @param inMemPtr Input memory pointer.
- * @param outMemPtr Output memory pointer.
- * @throws Exception In case of failure.
- */
- public void inObjectStreamOutStream(int type, @Nullable Object arg, long inMemPtr, long outMemPtr) throws Exception;
-
- /**
* Operation accepting an object and a memory stream and returning result to another memory stream and an object.
*
* @param type Operation type.
@@ -91,15 +80,6 @@ public interface PlatformTarget {
throws Exception;
/**
- * Operation returning long result.
- *
- * @param type Operation type.
- * @return Result.
- * @throws Exception In case of failure.
- */
- public long outLong(int type) throws Exception;
-
- /**
* Operation returning result to memory stream.
*
* @param type Operation type.
http://git-wip-us.apache.org/repos/asf/ignite/blob/7290d88e/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
index 05945e0..7986286 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
@@ -274,23 +274,6 @@ public class PlatformCache extends PlatformAbstractTarget {
}
/** {@inheritDoc} */
- @Override protected long processOutLong(int type) throws IgniteCheckedException {
- switch (type) {
- case OP_CLEAR_CACHE:
- cache.clear();
-
- return TRUE;
-
- case OP_REMOVE_ALL2:
- cache.removeAll();
-
- return TRUE;
- }
-
- return super.processOutLong(type);
- }
-
- /** {@inheritDoc} */
@Override protected long processInStreamOutLong(int type, BinaryRawReaderEx reader) throws IgniteCheckedException {
switch (type) {
case OP_PUT:
@@ -785,6 +768,16 @@ public class PlatformCache extends PlatformAbstractTarget {
return TRUE;
}
+
+ case OP_CLEAR_CACHE:
+ cache.clear();
+
+ return TRUE;
+
+ case OP_REMOVE_ALL2:
+ cache.removeAll();
+
+ return TRUE;
}
return super.processInLongOutLong(type, val);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7290d88e/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinity.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinity.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinity.java
index 41b58aa..12df188 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinity.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinity.java
@@ -292,10 +292,10 @@ public class PlatformAffinity extends PlatformAbstractTarget {
}
/** {@inheritDoc} */
- @Override public long outLong(int type) throws Exception {
+ @Override public long processInLongOutLong(int type, long val) throws IgniteCheckedException {
if (type == OP_PARTITIONS)
return aff.partitions();
- return super.outLong(type);
+ return super.processInLongOutLong(type, val);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7290d88e/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/query/PlatformAbstractQueryCursor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/query/PlatformAbstractQueryCursor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/query/PlatformAbstractQueryCursor.java
index ff28b81..6a259ca 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/query/PlatformAbstractQueryCursor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/query/PlatformAbstractQueryCursor.java
@@ -136,7 +136,7 @@ public abstract class PlatformAbstractQueryCursor<T> extends PlatformAbstractTar
}
/** {@inheritDoc} */
- @Override protected long processOutLong(int type) throws IgniteCheckedException {
+ @Override protected long processInLongOutLong(int type, long val) throws IgniteCheckedException {
switch (type) {
case OP_ITERATOR:
iter = cursor.iterator();
@@ -154,7 +154,7 @@ public abstract class PlatformAbstractQueryCursor<T> extends PlatformAbstractTar
return iter.hasNext() ? TRUE : FALSE;
}
- return super.processOutLong(type);
+ return super.processInLongOutLong(type, val);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/7290d88e/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/query/PlatformContinuousQueryProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/query/PlatformContinuousQueryProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/query/PlatformContinuousQueryProxy.java
index a4d7cad..04f17ff 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/query/PlatformContinuousQueryProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/query/PlatformContinuousQueryProxy.java
@@ -17,6 +17,7 @@
package org.apache.ignite.internal.processors.platform.cache.query;
+import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.processors.platform.PlatformAbstractTarget;
import org.apache.ignite.internal.processors.platform.PlatformContext;
@@ -45,7 +46,7 @@ public class PlatformContinuousQueryProxy extends PlatformAbstractTarget {
}
/** {@inheritDoc} */
- @Override public long outLong(int type) throws Exception {
+ @Override public long processInLongOutLong(int type, long val) throws IgniteCheckedException {
qry.close();
return 0;
http://git-wip-us.apache.org/repos/asf/ignite/blob/7290d88e/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup.java
index a94e045..957eaaf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup.java
@@ -322,7 +322,7 @@ public class PlatformClusterGroup extends PlatformAbstractTarget {
}
/** {@inheritDoc} */
- @Override protected long processOutLong(int type) throws IgniteCheckedException {
+ @Override protected long processInLongOutLong(int type, long val) throws IgniteCheckedException {
switch (type) {
case OP_RESET_METRICS: {
assert prj instanceof IgniteCluster; // Can only be invoked on top-level cluster group.
@@ -333,7 +333,7 @@ public class PlatformClusterGroup extends PlatformAbstractTarget {
}
}
- return super.processOutLong(type);
+ return super.processInLongOutLong(type, val);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/7290d88e/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/compute/PlatformCompute.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/compute/PlatformCompute.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/compute/PlatformCompute.java
index 36d709a..32e4848 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/compute/PlatformCompute.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/compute/PlatformCompute.java
@@ -135,14 +135,7 @@ public class PlatformCompute extends PlatformAbstractTarget {
return TRUE;
}
- }
-
- return super.processInLongOutLong(type, val);
- }
- /** {@inheritDoc} */
- @Override protected long processOutLong(int type) throws IgniteCheckedException {
- switch (type) {
case OP_WITH_NO_FAILOVER: {
compute.withNoFailover();
computeForPlatform.withNoFailover();
@@ -151,7 +144,7 @@ public class PlatformCompute extends PlatformAbstractTarget {
}
}
- return super.processOutLong(type);
+ return super.processInLongOutLong(type, val);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/7290d88e/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastreamer/PlatformDataStreamer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastreamer/PlatformDataStreamer.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastreamer/PlatformDataStreamer.java
index 2822b7f..cd5fba0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastreamer/PlatformDataStreamer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastreamer/PlatformDataStreamer.java
@@ -217,14 +217,7 @@ public class PlatformDataStreamer extends PlatformAbstractTarget {
return TRUE;
}
- }
-
- return super.processInLongOutLong(type, val);
- }
- /** {@inheritDoc} */
- @Override public long processOutLong(int type) throws IgniteCheckedException {
- switch (type) {
case OP_ALLOW_OVERWRITE:
return ldr.allowOverwrite() ? TRUE : FALSE;
@@ -238,7 +231,7 @@ public class PlatformDataStreamer extends PlatformAbstractTarget {
return ldr.perNodeParallelOperations();
}
- return super.processOutLong(type);
+ return super.processInLongOutLong(type, val);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/7290d88e/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastructures/PlatformAtomicLong.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastructures/PlatformAtomicLong.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastructures/PlatformAtomicLong.java
index 5331956..811e38b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastructures/PlatformAtomicLong.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastructures/PlatformAtomicLong.java
@@ -99,8 +99,17 @@ public class PlatformAtomicLong extends PlatformAbstractTarget {
}
/** {@inheritDoc} */
- @Override protected long processOutLong(int type) throws IgniteCheckedException {
+ @Override protected long processInLongOutLong(int type, long val) throws IgniteCheckedException {
switch (type) {
+ case OP_ADD_AND_GET:
+ return atomicLong.addAndGet(val);
+
+ case OP_GET_AND_ADD:
+ return atomicLong.getAndAdd(val);
+
+ case OP_GET_AND_SET:
+ return atomicLong.getAndSet(val);
+
case OP_CLOSE:
atomicLong.close();
@@ -125,22 +134,6 @@ public class PlatformAtomicLong extends PlatformAbstractTarget {
return atomicLong.removed() ? TRUE : FALSE;
}
- return super.processOutLong(type);
- }
-
- /** {@inheritDoc} */
- @Override protected long processInLongOutLong(int type, long val) throws IgniteCheckedException {
- switch (type) {
- case OP_ADD_AND_GET:
- return atomicLong.addAndGet(val);
-
- case OP_GET_AND_ADD:
- return atomicLong.getAndAdd(val);
-
- case OP_GET_AND_SET:
- return atomicLong.getAndSet(val);
- }
-
return super.processInLongOutLong(type, val);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7290d88e/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastructures/PlatformAtomicReference.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastructures/PlatformAtomicReference.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastructures/PlatformAtomicReference.java
index e5fc08d..63b5b86 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastructures/PlatformAtomicReference.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastructures/PlatformAtomicReference.java
@@ -24,7 +24,6 @@ import org.apache.ignite.internal.processors.datastructures.GridCacheAtomicRefer
import org.apache.ignite.internal.processors.platform.PlatformAbstractTarget;
import org.apache.ignite.internal.processors.platform.PlatformContext;
import org.apache.ignite.internal.processors.platform.memory.PlatformMemory;
-import org.omg.CORBA.TRANSACTION_REQUIRED;
/**
* Platform atomic reference wrapper.
@@ -135,7 +134,7 @@ public class PlatformAtomicReference extends PlatformAbstractTarget {
}
/** {@inheritDoc} */
- @Override protected long processOutLong(int type) throws IgniteCheckedException {
+ @Override protected long processInLongOutLong(int type, long val) throws IgniteCheckedException {
switch (type) {
case OP_CLOSE:
atomicRef.close();
@@ -146,7 +145,6 @@ public class PlatformAtomicReference extends PlatformAbstractTarget {
return atomicRef.removed() ? TRUE : FALSE;
}
- return super.processOutLong(type);
+ return super.processInLongOutLong(type, val);
}
-}
-
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/7290d88e/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastructures/PlatformAtomicSequence.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastructures/PlatformAtomicSequence.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastructures/PlatformAtomicSequence.java
index ec946ca..c352731 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastructures/PlatformAtomicSequence.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastructures/PlatformAtomicSequence.java
@@ -71,8 +71,19 @@ public class PlatformAtomicSequence extends PlatformAbstractTarget {
/** {@inheritDoc} */
- @Override protected long processOutLong(int type) throws IgniteCheckedException {
+ @Override protected long processInLongOutLong(int type, long val) throws IgniteCheckedException {
switch (type) {
+ case OP_ADD_AND_GET:
+ return atomicSeq.addAndGet(val);
+
+ case OP_GET_AND_ADD:
+ return atomicSeq.getAndAdd(val);
+
+ case OP_SET_BATCH_SIZE:
+ atomicSeq.batchSize((int)val);
+
+ return TRUE;
+
case OP_CLOSE:
atomicSeq.close();
@@ -94,24 +105,6 @@ public class PlatformAtomicSequence extends PlatformAbstractTarget {
return atomicSeq.batchSize();
}
- return super.processOutLong(type);
- }
-
- /** {@inheritDoc} */
- @Override protected long processInLongOutLong(int type, long val) throws IgniteCheckedException {
- switch (type) {
- case OP_ADD_AND_GET:
- return atomicSeq.addAndGet(val);
-
- case OP_GET_AND_ADD:
- return atomicSeq.getAndAdd(val);
-
- case OP_SET_BATCH_SIZE:
- atomicSeq.batchSize((int)val);
-
- return TRUE;
- }
-
return super.processInLongOutLong(type, val);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7290d88e/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/services/PlatformServices.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/services/PlatformServices.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/services/PlatformServices.java
index 7aaf597..dc63503 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/services/PlatformServices.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/services/PlatformServices.java
@@ -205,7 +205,7 @@ public class PlatformServices extends PlatformAbstractTarget {
}
/** {@inheritDoc} */
- @Override protected void processInObjectStreamOutStream(int type, Object arg, BinaryRawReaderEx reader,
+ @Override protected Object processInObjectStreamOutObjectStream(int type, Object arg, BinaryRawReaderEx reader,
BinaryRawWriterEx writer) throws IgniteCheckedException {
switch (type) {
case OP_INVOKE: {
@@ -234,12 +234,11 @@ public class PlatformServices extends PlatformAbstractTarget {
PlatformUtils.writeInvocationResult(writer, null, e);
}
- return;
+ return null;
}
-
- default:
- super.processInObjectStreamOutStream(type, arg, reader, writer);
}
+
+ return super.processInObjectStreamOutObjectStream(type, arg, reader, writer);
}
/** {@inheritDoc} */
@@ -298,7 +297,7 @@ public class PlatformServices extends PlatformAbstractTarget {
}
/** {@inheritDoc} */
- @Override protected long processOutLong(int type) throws IgniteCheckedException {
+ @Override protected long processInLongOutLong(int type, long val) throws IgniteCheckedException {
switch (type) {
case OP_CANCEL_ALL:
services.cancelAll();
@@ -306,7 +305,7 @@ public class PlatformServices extends PlatformAbstractTarget {
return TRUE;
}
- return super.processOutLong(type);
+ return super.processInLongOutLong(type, val);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/7290d88e/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/transactions/PlatformTransactions.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/transactions/PlatformTransactions.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/transactions/PlatformTransactions.java
index 339937c..92d8b53 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/transactions/PlatformTransactions.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/transactions/PlatformTransactions.java
@@ -169,18 +169,6 @@ public class PlatformTransactions extends PlatformAbstractTarget {
}
/** {@inheritDoc} */
- @Override protected long processOutLong(int type) throws IgniteCheckedException {
- switch (type) {
- case OP_RESET_METRICS:
- txs.resetMetrics();
-
- return TRUE;
- }
-
- return super.processOutLong(type);
- }
-
- /** {@inheritDoc} */
@Override protected long processInLongOutLong(int type, long val) throws IgniteCheckedException {
switch (type) {
case OP_COMMIT:
@@ -201,6 +189,11 @@ public class PlatformTransactions extends PlatformAbstractTarget {
case OP_STATE:
return tx(val).state().ordinal();
+
+ case OP_RESET_METRICS:
+ txs.resetMetrics();
+
+ return TRUE;
}
return super.processInLongOutLong(type, val);
http://git-wip-us.apache.org/repos/asf/ignite/blob/7290d88e/modules/platforms/cpp/core/src/impl/cache/query/query_impl.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/src/impl/cache/query/query_impl.cpp b/modules/platforms/cpp/core/src/impl/cache/query/query_impl.cpp
index c65e1e8..aaeb822 100644
--- a/modules/platforms/cpp/core/src/impl/cache/query/query_impl.cpp
+++ b/modules/platforms/cpp/core/src/impl/cache/query/query_impl.cpp
@@ -67,7 +67,7 @@ namespace ignite
delete batch;
// 2. Close the cursor.
- env.Get()->Context()->TargetOutLong(javaRef, OP_ITERATOR_CLOSE);
+ env.Get()->Context()->TargetInLongOutLong(javaRef, OP_ITERATOR_CLOSE, 0);
// 3. Release Java reference.
JniContext::Release(javaRef);
@@ -199,7 +199,7 @@ namespace ignite
JniErrorInfo jniErr;
- env.Get()->Context()->TargetOutLong(javaRef, OP_ITERATOR, &jniErr);
+ env.Get()->Context()->TargetInLongOutLong(javaRef, OP_ITERATOR, 0, &jniErr);
IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, &err);
@@ -249,7 +249,7 @@ namespace ignite
{
JniErrorInfo jniErr;
- bool res = env.Get()->Context()->TargetOutLong(javaRef, OP_ITERATOR_HAS_NEXT, &jniErr) == 1;
+ bool res = env.Get()->Context()->TargetInLongOutLong(javaRef, OP_ITERATOR_HAS_NEXT, 0, &jniErr) == 1;
IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, &err);
http://git-wip-us.apache.org/repos/asf/ignite/blob/7290d88e/modules/platforms/cpp/core/src/impl/interop/interop_target.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/src/impl/interop/interop_target.cpp b/modules/platforms/cpp/core/src/impl/interop/interop_target.cpp
index 592c1ba..b0c7b89 100644
--- a/modules/platforms/cpp/core/src/impl/interop/interop_target.cpp
+++ b/modules/platforms/cpp/core/src/impl/interop/interop_target.cpp
@@ -100,7 +100,7 @@ namespace ignite
{
JniErrorInfo jniErr;
- long long res = env.Get()->Context()->TargetOutLong(javaRef, opType, &jniErr);
+ long long res = env.Get()->Context()->TargetInLongOutLong(javaRef, opType, 0, &jniErr);
IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
http://git-wip-us.apache.org/repos/asf/ignite/blob/7290d88e/modules/platforms/cpp/jni/include/ignite/jni/exports.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/include/ignite/jni/exports.h b/modules/platforms/cpp/jni/include/ignite/jni/exports.h
index 84f5a29f..e476cf8 100644
--- a/modules/platforms/cpp/jni/include/ignite/jni/exports.h
+++ b/modules/platforms/cpp/jni/include/ignite/jni/exports.h
@@ -59,9 +59,7 @@ extern "C" {
long long IGNITE_CALL IgniteTargetInStreamOutLong(gcj::JniContext* ctx, void* obj, int opType, long long memPtr);
void IGNITE_CALL IgniteTargetInStreamOutStream(gcj::JniContext* ctx, void* obj, int opType, long long inMemPtr, long long outMemPtr);
void* IGNITE_CALL IgniteTargetInStreamOutObject(gcj::JniContext* ctx, void* obj, int opType, long long memPtr);
- void IGNITE_CALL IgniteTargetInObjectStreamOutStream(gcj::JniContext* ctx, void* obj, int opType, void* arg, long long inMemPtr, long long outMemPtr);
void* IGNITE_CALL IgniteTargetInObjectStreamOutObjectStream(gcj::JniContext* ctx, void* obj, int opType, void* arg, long long inMemPtr, long long outMemPtr);
- long long IGNITE_CALL IgniteTargetOutLong(gcj::JniContext* ctx, void* obj, int opType);
void IGNITE_CALL IgniteTargetOutStream(gcj::JniContext* ctx, void* obj, int opType, long long memPtr);
void* IGNITE_CALL IgniteTargetOutObject(gcj::JniContext* ctx, void* obj, int opType);
void IGNITE_CALL IgniteTargetListenFuture(gcj::JniContext* ctx, void* obj, long long futId, int typ);
http://git-wip-us.apache.org/repos/asf/ignite/blob/7290d88e/modules/platforms/cpp/jni/include/ignite/jni/java.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/include/ignite/jni/java.h b/modules/platforms/cpp/jni/include/ignite/jni/java.h
index 96daba8..1f2de2e 100644
--- a/modules/platforms/cpp/jni/include/ignite/jni/java.h
+++ b/modules/platforms/cpp/jni/include/ignite/jni/java.h
@@ -261,11 +261,9 @@ namespace ignite
jmethodID m_PlatformTarget_inLongOutLong;
jmethodID m_PlatformTarget_inStreamOutLong;
jmethodID m_PlatformTarget_inStreamOutObject;
- jmethodID m_PlatformTarget_outLong;
jmethodID m_PlatformTarget_outStream;
jmethodID m_PlatformTarget_outObject;
jmethodID m_PlatformTarget_inStreamOutStream;
- jmethodID m_PlatformTarget_inObjectStreamOutStream;
jmethodID m_PlatformTarget_inObjectStreamOutObjectStream;
jmethodID m_PlatformTarget_listenFuture;
jmethodID m_PlatformTarget_listenFutureForOperation;
@@ -441,9 +439,7 @@ namespace ignite
long long TargetInStreamOutLong(jobject obj, int type, long long memPtr, JniErrorInfo* errInfo = NULL);
void TargetInStreamOutStream(jobject obj, int opType, long long inMemPtr, long long outMemPtr, JniErrorInfo* errInfo = NULL);
jobject TargetInStreamOutObject(jobject obj, int type, long long memPtr, JniErrorInfo* errInfo = NULL);
- void TargetInObjectStreamOutStream(jobject obj, int opType, void* arg, long long inMemPtr, long long outMemPtr, JniErrorInfo* errInfo = NULL);
jobject TargetInObjectStreamOutObjectStream(jobject obj, int opType, void* arg, long long inMemPtr, long long outMemPtr, JniErrorInfo* errInfo = NULL);
- long long TargetOutLong(jobject obj, int opType, JniErrorInfo* errInfo = NULL);
void TargetOutStream(jobject obj, int opType, long long memPtr, JniErrorInfo* errInfo = NULL);
jobject TargetOutObject(jobject obj, int opType, JniErrorInfo* errInfo = NULL);
void TargetListenFuture(jobject obj, long long futId, int typ);
http://git-wip-us.apache.org/repos/asf/ignite/blob/7290d88e/modules/platforms/cpp/jni/project/vs/module.def
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/project/vs/module.def b/modules/platforms/cpp/jni/project/vs/module.def
index c2069b6..7930b5a 100644
--- a/modules/platforms/cpp/jni/project/vs/module.def
+++ b/modules/platforms/cpp/jni/project/vs/module.def
@@ -6,7 +6,6 @@ IgniteIgnitionInstance @3
IgniteIgnitionEnvironmentPointer @4
IgniteIgnitionStop @5
IgniteIgnitionStopAll @6
-IgniteTargetOutLong @7
IgniteProcessorReleaseStart @8
IgniteProcessorProjection @9
IgniteProcessorCache @10
@@ -20,7 +19,7 @@ IgniteTargetInStreamOutObject @17
IgniteTargetInStreamOutLong @18
IgniteTargetOutStream @19
IgniteTargetInStreamOutStream @20
-IgniteTargetInObjectStreamOutStream @21
+IgniteTargetInObjectStreamOutObjectStream @21
IgniteTargetListenFuture @22
IgniteTargetListenFutureForOperation @23
IgniteTargetInLongOutLong @24
http://git-wip-us.apache.org/repos/asf/ignite/blob/7290d88e/modules/platforms/cpp/jni/src/exports.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/src/exports.cpp b/modules/platforms/cpp/jni/src/exports.cpp
index ca332be..76f38ce 100644
--- a/modules/platforms/cpp/jni/src/exports.cpp
+++ b/modules/platforms/cpp/jni/src/exports.cpp
@@ -154,18 +154,10 @@ extern "C" {
return ctx->TargetInStreamOutObject(static_cast<jobject>(obj), opType, memPtr);
}
- void IGNITE_CALL IgniteTargetInObjectStreamOutStream(gcj::JniContext* ctx, void* obj, int opType, void* arg, long long inMemPtr, long long outMemPtr) {
- ctx->TargetInObjectStreamOutStream(static_cast<jobject>(obj), opType, arg, inMemPtr, outMemPtr);
- }
-
void* IGNITE_CALL IgniteTargetInObjectStreamOutObjectStream(gcj::JniContext* ctx, void* obj, int opType, void* arg, long long inMemPtr, long long outMemPtr) {
return ctx->TargetInObjectStreamOutObjectStream(static_cast<jobject>(obj), opType, arg, inMemPtr, outMemPtr);
}
- long long IGNITE_CALL IgniteTargetOutLong(gcj::JniContext* ctx, void* obj, int opType) {
- return ctx->TargetOutLong(static_cast<jobject>(obj), opType);
- }
-
void IGNITE_CALL IgniteTargetOutStream(gcj::JniContext* ctx, void* obj, int opType, long long memPtr) {
ctx->TargetOutStream(static_cast<jobject>(obj), opType, memPtr);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7290d88e/modules/platforms/cpp/jni/src/java.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/src/java.cpp b/modules/platforms/cpp/jni/src/java.cpp
index 5bbaac4..4c16976 100644
--- a/modules/platforms/cpp/jni/src/java.cpp
+++ b/modules/platforms/cpp/jni/src/java.cpp
@@ -218,9 +218,7 @@ namespace ignite
JniMethod M_PLATFORM_TARGET_IN_STREAM_OUT_LONG = JniMethod("inStreamOutLong", "(IJ)J", false);
JniMethod M_PLATFORM_TARGET_IN_STREAM_OUT_OBJECT = JniMethod("inStreamOutObject", "(IJ)Ljava/lang/Object;", false);
JniMethod M_PLATFORM_TARGET_IN_STREAM_OUT_STREAM = JniMethod("inStreamOutStream", "(IJJ)V", false);
- JniMethod M_PLATFORM_TARGET_IN_OBJECT_STREAM_OUT_STREAM = JniMethod("inObjectStreamOutStream", "(ILjava/lang/Object;JJ)V", false);
JniMethod M_PLATFORM_TARGET_IN_OBJECT_STREAM_OUT_OBJECT_STREAM = JniMethod("inObjectStreamOutObjectStream", "(ILjava/lang/Object;JJ)Ljava/lang/Object;", false);
- JniMethod M_PLATFORM_TARGET_OUT_LONG = JniMethod("outLong", "(I)J", false);
JniMethod M_PLATFORM_TARGET_OUT_STREAM = JniMethod("outStream", "(IJ)V", false);
JniMethod M_PLATFORM_TARGET_OUT_OBJECT = JniMethod("outObject", "(I)Ljava/lang/Object;", false);
JniMethod M_PLATFORM_TARGET_LISTEN_FUTURE = JniMethod("listenFuture", "(JI)V", false);
@@ -512,11 +510,9 @@ namespace ignite
m_PlatformTarget_inLongOutLong = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_IN_LONG_OUT_LONG);
m_PlatformTarget_inStreamOutLong = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_IN_STREAM_OUT_LONG);
m_PlatformTarget_inStreamOutObject = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_IN_STREAM_OUT_OBJECT);
- m_PlatformTarget_outLong = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_OUT_LONG);
m_PlatformTarget_outStream = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_OUT_STREAM);
m_PlatformTarget_outObject = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_OUT_OBJECT);
m_PlatformTarget_inStreamOutStream = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_IN_STREAM_OUT_STREAM);
- m_PlatformTarget_inObjectStreamOutStream = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_IN_OBJECT_STREAM_OUT_STREAM);
m_PlatformTarget_inObjectStreamOutObjectStream = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_IN_OBJECT_STREAM_OUT_OBJECT_STREAM);
m_PlatformTarget_listenFuture = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_LISTEN_FUTURE);
m_PlatformTarget_listenFutureForOperation = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_LISTEN_FOR_OPERATION);
@@ -1295,14 +1291,6 @@ namespace ignite
return LocalToGlobal(env, res);
}
- void JniContext::TargetInObjectStreamOutStream(jobject obj, int opType, void* arg, long long inMemPtr, long long outMemPtr, JniErrorInfo* err) {
- JNIEnv* env = Attach();
-
- env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformTarget_inObjectStreamOutStream, opType, arg, inMemPtr, outMemPtr);
-
- ExceptionCheck(env, err);
- }
-
jobject JniContext::TargetInObjectStreamOutObjectStream(jobject obj, int opType, void* arg, long long inMemPtr, long long outMemPtr, JniErrorInfo* err) {
JNIEnv* env = Attach();
@@ -1313,17 +1301,6 @@ namespace ignite
return LocalToGlobal(env, res);
}
- long long JniContext::TargetOutLong(jobject obj, int opType, JniErrorInfo* err)
- {
- JNIEnv* env = Attach();
-
- jlong res = env->CallLongMethod(obj, jvm->GetMembers().m_PlatformTarget_outLong, opType);
-
- ExceptionCheck(env, err);
-
- return res;
- }
-
void JniContext::TargetOutStream(jobject obj, int opType, long long memPtr, JniErrorInfo* err) {
JNIEnv* env = Attach();
http://git-wip-us.apache.org/repos/asf/ignite/blob/7290d88e/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheAffinityImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheAffinityImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheAffinityImpl.cs
index 4ff1f2e..f09a119 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheAffinityImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheAffinityImpl.cs
@@ -104,7 +104,7 @@ namespace Apache.Ignite.Core.Impl.Cache
/** <inheritDoc /> */
public int Partitions
{
- get { return (int) DoOutOp(OpPartitions); }
+ get { return (int) DoOutInOp(OpPartitions); }
}
/** <inheritDoc /> */
http://git-wip-us.apache.org/repos/asf/ignite/blob/7290d88e/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
index 3a82932..2cc88e4 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
@@ -640,7 +640,7 @@ namespace Apache.Ignite.Core.Impl.Cache
/** <inheritdoc /> */
public void Clear()
{
- DoOutOp((int) CacheOp.ClearCache);
+ DoOutInOp((int) CacheOp.ClearCache);
}
/** <inheritDoc /> */
@@ -752,7 +752,7 @@ namespace Apache.Ignite.Core.Impl.Cache
/** <inheritDoc /> */
public void RemoveAll()
{
- DoOutOp((int) CacheOp.RemoveAll2);
+ DoOutInOp((int) CacheOp.RemoveAll2);
}
/** <inheritDoc /> */
@@ -795,7 +795,7 @@ namespace Apache.Ignite.Core.Impl.Cache
var op = loc ? CacheOp.SizeLoc : CacheOp.Size;
- return (int) DoOutInOpLong((int) op, modes0);
+ return (int) DoOutInOp((int) op, modes0);
}
/** <inheritDoc /> */
@@ -919,7 +919,7 @@ namespace Apache.Ignite.Core.Impl.Cache
/** <inheritDoc /> */
public Task Rebalance()
{
- return GetFuture<object>((futId, futTyp) => DoOutInOpLong((int) CacheOp.Rebalance, futId)).Task;
+ return GetFuture<object>((futId, futTyp) => DoOutInOp((int) CacheOp.Rebalance, futId)).Task;
}
/** <inheritDoc /> */
@@ -1273,7 +1273,7 @@ namespace Apache.Ignite.Core.Impl.Cache
/** <inheritdoc /> */
public void Enter(long id)
{
- DoOutInOpLong((int) CacheOp.EnterLock, id);
+ DoOutInOp((int) CacheOp.EnterLock, id);
}
/** <inheritdoc /> */
@@ -1289,13 +1289,13 @@ namespace Apache.Ignite.Core.Impl.Cache
/** <inheritdoc /> */
public void Exit(long id)
{
- DoOutInOpLong((int) CacheOp.ExitLock, id);
+ DoOutInOp((int) CacheOp.ExitLock, id);
}
/** <inheritdoc /> */
public void Close(long id)
{
- DoOutInOpLong((int) CacheOp.CloseLock, id);
+ DoOutInOp((int) CacheOp.CloseLock, id);
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7290d88e/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/AbstractQueryCursor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/AbstractQueryCursor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/AbstractQueryCursor.cs
index e6092d7..95c6a36 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/AbstractQueryCursor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/AbstractQueryCursor.cs
@@ -100,7 +100,7 @@ namespace Apache.Ignite.Core.Impl.Cache.Query
{
try
{
- DoOutOp(OpIteratorClose);
+ DoOutInOp(OpIteratorClose);
}
finally
{
@@ -125,7 +125,7 @@ namespace Apache.Ignite.Core.Impl.Cache.Query
throw new InvalidOperationException("Failed to get enumerator entries because " +
"GetAll() method has already been called.");
- DoOutOp(OpIterator);
+ DoOutInOp(OpIterator);
_iterCalled = true;
http://git-wip-us.apache.org/repos/asf/ignite/blob/7290d88e/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryHandleImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryHandleImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryHandleImpl.cs
index b66dc48..6139d8b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryHandleImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryHandleImpl.cs
@@ -225,7 +225,7 @@ namespace Apache.Ignite.Core.Impl.Cache.Query.Continuous
try
{
- UU.TargetOutLong(_nativeQry, 0);
+ UU.TargetInLongOutLong(_nativeQry, 0, 0);
}
finally
{
http://git-wip-us.apache.org/repos/asf/ignite/blob/7290d88e/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs
index 1b2e2aa..36d731d 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs
@@ -106,7 +106,7 @@ namespace Apache.Ignite.Core.Impl.Compute
/// </summary>
public void WithNoFailover()
{
- DoOutOp(OpWithNoFailover);
+ DoOutInOp(OpWithNoFailover);
}
/// <summary>
@@ -116,7 +116,7 @@ namespace Apache.Ignite.Core.Impl.Compute
/// <param name="timeout">Computation timeout in milliseconds.</param>
public void WithTimeout(long timeout)
{
- DoOutInOpLong(OpWithTimeout, timeout);
+ DoOutInOp(OpWithTimeout, timeout);
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/7290d88e/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStructures/AtomicLong.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStructures/AtomicLong.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStructures/AtomicLong.cs
index 571e6fd..0c4bf84 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStructures/AtomicLong.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStructures/AtomicLong.cs
@@ -68,31 +68,31 @@ namespace Apache.Ignite.Core.Impl.DataStructures
/** <inheritDoc /> */
public long Read()
{
- return DoOutOp((int) Op.Get);
+ return DoOutInOp((int) Op.Get);
}
/** <inheritDoc /> */
public long Increment()
{
- return DoOutOp((int) Op.IncrementAndGet);
+ return DoOutInOp((int) Op.IncrementAndGet);
}
/** <inheritDoc /> */
public long Add(long value)
{
- return DoOutInOpLong((int) Op.AddAndGet, value);
+ return DoOutInOp((int) Op.AddAndGet, value);
}
/** <inheritDoc /> */
public long Decrement()
{
- return DoOutOp((int) Op.DecrementAndGet);
+ return DoOutInOp((int) Op.DecrementAndGet);
}
/** <inheritDoc /> */
public long Exchange(long value)
{
- return DoOutInOpLong((int) Op.GetAndSet, value);
+ return DoOutInOp((int) Op.GetAndSet, value);
}
/** <inheritDoc /> */
@@ -108,13 +108,13 @@ namespace Apache.Ignite.Core.Impl.DataStructures
/** <inheritDoc /> */
public void Close()
{
- DoOutOp((int) Op.Close);
+ DoOutInOp((int) Op.Close);
}
/** <inheritDoc /> */
public bool IsClosed()
{
- return DoOutOp((int) Op.IsClosed) == True;
+ return DoOutInOp((int) Op.IsClosed) == True;
}
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/7290d88e/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStructures/AtomicReference.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStructures/AtomicReference.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStructures/AtomicReference.cs
index 75e36d1..4ca4b24 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStructures/AtomicReference.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStructures/AtomicReference.cs
@@ -82,13 +82,13 @@ namespace Apache.Ignite.Core.Impl.DataStructures
/** <inheritDoc /> */
public bool IsClosed
{
- get { return DoOutOp((int) Op.IsClosed) == True; }
+ get { return DoOutInOp((int) Op.IsClosed) == True; }
}
/** <inheritDoc /> */
public void Close()
{
- DoOutOp((int) Op.Close);
+ DoOutInOp((int) Op.Close);
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7290d88e/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStructures/AtomicSequence.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStructures/AtomicSequence.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStructures/AtomicSequence.cs
index b7b924e..f7fc6b7 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStructures/AtomicSequence.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/DataStructures/AtomicSequence.cs
@@ -65,38 +65,38 @@ namespace Apache.Ignite.Core.Impl.DataStructures
/** <inheritDoc /> */
public long Read()
{
- return DoOutOp((int) Op.Get);
+ return DoOutInOp((int) Op.Get);
}
/** <inheritDoc /> */
public long Increment()
{
- return DoOutOp((int) Op.IncrementAndGet);
+ return DoOutInOp((int) Op.IncrementAndGet);
}
/** <inheritDoc /> */
public long Add(long value)
{
- return DoOutInOpLong((int) Op.AddAndGet, value);
+ return DoOutInOp((int) Op.AddAndGet, value);
}
/** <inheritDoc /> */
public int BatchSize
{
- get { return (int) DoOutOp((int) Op.GetBatchSize); }
- set { DoOutInOpLong((int) Op.SetBatchSize, value); }
+ get { return (int) DoOutInOp((int) Op.GetBatchSize); }
+ set { DoOutInOp((int) Op.SetBatchSize, value); }
}
/** <inheritDoc /> */
public bool IsClosed
{
- get { return DoOutOp((int) Op.IsClosed) == True; }
+ get { return DoOutInOp((int) Op.IsClosed) == True; }
}
/** <inheritDoc /> */
public void Close()
{
- DoOutOp((int) Op.Close);
+ DoOutInOp((int) Op.Close);
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7290d88e/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerImpl.cs
index 8893fc5..b9e3030 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerImpl.cs
@@ -156,7 +156,7 @@ namespace Apache.Ignite.Core.Impl.Datastream
_hnd = marsh.Ignite.HandleRegistry.Allocate(thisRef);
// Start topology listening. This call will ensure that buffer size member is updated.
- DoOutInOpLong(OpListenTopology, _hnd);
+ DoOutInOp(OpListenTopology, _hnd);
// Membar to ensure fields initialization before leaving constructor.
Thread.MemoryBarrier();
@@ -184,7 +184,7 @@ namespace Apache.Ignite.Core.Impl.Datastream
{
ThrowIfDisposed();
- return DoOutOp(OpAllowOverwrite) == True;
+ return DoOutInOp(OpAllowOverwrite) == True;
}
finally
{
@@ -199,7 +199,7 @@ namespace Apache.Ignite.Core.Impl.Datastream
{
ThrowIfDisposed();
- DoOutInOpLong(OpSetAllowOverwrite, value ? True : False);
+ DoOutInOp(OpSetAllowOverwrite, value ? True : False);
}
finally
{
@@ -219,7 +219,7 @@ namespace Apache.Ignite.Core.Impl.Datastream
{
ThrowIfDisposed();
- return DoOutOp(OpSkipStore) == True;
+ return DoOutInOp(OpSkipStore) == True;
}
finally
{
@@ -234,7 +234,7 @@ namespace Apache.Ignite.Core.Impl.Datastream
{
ThrowIfDisposed();
- DoOutInOpLong(OpSetSkipStore, value ? True : False);
+ DoOutInOp(OpSetSkipStore, value ? True : False);
}
finally
{
@@ -254,7 +254,7 @@ namespace Apache.Ignite.Core.Impl.Datastream
{
ThrowIfDisposed();
- return (int) DoOutOp(OpPerNodeBufferSize);
+ return (int) DoOutInOp(OpPerNodeBufferSize);
}
finally
{
@@ -269,7 +269,7 @@ namespace Apache.Ignite.Core.Impl.Datastream
{
ThrowIfDisposed();
- DoOutInOpLong(OpSetPerNodeBufferSize, value);
+ DoOutInOp(OpSetPerNodeBufferSize, value);
_bufSndSize = _topSize * value;
}
@@ -291,7 +291,7 @@ namespace Apache.Ignite.Core.Impl.Datastream
{
ThrowIfDisposed();
- return (int) DoOutOp(OpPerNodeParallelOps);
+ return (int) DoOutInOp(OpPerNodeParallelOps);
}
finally
{
@@ -307,7 +307,7 @@ namespace Apache.Ignite.Core.Impl.Datastream
{
ThrowIfDisposed();
- DoOutInOpLong(OpSetPerNodeParallelOps, value);
+ DoOutInOp(OpSetPerNodeParallelOps, value);
}
finally
{
@@ -598,7 +598,7 @@ namespace Apache.Ignite.Core.Impl.Datastream
_topVer = topVer;
_topSize = topSize > 0 ? topSize : 1; // Do not set to 0 to avoid 0 buffer size.
- _bufSndSize = (int) (_topSize * DoOutOp(OpPerNodeBufferSize));
+ _bufSndSize = (int) (_topSize * DoOutInOp(OpPerNodeBufferSize));
}
}
finally
http://git-wip-us.apache.org/repos/asf/ignite/blob/7290d88e/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/Events.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/Events.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/Events.cs
index 5d1add640..db2b8d2 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/Events.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/Events.cs
@@ -339,7 +339,7 @@ namespace Apache.Ignite.Core.Impl.Events
// Should do this inside lock to avoid race with subscription
// ToArray is required because we are going to modify underlying dictionary during enumeration
foreach (var filter in GetLocalFilters(listener, types).ToArray())
- success |= (DoOutInOpLong((int) Op.StopLocalListen, filter.Handle) == True);
+ success |= (DoOutInOp((int) Op.StopLocalListen, filter.Handle) == True);
return success;
}
@@ -388,7 +388,7 @@ namespace Apache.Ignite.Core.Impl.Events
/** <inheritDoc /> */
public bool IsEnabled(int type)
{
- return DoOutInOpLong((int) Op.IsEnabled, type) == True;
+ return DoOutInOp((int) Op.IsEnabled, type) == True;
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/7290d88e/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
index 675af5e..e2fd386 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
@@ -486,7 +486,7 @@ namespace Apache.Ignite.Core.Impl
/** <inheritdoc /> */
public void ResetMetrics()
{
- UU.TargetOutLong(_prj.Target, ClusterGroupImpl.OpResetMetrics);
+ UU.TargetInLongOutLong(_prj.Target, ClusterGroupImpl.OpResetMetrics, 0);
}
/** <inheritdoc /> */
http://git-wip-us.apache.org/repos/asf/ignite/blob/7290d88e/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
index 8c065bc..f7906ff 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
@@ -259,16 +259,6 @@ namespace Apache.Ignite.Core.Impl
/// Perform out operation.
/// </summary>
/// <param name="type">Operation type.</param>
- /// <returns>Long result.</returns>
- protected long DoOutOp(int type)
- {
- return UU.TargetOutLong(_target, type);
- }
-
- /// <summary>
- /// Perform out operation.
- /// </summary>
- /// <param name="type">Operation type.</param>
/// <param name="action">Action to be performed on the stream.</param>
/// <returns></returns>
protected long DoOutOp(int type, Action<IBinaryStream> action)
@@ -502,35 +492,6 @@ namespace Apache.Ignite.Core.Impl
/// <param name="inAction">In action.</param>
/// <param name="arg">Argument.</param>
/// <returns>Result.</returns>
- protected unsafe TR DoOutInOp<TR>(int type, Action<BinaryWriter> outAction, Func<IBinaryStream, TR> inAction, void* arg)
- {
- using (PlatformMemoryStream outStream = IgniteManager.Memory.Allocate().GetStream())
- {
- using (PlatformMemoryStream inStream = IgniteManager.Memory.Allocate().GetStream())
- {
- BinaryWriter writer = _marsh.StartMarshal(outStream);
-
- outAction(writer);
-
- FinishMarshal(writer);
-
- UU.TargetInObjectStreamOutStream(_target, type, arg, outStream.SynchronizeOutput(), inStream.MemoryPointer);
-
- inStream.SynchronizeInput();
-
- return inAction(inStream);
- }
- }
- }
-
- /// <summary>
- /// Perform out-in operation.
- /// </summary>
- /// <param name="type">Operation type.</param>
- /// <param name="outAction">Out action.</param>
- /// <param name="inAction">In action.</param>
- /// <param name="arg">Argument.</param>
- /// <returns>Result.</returns>
protected unsafe TR DoOutInOp<TR>(int type, Action<BinaryWriter> outAction,
Func<IBinaryStream, IUnmanagedTarget, TR> inAction, void* arg)
{
@@ -672,7 +633,7 @@ namespace Apache.Ignite.Core.Impl
/// <param name="type">Operation type.</param>
/// <param name="val">Value.</param>
/// <returns>Result.</returns>
- protected long DoOutInOpLong(int type, long val)
+ protected long DoOutInOp(int type, long val = 0)
{
return UU.TargetInLongOutLong(_target, type, val);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7290d88e/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Services/Services.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Services/Services.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Services/Services.cs
index d6b1d05..3e72147 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Services/Services.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Services/Services.cs
@@ -273,7 +273,7 @@ namespace Apache.Ignite.Core.Impl.Services
/** <inheritDoc /> */
public void CancelAll()
{
- DoOutOp(OpCancelAll);
+ DoOutInOp(OpCancelAll);
}
/** <inheritDoc /> */
@@ -390,7 +390,7 @@ namespace Apache.Ignite.Core.Impl.Services
{
return DoOutInOp(OpInvokeMethod,
writer => ServiceProxySerializer.WriteProxyMethod(writer, method, args, platform),
- stream => ServiceProxySerializer.ReadInvocationResult(stream, Marshaller, _keepBinary), proxy.Target);
+ (stream, res) => ServiceProxySerializer.ReadInvocationResult(stream, Marshaller, _keepBinary), proxy.Target);
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7290d88e/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionsImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionsImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionsImpl.cs
index 796044d..81352e9 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionsImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionsImpl.cs
@@ -156,7 +156,7 @@ namespace Apache.Ignite.Core.Impl.Transactions
/** <inheritDoc /> */
public void ResetMetrics()
{
- DoOutOp(OpResetMetrics);
+ DoOutInOp(OpResetMetrics);
}
/// <summary>
@@ -166,7 +166,7 @@ namespace Apache.Ignite.Core.Impl.Transactions
/// <returns>Final transaction state.</returns>
internal TransactionState TxCommit(TransactionImpl tx)
{
- return (TransactionState) DoOutInOpLong(OpCommit, tx.Id);
+ return (TransactionState) DoOutInOp(OpCommit, tx.Id);
}
/// <summary>
@@ -176,7 +176,7 @@ namespace Apache.Ignite.Core.Impl.Transactions
/// <returns>Final transaction state.</returns>
internal TransactionState TxRollback(TransactionImpl tx)
{
- return (TransactionState) DoOutInOpLong(OpRollback, tx.Id);
+ return (TransactionState) DoOutInOp(OpRollback, tx.Id);
}
/// <summary>
@@ -186,7 +186,7 @@ namespace Apache.Ignite.Core.Impl.Transactions
/// <returns>Final transaction state.</returns>
internal int TxClose(TransactionImpl tx)
{
- return (int) DoOutInOpLong(OpClose, tx.Id);
+ return (int) DoOutInOp(OpClose, tx.Id);
}
/// <summary>
@@ -196,7 +196,7 @@ namespace Apache.Ignite.Core.Impl.Transactions
/// <returns>Transaction current state.</returns>
internal TransactionState TxState(TransactionImpl tx)
{
- return (TransactionState) DoOutInOpLong(OpState, tx.Id);
+ return (TransactionState) DoOutInOp(OpState, tx.Id);
}
/// <summary>
@@ -206,7 +206,7 @@ namespace Apache.Ignite.Core.Impl.Transactions
/// <returns><c>true</c> if the flag was set.</returns>
internal bool TxSetRollbackOnly(TransactionImpl tx)
{
- return DoOutInOpLong(OpSetRollbackOnly, tx.Id) == True;
+ return DoOutInOp(OpSetRollbackOnly, tx.Id) == True;
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/7290d88e/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs
index 8de82ee..296ca38 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs
@@ -124,19 +124,12 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
long outMemPtr);
[DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteTargetInStreamOutObject")]
- public static extern void* TargetInStreanOutObject(void* ctx, void* target, int opType, long memPtr);
-
- [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteTargetInObjectStreamOutStream")]
- public static extern void TargetInObjectStreamOutStream(void* ctx, void* target, int opType,
- void* arg, long inMemPtr, long outMemPtr);
+ public static extern void* TargetInStreamOutObject(void* ctx, void* target, int opType, long memPtr);
[DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteTargetInObjectStreamOutObjectStream")]
public static extern void* TargetInObjectStreamOutObjectStream(void* ctx, void* target, int opType,
void* arg, long inMemPtr, long outMemPtr);
- [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteTargetOutLong")]
- public static extern long TargetOutLong(void* ctx, void* target, int opType);
-
[DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteTargetOutStream")]
public static extern void TargetOutStream(void* ctx, void* target, int opType, long memPtr);
http://git-wip-us.apache.org/repos/asf/ignite/blob/7290d88e/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs
index 4722d0b..65e2296 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs
@@ -382,16 +382,11 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
internal static IUnmanagedTarget TargetInStreamOutObject(IUnmanagedTarget target, int opType, long inMemPtr)
{
- void* res = JNI.TargetInStreanOutObject(target.Context, target.Target, opType, inMemPtr);
+ void* res = JNI.TargetInStreamOutObject(target.Context, target.Target, opType, inMemPtr);
return target.ChangeTarget(res);
}
- internal static void TargetInObjectStreamOutStream(IUnmanagedTarget target, int opType, void* arg, long inMemPtr, long outMemPtr)
- {
- JNI.TargetInObjectStreamOutStream(target.Context, target.Target, opType, arg, inMemPtr, outMemPtr);
- }
-
internal static IUnmanagedTarget TargetInObjectStreamOutObjectStream(IUnmanagedTarget target, int opType, void* arg, long inMemPtr, long outMemPtr)
{
void* res = JNI.TargetInObjectStreamOutObjectStream(target.Context, target.Target, opType, arg, inMemPtr, outMemPtr);
@@ -402,11 +397,6 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
return target.ChangeTarget(res);
}
- internal static long TargetOutLong(IUnmanagedTarget target, int opType)
- {
- return JNI.TargetOutLong(target.Context, target.Target, opType);
- }
-
internal static void TargetOutStream(IUnmanagedTarget target, int opType, long memPtr)
{
JNI.TargetOutStream(target.Context, target.Target, opType, memPtr);
[02/20] ignite git commit: GG-11360 - Implement SQL queries
cancellation (#18)
Posted by sb...@apache.org.
GG-11360 - Implement SQL queries cancellation (#18)
* GG-11360 Merged IGNITE-2680 to ignite-1.6.3.
* GG-11360 Test cleanup.
* GG-11360 Fixing broken tests.
* GG-11360 Fixing test.
* GG-11360 Fixing test.
* GG-11360 Fixing broken tests.
* GG-11360 Added test for forever-running query cancellation on node restart.
* GG-11360 Fixing race.
* GG-11360 Added test for forever-running query cancellation on node stop.
* GG-11360 Cleanup.
* GG-11360 Support for local query cancellation/timeout.
* GG-11360 Increase test duration.
* GG-11360 Remove redundant catch block.
* GG-11360 Fix formatting.
* GG-11360 Fix formatting.
* GG-11360 Fix formatting.
* GG-11360 Fix formatting.
* GG-11360 Fix formatting.
* GG-11360 Fix formatting.
* GG-11360 Fix formatting.
* GG-11360 Fix formatting.
* GG-11360 Simplify test.
* GG-11360 Simplify test.
* GG-11360 Fixing issues.
* GG-11360 Fixing issues.
* GG-11360 Fixing issues.
* GG-11360 Fixing issues.
* GG-11360 Fixing issues.
* GG-11360 Fixing issues.
* GG-11360 Fixing issues.
* GG-11360 Fixing issues.
* GG-11360 Fixing issues.
* GG-11360 Fixing issues.
* GG-11360 Fixing issues.
* GG-11360 Fixing issues.
* GG-11360 Fixing issues.
* GG-11360 Fixing issues.
* GG-11360 Fixing issues.
* GG-11360 Fixing issues.
* Merge remote-tracking branch 'remotes/gg/ignite-1.6.10' into ignite-gg-11360
Conflicts:
modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
* GG-11360 Review fixes.
* GG-11360 Review fixes.
* GG-11360 Review fixes.
* GG-11360 Review fixes.
* GG-11360 Review fixes.
* GG-11360 Review fixes.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/80abd1b7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/80abd1b7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/80abd1b7
Branch: refs/heads/ignite-4111
Commit: 80abd1b72e4fc7b0b95212e7f53c700c0fe21156
Parents: 7adfbcf
Author: Aleksei Scherbakov <al...@gmail.com>
Authored: Fri Oct 14 19:33:07 2016 +0300
Committer: Sergi Vladykin <sv...@users.noreply.github.com>
Committed: Fri Oct 14 19:33:07 2016 +0300
----------------------------------------------------------------------
.../java/org/apache/ignite/IgniteScheduler.java | 13 +
.../cache/query/QueryCancelledException.java | 35 +++
.../apache/ignite/cache/query/QueryCursor.java | 8 +-
.../ignite/cache/query/SqlFieldsQuery.java | 26 ++
.../org/apache/ignite/cache/query/SqlQuery.java | 25 ++
.../ignite/internal/IgniteSchedulerImpl.java | 18 ++
.../processors/cache/QueryCursorImpl.java | 92 +++++--
.../processors/query/GridQueryCancel.java | 84 +++++++
.../processors/query/GridQueryFieldsResult.java | 3 +-
.../query/GridQueryFieldsResultAdapter.java | 3 +-
.../processors/query/GridQueryIndexing.java | 26 +-
.../processors/query/GridQueryProcessor.java | 115 +++++----
.../twostep/messages/GridQueryFailResponse.java | 34 ++-
.../h2/twostep/messages/GridQueryRequest.java | 31 ++-
.../processors/query/h2/IgniteH2Indexing.java | 177 ++++++++++---
.../query/h2/twostep/GridMapQueryExecutor.java | 42 +++-
.../h2/twostep/GridReduceQueryExecutor.java | 99 ++++++--
...niteCacheDistributedQueryCancelSelfTest.java | 176 +++++++++++++
...butedQueryStopOnCancelOrTimeoutSelfTest.java | 248 +++++++++++++++++++
.../IgniteCacheQueryNodeRestartSelfTest2.java | 125 ++++++----
...eCacheLocalQueryCancelOrTimeoutSelfTest.java | 158 ++++++++++++
.../h2/GridIndexingSpiAbstractSelfTest.java | 9 +-
.../IgniteCacheQuerySelfTestSuite2.java | 8 +
23 files changed, 1341 insertions(+), 214 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/80abd1b7/modules/core/src/main/java/org/apache/ignite/IgniteScheduler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteScheduler.java b/modules/core/src/main/java/org/apache/ignite/IgniteScheduler.java
index b0ea960..2e2553b 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteScheduler.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteScheduler.java
@@ -17,7 +17,9 @@
package org.apache.ignite;
+import java.io.Closeable;
import java.util.concurrent.Callable;
+import java.util.concurrent.TimeUnit;
import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgniteOutClosure;
import org.apache.ignite.lang.IgniteRunnable;
@@ -61,6 +63,17 @@ public interface IgniteScheduler {
public IgniteFuture<?> runLocal(@Nullable Runnable r);
/**
+ * Executes given closure after the delay.
+ * <p>
+ * Note that class {@link IgniteRunnable} implements {@link Runnable}
+ * @param r Runnable to execute.
+ * @param delay Initial delay.
+ * @param timeUnit Time granularity.
+ * @return java.io.Closeable which can be used to cancel execution.
+ */
+ public Closeable runLocal(@Nullable Runnable r, long delay, TimeUnit timeUnit);
+
+ /**
* Executes given callable on internal system thread pool asynchronously.
* <p>
* Note that class {@link IgniteRunnable} implements {@link Runnable} and class {@link IgniteOutClosure}
http://git-wip-us.apache.org/repos/asf/ignite/blob/80abd1b7/modules/core/src/main/java/org/apache/ignite/cache/query/QueryCancelledException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/QueryCancelledException.java b/modules/core/src/main/java/org/apache/ignite/cache/query/QueryCancelledException.java
new file mode 100644
index 0000000..5f5ffdc
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/cache/query/QueryCancelledException.java
@@ -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.
+ */
+
+package org.apache.ignite.cache.query;
+
+import org.apache.ignite.IgniteCheckedException;
+
+/**
+ * The exception is thrown if a query was cancelled or timed out while executing.
+ */
+public class QueryCancelledException extends IgniteCheckedException {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * Default constructor.
+ */
+ public QueryCancelledException() {
+ super("The query was cancelled while executing.");
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/80abd1b7/modules/core/src/main/java/org/apache/ignite/cache/query/QueryCursor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/QueryCursor.java b/modules/core/src/main/java/org/apache/ignite/cache/query/QueryCursor.java
index 84b6862..1af47ac 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/query/QueryCursor.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/query/QueryCursor.java
@@ -22,8 +22,6 @@ import java.util.List;
/**
* Query result cursor. Implements {@link Iterable} only for convenience, e.g. {@link #iterator()}
* can be obtained only once. Also if iteration is started then {@link #getAll()} method calls are prohibited.
- * <p>
- * Not thread safe and must be used from single thread only.
*/
public interface QueryCursor<T> extends Iterable<T>, AutoCloseable {
/**
@@ -39,7 +37,11 @@ public interface QueryCursor<T> extends Iterable<T>, AutoCloseable {
public List<T> getAll();
/**
- * Closes all resources related to this cursor.
+ * Closes all resources related to this cursor. If the query execution is in progress
+ * (which is possible in case of invoking from another thread), a cancel will be attempted.
+ * Sequential calls to this method have no effect.
+ * <p>
+ * Note: don't forget to close query cursors. Not doing so may lead to various resource leaks.
*/
@Override public void close();
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/80abd1b7/modules/core/src/main/java/org/apache/ignite/cache/query/SqlFieldsQuery.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/SqlFieldsQuery.java b/modules/core/src/main/java/org/apache/ignite/cache/query/SqlFieldsQuery.java
index b2dd181..d1a5117 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/query/SqlFieldsQuery.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/query/SqlFieldsQuery.java
@@ -18,7 +18,9 @@
package org.apache.ignite.cache.query;
import java.util.List;
+import java.util.concurrent.TimeUnit;
import org.apache.ignite.IgniteCache;
+import org.apache.ignite.internal.processors.query.GridQueryProcessor;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.A;
import org.apache.ignite.internal.util.typedef.internal.S;
@@ -56,6 +58,9 @@ public final class SqlFieldsQuery extends Query<List<?>> {
/** Collocation flag. */
private boolean collocated;
+ /** Query timeout in millis. */
+ private int timeout;
+
/**
* Constructs SQL fields query.
*
@@ -121,6 +126,27 @@ public final class SqlFieldsQuery extends Query<List<?>> {
}
/**
+ * Gets the query execution timeout in milliseconds.
+ *
+ * @return Timeout value.
+ */
+ public int getTimeout() {
+ return timeout;
+ }
+
+ /**
+ * Sets the query execution timeout. Query will be automatically cancelled if the execution timeout is exceeded.
+ * @param timeout Timeout value. Zero value disables timeout.
+ * @param timeUnit Time unit.
+ * @return {@code this} For chaining.
+ */
+ public SqlFieldsQuery setTimeout(int timeout, TimeUnit timeUnit) {
+ this.timeout = GridQueryProcessor.validateTimeout(timeout, timeUnit);
+
+ return this;
+ }
+
+ /**
* Checks if this query is collocated.
*
* @return {@code true} If the query is collocated.
http://git-wip-us.apache.org/repos/asf/ignite/blob/80abd1b7/modules/core/src/main/java/org/apache/ignite/cache/query/SqlQuery.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/SqlQuery.java b/modules/core/src/main/java/org/apache/ignite/cache/query/SqlQuery.java
index be3b390..51c6cb5 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/query/SqlQuery.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/query/SqlQuery.java
@@ -17,6 +17,7 @@
package org.apache.ignite.cache.query;
+import java.util.concurrent.TimeUnit;
import javax.cache.Cache;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.internal.processors.query.GridQueryProcessor;
@@ -43,6 +44,9 @@ public final class SqlQuery<K, V> extends Query<Cache.Entry<K, V>> {
@GridToStringInclude
private Object[] args;
+ /** Timeout in millis. */
+ private int timeout;
+
/**
* Constructs query for the given type name and SQL query.
*
@@ -130,6 +134,27 @@ public final class SqlQuery<K, V> extends Query<Cache.Entry<K, V>> {
return this;
}
+ /**
+ * Gets the query execution timeout in milliseconds.
+ *
+ * @return Timeout value.
+ */
+ public int getTimeout() {
+ return timeout;
+ }
+
+ /**
+ * Sets the query execution timeout. Query will be automatically cancelled if the execution timeout is exceeded.
+ * @param timeout Timeout value. Zero value disables timeout.
+ * @param timeUnit Time granularity.
+ * @return {@code this} For chaining.
+ */
+ public SqlQuery<K, V> setTimeout(int timeout, TimeUnit timeUnit) {
+ this.timeout = GridQueryProcessor.validateTimeout(timeout, timeUnit);
+
+ return this;
+ }
+
/** {@inheritDoc} */
@Override public SqlQuery<K, V> setPageSize(int pageSize) {
return (SqlQuery<K, V>)super.setPageSize(pageSize);
http://git-wip-us.apache.org/repos/asf/ignite/blob/80abd1b7/modules/core/src/main/java/org/apache/ignite/internal/IgniteSchedulerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteSchedulerImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteSchedulerImpl.java
index ed8d1a4..623b1f2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteSchedulerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteSchedulerImpl.java
@@ -17,17 +17,20 @@
package org.apache.ignite.internal;
+import java.io.Closeable;
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.io.ObjectStreamException;
import java.util.concurrent.Callable;
+import java.util.concurrent.TimeUnit;
import org.apache.ignite.IgniteScheduler;
import org.apache.ignite.internal.util.future.IgniteFutureImpl;
import org.apache.ignite.internal.util.typedef.internal.A;
import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.scheduler.SchedulerFuture;
+import org.jetbrains.annotations.Nullable;
/**
* {@link IgniteScheduler} implementation.
@@ -68,6 +71,21 @@ public class IgniteSchedulerImpl implements IgniteScheduler, Externalizable {
}
/** {@inheritDoc} */
+ @Override public Closeable runLocal(@Nullable Runnable r, long delay, TimeUnit timeUnit) {
+ A.notNull(r, "r");
+ A.ensure(delay > 0, "Illegal delay");
+
+ guard();
+
+ try {
+ return ctx.timeout().schedule(r, timeUnit.toMillis(delay), -1);
+ }
+ finally {
+ unguard();
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public <R> IgniteFuture<R> callLocal(Callable<R> c) {
A.notNull(c, "c");
http://git-wip-us.apache.org/repos/asf/ignite/blob/80abd1b7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/QueryCursorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/QueryCursorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/QueryCursorImpl.java
index 672a37d..f68426e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/QueryCursorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/QueryCursorImpl.java
@@ -20,15 +20,28 @@ package org.apache.ignite.internal.processors.cache;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
+import javax.cache.CacheException;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
+import org.apache.ignite.cache.query.QueryCancelledException;
import org.apache.ignite.internal.processors.cache.query.QueryCursorEx;
+import org.apache.ignite.internal.processors.query.GridQueryCancel;
import org.apache.ignite.internal.processors.query.GridQueryFieldMetadata;
+import static org.apache.ignite.internal.processors.cache.QueryCursorImpl.State.CLOSED;
+import static org.apache.ignite.internal.processors.cache.QueryCursorImpl.State.EXECUTION;
+import static org.apache.ignite.internal.processors.cache.QueryCursorImpl.State.IDLE;
+import static org.apache.ignite.internal.processors.cache.QueryCursorImpl.State.RESULT_READY;
+
/**
* Query cursor implementation.
*/
public class QueryCursorImpl<T> implements QueryCursorEx<T> {
+ /** */
+ private final static AtomicReferenceFieldUpdater<QueryCursorImpl, State> STATE_UPDATER =
+ AtomicReferenceFieldUpdater.newUpdater(QueryCursorImpl.class, State.class, "state");
+
/** Query executor. */
private Iterable<T> iterExec;
@@ -36,29 +49,43 @@ public class QueryCursorImpl<T> implements QueryCursorEx<T> {
private Iterator<T> iter;
/** */
- private boolean iterTaken;
+ private volatile State state = IDLE;
/** */
private List<GridQueryFieldMetadata> fieldsMeta;
+ /** */
+ private final GridQueryCancel cancel;
+
/**
* @param iterExec Query executor.
+ * @param cancel Cancellation closure.
*/
- public QueryCursorImpl(Iterable<T> iterExec) {
+ public QueryCursorImpl(Iterable<T> iterExec, GridQueryCancel cancel) {
this.iterExec = iterExec;
+ this.cancel = cancel;
+ }
+
+ /**
+ * @param iterExec Query executor.
+ */
+ public QueryCursorImpl(Iterable<T> iterExec) {
+ this(iterExec, null);
}
/** {@inheritDoc} */
@Override public Iterator<T> iterator() {
- if (iter == null && iterTaken)
- throw new IgniteException("Cursor is closed.");
+ if (!STATE_UPDATER.compareAndSet(this, IDLE, EXECUTION))
+ throw new IgniteException("Iterator is already fetched or query was cancelled.");
- if (iterTaken)
- throw new IgniteException("Iterator is already taken from this cursor.");
+ iter = iterExec.iterator();
- iterTaken = true;
+ if (!STATE_UPDATER.compareAndSet(this, EXECUTION, RESULT_READY)) {
+ // Handle race with cancel and make sure the iterator resources are freed correctly.
+ closeIter();
- iter = iterExec.iterator();
+ throw new CacheException(new QueryCancelledException());
+ }
assert iter != null;
@@ -93,18 +120,35 @@ public class QueryCursorImpl<T> implements QueryCursorEx<T> {
/** {@inheritDoc} */
@Override public void close() {
- Iterator<T> i;
-
- if ((i = iter) != null) {
- iter = null;
-
- if (i instanceof AutoCloseable) {
- try {
- ((AutoCloseable)i).close();
- }
- catch (Exception e) {
- throw new IgniteException(e);
- }
+ while(state != CLOSED) {
+ if (STATE_UPDATER.compareAndSet(this, RESULT_READY, CLOSED)) {
+ closeIter();
+
+ return;
+ }
+
+ if (STATE_UPDATER.compareAndSet(this, EXECUTION, CLOSED)) {
+ if (cancel != null)
+ cancel.cancel();
+
+ return;
+ }
+
+ if (STATE_UPDATER.compareAndSet(this, IDLE, CLOSED))
+ return;
+ }
+ }
+
+ /**
+ * Closes iterator.
+ */
+ private void closeIter() {
+ if (iter instanceof AutoCloseable) {
+ try {
+ ((AutoCloseable)iter).close();
+ }
+ catch (Exception e) {
+ throw new IgniteException(e);
}
}
}
@@ -122,4 +166,12 @@ public class QueryCursorImpl<T> implements QueryCursorEx<T> {
@Override public List<GridQueryFieldMetadata> fieldsMeta() {
return fieldsMeta;
}
+
+ /** Query cursor state */
+ protected enum State {
+ /** Idle. */IDLE,
+ /** Executing. */EXECUTION,
+ /** Result ready. */RESULT_READY,
+ /** Closed. */CLOSED,
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/80abd1b7/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryCancel.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryCancel.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryCancel.java
new file mode 100644
index 0000000..47f1208
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryCancel.java
@@ -0,0 +1,84 @@
+/*
+ * 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.cache.query.QueryCancelledException;
+import org.apache.ignite.internal.IgniteInterruptedCheckedException;
+import org.apache.ignite.internal.util.typedef.internal.U;
+
+/**
+ * Holds query cancel state.
+ */
+public class GridQueryCancel {
+ /** */
+ private volatile boolean cancelled;
+
+ /** */
+ private volatile boolean completed;
+
+ /** */
+ private volatile Runnable clo;
+
+ /**
+ * Sets a cancel closure. The closure must be idempotent to multiple invocations.
+ *
+ * @param clo Clo.
+ */
+ public void set(Runnable clo) throws QueryCancelledException{
+ checkCancelled();
+
+ this.clo = clo;
+ }
+
+ /**
+ * Spins until a query is completed.
+ * Only one thread can enter this method.
+ * This is guaranteed by {@link org.apache.ignite.internal.processors.cache.QueryCursorImpl}
+ */
+ public void cancel() {
+ cancelled = true;
+
+ int attempt = 0;
+
+ while (!completed) {
+ if (clo != null) clo.run();
+
+ try {
+ U.sleep(++attempt * 10);
+ } catch (IgniteInterruptedCheckedException ignored) {
+ return;
+ }
+ }
+ }
+
+ /**
+ * Stops query execution if a user requested cancel.
+ */
+ public void checkCancelled() throws QueryCancelledException{
+ if (cancelled)
+ throw new QueryCancelledException();
+ }
+
+ /**
+ * Sets completed state.
+ * The method must be called then a query is completed by any reason, typically in final block.
+ */
+ public void setCompleted() {
+ completed = true;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/80abd1b7/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryFieldsResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryFieldsResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryFieldsResult.java
index 25c8caba..e32a687 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryFieldsResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryFieldsResult.java
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.processors.query;
import java.util.List;
+import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.spi.IgniteSpiCloseableIterator;
/**
@@ -37,5 +38,5 @@ public interface GridQueryFieldsResult {
*
* @return Iterator over queried fields.
*/
- IgniteSpiCloseableIterator<List<?>> iterator();
+ IgniteSpiCloseableIterator<List<?>> iterator() throws IgniteCheckedException;
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/80abd1b7/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryFieldsResultAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryFieldsResultAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryFieldsResultAdapter.java
index fc01d2d..7f1d175 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryFieldsResultAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryFieldsResultAdapter.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.query;
import java.util.Collections;
import java.util.List;
+import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.util.lang.GridCloseableIterator;
import org.jetbrains.annotations.Nullable;
@@ -51,7 +52,7 @@ public class GridQueryFieldsResultAdapter implements GridQueryFieldsResult {
}
/** {@inheritDoc} */
- @Override public GridCloseableIterator<List<?>> iterator() {
+ @Override public GridCloseableIterator<List<?>> iterator() throws IgniteCheckedException{
return it;
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/80abd1b7/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 7697a12..b1b3c68 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
@@ -29,7 +29,6 @@ import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.CacheObject;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.query.GridCacheTwoStepQuery;
import org.apache.ignite.internal.util.GridSpinBusyLock;
import org.apache.ignite.internal.util.lang.GridCloseableIterator;
import org.apache.ignite.lang.IgniteBiTuple;
@@ -58,17 +57,6 @@ public interface GridQueryIndexing {
public void stop() throws IgniteCheckedException;
/**
- * Runs two step query.
- *
- * @param cctx Cache context.
- * @param qry Query.
- * @param keepCacheObjects If {@code true}, cache objects representation will be preserved.
- * @return Cursor.
- */
- public Iterable<List<?>> queryTwoStep(GridCacheContext<?,?> cctx, GridCacheTwoStepQuery qry,
- boolean keepCacheObjects);
-
- /**
* Parses SQL query into two step query and executes it.
*
* @param cctx Cache context.
@@ -93,11 +81,14 @@ public interface GridQueryIndexing {
* @param qry Query.
* @param params Query parameters.
* @param filters Space name and key filters.
+ * @param timeout Query timeout in milliseconds.
+ * @param cancel Query cancel.
* @return Query result.
* @throws IgniteCheckedException If failed.
*/
- public GridQueryFieldsResult queryFields(@Nullable String spaceName, String qry,
- Collection<Object> params, IndexingQueryFilter filters) throws IgniteCheckedException;
+ public GridQueryFieldsResult execute(@Nullable String spaceName, String qry,
+ Collection<Object> params, IndexingQueryFilter filters, int timeout, GridQueryCancel cancel)
+ throws IgniteCheckedException;
/**
* Executes regular query.
@@ -241,4 +232,9 @@ public interface GridQueryIndexing {
* @param reconnectFut Reconnect future.
*/
public void onDisconnected(IgniteFuture<?> reconnectFut);
-}
+
+ /**
+ * Cancels all executing queries.
+ */
+ public void cancelAllQueries();
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/80abd1b7/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 1605188..3d185c6 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
@@ -39,6 +39,7 @@ import java.util.TreeSet;
import java.util.UUID;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ExecutorService;
+import java.util.concurrent.TimeUnit;
import javax.cache.Cache;
import javax.cache.CacheException;
import org.apache.ignite.IgniteCheckedException;
@@ -71,7 +72,6 @@ import org.apache.ignite.internal.processors.cache.QueryCursorImpl;
import org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl;
import org.apache.ignite.internal.processors.cache.query.CacheQueryFuture;
import org.apache.ignite.internal.processors.cache.query.CacheQueryType;
-import org.apache.ignite.internal.processors.cache.query.GridCacheTwoStepQuery;
import org.apache.ignite.internal.util.GridSpinBusyLock;
import org.apache.ignite.internal.util.future.GridCompoundFuture;
import org.apache.ignite.internal.util.future.GridFinishedFuture;
@@ -82,6 +82,7 @@ import org.apache.ignite.internal.util.tostring.GridToStringExclude;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.T2;
+import org.apache.ignite.internal.util.typedef.internal.A;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.internal.util.worker.GridWorker;
@@ -434,6 +435,19 @@ public class GridQueryProcessor extends GridProcessorAdapter {
@Override public void onKernalStop(boolean cancel) {
super.onKernalStop(cancel);
+ if (cancel && idx != null)
+ try {
+ while (!busyLock.tryBlock(500))
+ idx.cancelAllQueries();
+
+ return;
+ }
+ catch (InterruptedException e) {
+ U.warn(log, "Interrupted while waiting for active queries cancellation.");
+
+ Thread.currentThread().interrupt();
+ }
+
busyLock.block();
}
@@ -763,37 +777,6 @@ public class GridQueryProcessor extends GridProcessorAdapter {
}
/**
- * @param space Space name.
- * @param qry Query.
- * @return Cursor.
- */
- public Iterable<List<?>> queryTwoStep(String space, final GridCacheTwoStepQuery qry) {
- checkxEnabled();
-
- if (!busyLock.enterBusy())
- throw new IllegalStateException("Failed to execute query (grid is stopping).");
-
- try {
- final GridCacheContext<Object, Object> cctx = ctx.cache().internalCache(space).context();
-
- return executeQuery(cctx, new IgniteOutClosureX<Iterable<List<?>>>() {
- @Override public Iterable<List<?>> applyx() throws IgniteCheckedException {
- return idx.queryTwoStep(
- cctx,
- qry,
- cctx.keepBinary());
- }
- }, false);
- }
- catch (IgniteCheckedException e) {
- throw new IgniteException(e);
- }
- finally {
- busyLock.leaveBusy();
- }
- }
-
- /**
* @param cctx Cache context.
* @param qry Query.
* @return Cursor.
@@ -806,7 +789,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
try {
return executeQuery(cctx, new IgniteOutClosureX<QueryCursor<List<?>>>() {
- @Override public QueryCursor<List<?>> applyx() throws IgniteCheckedException {
+ @Override public QueryCursor<List<?>> applyx() {
return idx.queryTwoStep(cctx, qry);
}
}, true);
@@ -942,6 +925,24 @@ public class GridQueryProcessor extends GridProcessorAdapter {
}
/**
+ * @param timeout Timeout.
+ * @param timeUnit Time unit.
+ * @return Converted time.
+ */
+ public static int validateTimeout(int timeout, TimeUnit timeUnit) {
+ A.ensure(timeUnit != TimeUnit.MICROSECONDS && timeUnit != TimeUnit.NANOSECONDS,
+ "timeUnit minimal resolution is millisecond.");
+
+ A.ensure(timeout >= 0, "timeout value should be non-negative.");
+
+ long tmp = TimeUnit.MILLISECONDS.convert(timeout, timeUnit);
+
+ A.ensure(timeout <= Integer.MAX_VALUE, "timeout value too large.");
+
+ return (int) tmp;
+ }
+
+ /**
* Closeable iterator.
*/
private interface ClIter<X> extends AutoCloseable, Iterator<X> {
@@ -962,20 +963,26 @@ public class GridQueryProcessor extends GridProcessorAdapter {
return executeQuery(cctx, new IgniteOutClosureX<QueryCursor<List<?>>>() {
@Override public QueryCursor<List<?>> applyx() throws IgniteCheckedException {
- String space = cctx.name();
- String sql = qry.getSql();
- Object[] args = qry.getArgs();
-
- final GridQueryFieldsResult res = idx.queryFields(space, sql, F.asList(args),
- idx.backupFilter(null, requestTopVer.get(), null));
+ final String space = cctx.name();
+ final String sql = qry.getSql();
+ final Object[] args = qry.getArgs();
+ final GridQueryCancel cancel = new GridQueryCancel();
- sendQueryExecutedEvent(sql, args);
+ final GridQueryFieldsResult res = idx.execute(space, sql, F.asList(args),
+ idx.backupFilter(null, requestTopVer.get(), null), qry.getTimeout(), cancel);
QueryCursorImpl<List<?>> cursor = new QueryCursorImpl<>(new Iterable<List<?>>() {
@Override public Iterator<List<?>> iterator() {
- return new GridQueryCacheObjectsIterator(res.iterator(), cctx, keepBinary);
+ try {
+ sendQueryExecutedEvent(sql, args);
+
+ return new GridQueryCacheObjectsIterator(res.iterator(), cctx, keepBinary);
+ }
+ catch (IgniteCheckedException e) {
+ throw new IgniteException(e);
+ }
}
- });
+ }, cancel);
cursor.fieldsMeta(res.metaData());
@@ -1076,14 +1083,13 @@ public class GridQueryProcessor extends GridProcessorAdapter {
* @return Type name.
*/
public static String typeName(String clsName) {
- int packageEnd = clsName.lastIndexOf('.');
+ int pkgEnd = clsName.lastIndexOf('.');
- if (packageEnd >= 0 && packageEnd < clsName.length() - 1)
- clsName = clsName.substring(packageEnd + 1);
+ if (pkgEnd >= 0 && pkgEnd < clsName.length() - 1)
+ clsName = clsName.substring(pkgEnd + 1);
- if (clsName.endsWith("[]")) {
+ if (clsName.endsWith("[]"))
clsName = clsName.substring(0, clsName.length() - 2) + "_array";
- }
int parentEnd = clsName.lastIndexOf('$');
@@ -1154,7 +1160,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
return executeQuery(cctx, new IgniteOutClosureX<GridQueryFieldsResult>() {
@Override public GridQueryFieldsResult applyx() throws IgniteCheckedException {
- return idx.queryFields(space, clause, params, filters);
+ return idx.execute(space, clause, params, filters, 0, null);
}
}, false);
}
@@ -1519,13 +1525,12 @@ public class GridQueryProcessor extends GridProcessorAdapter {
for (Map.Entry<String, String> entry : qryEntity.getFields().entrySet()) {
ClassProperty prop = buildClassProperty(
- d.keyClass(),
- d.valueClass(),
- entry.getKey(),
- U.classForName(entry.getValue(), Object.class),
- aliases,
- coCtx);
-
+ d.keyClass(),
+ d.valueClass(),
+ entry.getKey(),
+ U.classForName(entry.getValue(), Object.class),
+ aliases,
+ coCtx);
d.addProperty(prop, false);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/80abd1b7/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryFailResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryFailResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryFailResponse.java
index 499438d..0baf6ea 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryFailResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryFailResponse.java
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.processors.query.h2.twostep.messages;
import java.nio.ByteBuffer;
+import org.apache.ignite.cache.query.QueryCancelledException;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.plugin.extensions.communication.MessageReader;
@@ -27,6 +28,12 @@ import org.apache.ignite.plugin.extensions.communication.MessageWriter;
* Error message.
*/
public class GridQueryFailResponse implements Message {
+ /** General error failure type. */
+ public static final byte GENERAL_ERROR = 0;
+
+ /** Cancelled by originator failure type. */
+ public static final byte CANCELLED_BY_ORIGINATOR = 1;
+
/** */
private static final long serialVersionUID = 0L;
@@ -36,6 +43,9 @@ public class GridQueryFailResponse implements Message {
/** */
private String errMsg;
+ /** */
+ private byte failCode;
+
/**
* Default constructor.
*/
@@ -50,6 +60,7 @@ public class GridQueryFailResponse implements Message {
public GridQueryFailResponse(long qryReqId, Throwable err) {
this.qryReqId = qryReqId;
this.errMsg = err.getClass() + ":" + err.getMessage();
+ this.failCode = err instanceof QueryCancelledException ? CANCELLED_BY_ORIGINATOR : GENERAL_ERROR;
}
/**
@@ -66,6 +77,13 @@ public class GridQueryFailResponse implements Message {
return errMsg;
}
+ /**
+ * @return Fail code.
+ */
+ public byte failCode() {
+ return failCode;
+ }
+
/** {@inheritDoc} */
@Override public void onAckReceived() {
// No-op.
@@ -100,6 +118,12 @@ public class GridQueryFailResponse implements Message {
writer.incrementState();
+ case 2:
+ if (!writer.writeByte("failCode", failCode))
+ return false;
+
+ writer.incrementState();
+
}
return true;
@@ -129,6 +153,14 @@ public class GridQueryFailResponse implements Message {
reader.incrementState();
+ case 2:
+ failCode = reader.readByte("failCode");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
}
return reader.afterMessageRead(GridQueryFailResponse.class);
@@ -141,6 +173,6 @@ public class GridQueryFailResponse implements Message {
/** {@inheritDoc} */
@Override public byte fieldsCount() {
- return 2;
+ return 3;
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/80abd1b7/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryRequest.java
index 60d348b..550cf9b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryRequest.java
@@ -66,6 +66,9 @@ public class GridQueryRequest implements Message {
@GridToStringInclude
private int[] parts;
+ /** */
+ private int timeout;
+
/**
* Default constructor.
*/
@@ -81,6 +84,7 @@ public class GridQueryRequest implements Message {
* @param topVer Topology version.
* @param extraSpaces All space names participating in query other than {@code space}.
* @param parts Optional partitions for unstable topology.
+ * @param timeout Timeout in millis.
*/
public GridQueryRequest(
long reqId,
@@ -89,7 +93,8 @@ public class GridQueryRequest implements Message {
Collection<GridCacheSqlQuery> qrys,
AffinityTopologyVersion topVer,
List<String> extraSpaces,
- int[] parts) {
+ int[] parts,
+ int timeout) {
this.reqId = reqId;
this.pageSize = pageSize;
this.space = space;
@@ -98,6 +103,7 @@ public class GridQueryRequest implements Message {
this.topVer = topVer;
this.extraSpaces = extraSpaces;
this.parts = parts;
+ this.timeout = timeout;
}
/**
@@ -163,6 +169,13 @@ public class GridQueryRequest implements Message {
}
/**
+ * @return Timeout.
+ */
+ public int timeout() {
+ return this.timeout;
+ }
+
+ /**
* @return Queries.
*/
public Collection<GridCacheSqlQuery> queries() throws IgniteCheckedException {
@@ -233,6 +246,12 @@ public class GridQueryRequest implements Message {
writer.incrementState();
+ case 7:
+ if (!writer.writeInt("timeout", timeout))
+ return false;
+
+ writer.incrementState();
+
}
return true;
@@ -302,6 +321,14 @@ public class GridQueryRequest implements Message {
reader.incrementState();
+ case 7:
+ timeout = reader.readInt("timeout");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
}
return reader.afterMessageRead(GridQueryRequest.class);
@@ -314,6 +341,6 @@ public class GridQueryRequest implements Message {
/** {@inheritDoc} */
@Override public byte fieldsCount() {
- return 7;
+ return 8;
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/80abd1b7/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 a5f283e..ab332c1 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
@@ -51,12 +51,14 @@ import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.TimeUnit;
import javax.cache.Cache;
import javax.cache.CacheException;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cache.CacheMemoryMode;
+import org.apache.ignite.cache.query.QueryCancelledException;
import org.apache.ignite.cache.query.QueryCursor;
import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.SqlQuery;
@@ -75,6 +77,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
import org.apache.ignite.internal.processors.cache.QueryCursorImpl;
import org.apache.ignite.internal.processors.cache.query.GridCacheTwoStepQuery;
+import org.apache.ignite.internal.processors.query.GridQueryCancel;
import org.apache.ignite.internal.processors.query.GridQueryFieldMetadata;
import org.apache.ignite.internal.processors.query.GridQueryFieldsResult;
import org.apache.ignite.internal.processors.query.GridQueryFieldsResultAdapter;
@@ -120,9 +123,12 @@ import org.h2.api.JavaObjectSerializer;
import org.h2.command.CommandInterface;
import org.h2.constant.ErrorCode;
import org.h2.constant.SysProperties;
+import org.h2.engine.Session;
import org.h2.index.Index;
import org.h2.index.SpatialIndex;
+import org.h2.jdbc.JdbcConnection;
import org.h2.jdbc.JdbcPreparedStatement;
+import org.h2.jdbc.JdbcStatement;
import org.h2.message.DbException;
import org.h2.mvstore.cache.CacheLongKeyLIRS;
import org.h2.server.web.WebServer;
@@ -350,7 +356,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
PreparedStatement stmt = cache.get(sql);
- if (stmt != null && !stmt.isClosed()) {
+ if (stmt != null && !((JdbcStatement)stmt).wasCancelled()) {
assert stmt.getConnection() == c;
return stmt;
@@ -727,28 +733,33 @@ public class IgniteH2Indexing implements GridQueryIndexing {
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
- @Override public GridQueryFieldsResult queryFields(@Nullable final String spaceName, final String qry,
- @Nullable final Collection<Object> params, final IndexingQueryFilter filters)
+ @Override public GridQueryFieldsResult execute(@Nullable final String spaceName, final String qry,
+ @Nullable final Collection<Object> params, final IndexingQueryFilter filters,
+ final int timeout, final GridQueryCancel cancel)
throws IgniteCheckedException {
setFilters(filters);
try {
- Connection conn = connectionForThread(schema(spaceName));
+ final Connection conn = connectionForThread(schema(spaceName));
- ResultSet rs = executeSqlQueryWithTimer(spaceName, conn, qry, params, true);
+ final PreparedStatement stmt = preparedStatementWithParams(conn, qry, params, true);
- List<GridQueryFieldMetadata> meta = null;
+ List<GridQueryFieldMetadata> meta;
- if (rs != null) {
- try {
- meta = meta(rs.getMetaData());
- }
- catch (SQLException e) {
- throw new IgniteCheckedException("Failed to get meta data.", e);
- }
+ try {
+ meta = meta(stmt.getMetaData());
+ }
+ catch (SQLException e) {
+ throw new IgniteCheckedException("Cannot prepare query metadata", e);
}
- return new GridQueryFieldsResultAdapter(meta, new FieldsIterator(rs));
+ return new GridQueryFieldsResultAdapter(meta, null) {
+ @Override public GridCloseableIterator<List<?>> iterator() throws IgniteCheckedException{
+ ResultSet rs = executeSqlQueryWithTimer(spaceName, stmt, conn, qry, params, timeout, cancel);
+
+ return new FieldsIterator(rs);
+ }
+ };
}
finally {
setFilters(null);
@@ -808,18 +819,18 @@ public class IgniteH2Indexing implements GridQueryIndexing {
}
/**
- * Executes sql query.
+ * Prepares sql statement.
*
- * @param conn Connection,.
- * @param sql Sql query.
- * @param params Parameters.
- * @param useStmtCache If {@code true} uses statement cache.
- * @return Result.
+ * @param conn Connection.
+ * @param sql Sql.
+ * @param params Params.
+ * @param useStmtCache If {@code true} use stmt cache.
+ * @return Prepared statement with set parameters.
* @throws IgniteCheckedException If failed.
*/
- private ResultSet executeSqlQuery(Connection conn, String sql, Collection<Object> params, boolean useStmtCache)
- throws IgniteCheckedException {
- PreparedStatement stmt;
+ private PreparedStatement preparedStatementWithParams(Connection conn, String sql, Collection<Object> params,
+ boolean useStmtCache) throws IgniteCheckedException {
+ final PreparedStatement stmt;
try {
stmt = prepareStatement(conn, sql, useStmtCache);
@@ -840,12 +851,54 @@ public class IgniteH2Indexing implements GridQueryIndexing {
bindParameters(stmt, params);
+ return stmt;
+ }
+
+ /**
+ * Executes sql query statement.
+ *
+ * @param conn Connection,.
+ * @param stmt Statement.
+ * @param cancel Query cancel.
+ * @return Result.
+ * @throws IgniteCheckedException If failed.
+ */
+ private ResultSet executeSqlQuery(final Connection conn, final PreparedStatement stmt,
+ int timeoutMillis, @Nullable GridQueryCancel cancel)
+ throws IgniteCheckedException {
+
+ if (timeoutMillis > 0)
+ ((Session)((JdbcConnection)conn).getSession()).setQueryTimeout(timeoutMillis);
+
+ if (cancel != null) {
+ cancel.set(new Runnable() {
+ @Override public void run() {
+ try {
+ stmt.cancel();
+ } catch (SQLException ignored) {
+ // No-op.
+ }
+ }
+ });
+ }
+
try {
return stmt.executeQuery();
}
catch (SQLException e) {
+ // Throw special exception.
+ if (e.getErrorCode() == ErrorCode.STATEMENT_WAS_CANCELED)
+ throw new QueryCancelledException();
+
throw new IgniteCheckedException("Failed to execute SQL query.", e);
}
+ finally {
+ if(cancel != null)
+ cancel.setCompleted();
+
+ if (timeoutMillis > 0)
+ ((Session)((JdbcConnection)conn).getSession()).setQueryTimeout(0);
+ }
}
/**
@@ -855,7 +908,8 @@ public class IgniteH2Indexing implements GridQueryIndexing {
* @param conn Connection,.
* @param sql Sql query.
* @param params Parameters.
- * @param useStmtCache If {@code true} uses statement cache.
+ * @param useStmtCache If {@code true} uses stmt cache.
+ * @param cancel Query cancel.
* @return Result.
* @throws IgniteCheckedException If failed.
*/
@@ -863,11 +917,35 @@ public class IgniteH2Indexing implements GridQueryIndexing {
Connection conn,
String sql,
@Nullable Collection<Object> params,
- boolean useStmtCache) throws IgniteCheckedException {
+ boolean useStmtCache,
+ int timeoutMillis,
+ @Nullable GridQueryCancel cancel) throws IgniteCheckedException {
+ return executeSqlQueryWithTimer(space, preparedStatementWithParams(conn, sql, params, useStmtCache),
+ conn, sql, params, timeoutMillis, cancel);
+ }
+
+ /**
+ * Executes sql query and prints warning if query is too slow.
+ *
+ * @param space Space name.
+ * @param stmt Prepared statement for query.
+ * @param conn Connection.
+ * @param sql Sql query.
+ * @param params Parameters.
+ * @param cancel Query cancel.
+ * @return Result.
+ * @throws IgniteCheckedException If failed.
+ */
+ private ResultSet executeSqlQueryWithTimer(String space, PreparedStatement stmt,
+ Connection conn,
+ String sql,
+ @Nullable Collection<Object> params,
+ int timeoutMillis,
+ @Nullable GridQueryCancel cancel) throws IgniteCheckedException {
long start = U.currentTimeMillis();
try {
- ResultSet rs = executeSqlQuery(conn, sql, params, useStmtCache);
+ ResultSet rs = executeSqlQuery(conn, stmt, timeoutMillis, cancel);
long time = U.currentTimeMillis() - start;
@@ -876,7 +954,8 @@ public class IgniteH2Indexing implements GridQueryIndexing {
if (time > longQryExecTimeout) {
String msg = "Query execution is too long (" + time + " ms): " + sql;
- ResultSet plan = executeSqlQuery(conn, "EXPLAIN " + sql, params, false);
+ ResultSet plan = executeSqlQuery(conn, preparedStatementWithParams(conn, "EXPLAIN " + sql,
+ params, false), 0, null);
plan.next();
@@ -903,16 +982,20 @@ public class IgniteH2Indexing implements GridQueryIndexing {
* @param qry Query.
* @param params Query parameters.
* @param tbl Target table of query to generate select.
+ * @param cancel Query cancel.
* @return Result set.
* @throws IgniteCheckedException If failed.
*/
- private ResultSet executeQuery(String space, String qry, @Nullable Collection<Object> params, TableDescriptor tbl)
+ private ResultSet executeQuery(String space, String qry, @Nullable Collection<Object> params, TableDescriptor tbl,
+ @Nullable GridQueryCancel cancel)
throws IgniteCheckedException {
Connection conn = connectionForThread(tbl.schemaName());
String sql = generateQuery(qry, tbl);
- return executeSqlQueryWithTimer(space, conn, sql, params, true);
+ return executeSqlQueryWithTimer(space,
+ preparedStatementWithParams(conn, sql, params, true),
+ conn, sql, params, 0, cancel);
}
/**
@@ -954,7 +1037,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
setFilters(filters);
try {
- ResultSet rs = executeQuery(spaceName, qry, params, tbl);
+ ResultSet rs = executeQuery(spaceName, qry, params, tbl, null);
return new KeyValIterator(rs);
}
@@ -964,11 +1047,19 @@ public class IgniteH2Indexing implements GridQueryIndexing {
}
/** {@inheritDoc} */
- @Override public Iterable<List<?>> queryTwoStep(final GridCacheContext<?,?> cctx, final GridCacheTwoStepQuery qry,
- final boolean keepCacheObj) {
+ private Iterable<List<?>> doQueryTwoStep(final GridCacheContext<?, ?> cctx, final GridCacheTwoStepQuery qry,
+ final boolean keepCacheObj,
+ final int timeoutMillis,
+ final GridQueryCancel cancel) {
return new Iterable<List<?>>() {
@Override public Iterator<List<?>> iterator() {
- return rdcQryExec.query(cctx, qry, keepCacheObj);
+ try {
+ return rdcQryExec.query(cctx, qry, keepCacheObj, timeoutMillis, cancel);
+ }
+ finally {
+ if (cancel != null)
+ cancel.setCompleted();
+ }
}
};
}
@@ -998,6 +1089,9 @@ public class IgniteH2Indexing implements GridQueryIndexing {
fqry.setArgs(qry.getArgs());
fqry.setPageSize(qry.getPageSize());
+ if(qry.getTimeout() > 0)
+ fqry.setTimeout(qry.getTimeout(), TimeUnit.MILLISECONDS);
+
final QueryCursor<List<?>> res = queryTwoStep(cctx, fqry);
final Iterable<Cache.Entry<K, V>> converted = new Iterable<Cache.Entry<K, V>>() {
@@ -1064,7 +1158,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
try {
ctx.cache().createMissingCaches();
}
- catch (IgniteCheckedException e1) {
+ catch (IgniteCheckedException ignored) {
throw new CacheException("Failed to create missing caches.", e);
}
@@ -1104,7 +1198,10 @@ public class IgniteH2Indexing implements GridQueryIndexing {
twoStepQry.pageSize(qry.getPageSize());
- QueryCursorImpl<List<?>> cursor = new QueryCursorImpl<>(queryTwoStep(cctx, twoStepQry, cctx.keepBinary()));
+ GridQueryCancel cancel = new GridQueryCancel();
+
+ QueryCursorImpl<List<?>> cursor = new QueryCursorImpl<>(
+ doQueryTwoStep(cctx, twoStepQry, cctx.keepBinary(), qry.getTimeout(), cancel), cancel);
cursor.fieldsMeta(meta);
@@ -1455,8 +1552,8 @@ public class IgniteH2Indexing implements GridQueryIndexing {
if (tbl == null)
return -1;
- IgniteSpiCloseableIterator<List<?>> iter = queryFields(spaceName,
- "SELECT COUNT(*) FROM " + tbl.fullTableName(), null, null).iterator();
+ IgniteSpiCloseableIterator<List<?>> iter = execute(spaceName,
+ "SELECT COUNT(*) FROM " + tbl.fullTableName(), null, null, 0, null).iterator();
return ((Number)iter.next().get(0)).longValue();
}
@@ -2618,4 +2715,10 @@ public class IgniteH2Indexing implements GridQueryIndexing {
lastUsage = U.currentTimeMillis();
}
}
+
+ /** {@inheritDoc} */
+ @Override public void cancelAllQueries() {
+ for (Connection conn : conns)
+ U.close(conn, log);
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/80abd1b7/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
index 580058c..1f05bf7 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
@@ -19,8 +19,6 @@ package org.apache.ignite.internal.processors.query.h2.twostep;
import java.lang.reflect.Field;
import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
import java.util.AbstractCollection;
import java.util.ArrayList;
import java.util.Collection;
@@ -52,6 +50,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartit
import org.apache.ignite.internal.processors.cache.distributed.dht.GridReservable;
import org.apache.ignite.internal.processors.cache.query.CacheQueryType;
import org.apache.ignite.internal.processors.cache.query.GridCacheSqlQuery;
+import org.apache.ignite.internal.processors.query.GridQueryCancel;
import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
import org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryCancelRequest;
import org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryFailResponse;
@@ -452,10 +451,12 @@ public class GridMapQueryExecutor {
for (GridCacheSqlQuery qry : qrys) {
ResultSet rs = h2.executeSqlQueryWithTimer(req.space(),
- h2.connectionForSpace(req.space()),
- qry.query(),
- F.asList(qry.parameters()),
- true);
+ h2.connectionForSpace(req.space()),
+ qry.query(),
+ F.asList(qry.parameters()),
+ true,
+ req.timeout(),
+ qr.cancels[i]);
if (ctx.event().isRecordable(EVT_CACHE_QUERY_EXECUTED)) {
ctx.event().record(new CacheQueryExecutedEvent<>(
@@ -509,6 +510,15 @@ public class GridMapQueryExecutor {
// Release reserved partitions.
for (GridReservable r : reserved)
r.release();
+
+ // Ensure all cancels state is correct.
+ if (qr != null)
+ for (int i = 0; i < qr.cancels.length; i++) {
+ GridQueryCancel cancel = qr.cancels[i];
+
+ if (cancel != null)
+ cancel.setCompleted();
+ }
}
}
@@ -637,6 +647,9 @@ public class GridMapQueryExecutor {
private final AtomicReferenceArray<QueryResult> results;
/** */
+ private final GridQueryCancel[] cancels;
+
+ /** */
private final GridCacheContext<?,?> cctx;
/** */
@@ -652,6 +665,10 @@ public class GridMapQueryExecutor {
this.cctx = cctx;
results = new AtomicReferenceArray<>(qrys);
+ cancels = new GridQueryCancel[qrys];
+
+ for (int i = 0; i < cancels.length; i++)
+ cancels[i] = new GridQueryCancel();
}
/**
@@ -687,6 +704,9 @@ public class GridMapQueryExecutor {
return true;
}
+ /**
+ * Cancels the query.
+ */
void cancel() {
if (canceled)
return;
@@ -696,8 +716,16 @@ public class GridMapQueryExecutor {
for (int i = 0; i < results.length(); i++) {
QueryResult res = results.get(i);
- if (res != null)
+ if (res != null) {
res.close();
+
+ continue;
+ }
+
+ GridQueryCancel cancel = cancels[i];
+
+ if (cancel != null)
+ cancel.cancel();
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/80abd1b7/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 6a079f0..3fdbf42 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,8 +62,10 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.Gri
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.GridQueryCacheObjectsIterator;
+import org.apache.ignite.internal.processors.query.GridQueryCancel;
import org.apache.ignite.internal.processors.query.h2.GridH2ResultSetIterator;
import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
+import org.apache.ignite.cache.query.QueryCancelledException;
import org.apache.ignite.internal.processors.query.h2.sql.GridSqlQuerySplitter;
import org.apache.ignite.internal.processors.query.h2.sql.GridSqlType;
import org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryCancelRequest;
@@ -244,7 +246,7 @@ public class GridReduceQueryExecutor {
private void onFail(ClusterNode node, GridQueryFailResponse msg) {
QueryRun r = runs.get(msg.queryRequestId());
- fail(r, node.id(), msg.error());
+ fail(r, node.id(), msg.error(), msg.failCode());
}
/**
@@ -252,9 +254,15 @@ public class GridReduceQueryExecutor {
* @param nodeId Failed node ID.
* @param msg Error message.
*/
- private void fail(QueryRun r, UUID nodeId, String msg) {
- if (r != null)
- r.state(new CacheException("Failed to execute map query on the node: " + nodeId + ", " + msg), nodeId);
+ private void fail(QueryRun r, UUID nodeId, String msg, byte failCode) {
+ if (r != null) {
+ CacheException e = new CacheException("Failed to execute map query on the node: " + nodeId + ", " + msg);
+
+ if (failCode == GridQueryFailResponse.CANCELLED_BY_ORIGINATOR)
+ e.addSuppressed(new QueryCancelledException());
+
+ r.state(e, nodeId);
+ }
}
/**
@@ -312,7 +320,7 @@ public class GridReduceQueryExecutor {
catch (Exception e) {
U.error(log, "Error in message.", e);
- fail(r, node.id(), "Error in message.");
+ fail(r, node.id(), "Error in message.", GridQueryFailResponse.GENERAL_ERROR);
return;
}
@@ -449,9 +457,12 @@ public class GridReduceQueryExecutor {
* @param cctx Cache context.
* @param qry Query.
* @param keepBinary Keep binary.
- * @return Cursor.
+ * @param timeoutMillis Timeout in milliseconds.
+ * @param cancel Query cancel.
+ * @return Rows iterator.
*/
- public Iterator<List<?>> query(GridCacheContext<?,?> cctx, GridCacheTwoStepQuery qry, boolean keepBinary) {
+ public Iterator<List<?>> query(GridCacheContext<?,?> cctx, GridCacheTwoStepQuery qry, boolean keepBinary,
+ int timeoutMillis, GridQueryCancel cancel) {
for (int attempt = 0;; attempt++) {
if (attempt != 0) {
try {
@@ -464,7 +475,7 @@ public class GridReduceQueryExecutor {
}
}
- long qryReqId = reqIdGen.incrementAndGet();
+ final long qryReqId = reqIdGen.incrementAndGet();
QueryRun r = new QueryRun();
@@ -510,6 +521,8 @@ public class GridReduceQueryExecutor {
nodes = Collections.singleton(F.rand(nodes));
}
+ final Collection<ClusterNode> finalNodes = nodes;
+
int tblIdx = 0;
final boolean skipMergeTbl = !qry.explain() && qry.skipMergeTable();
@@ -545,6 +558,8 @@ public class GridReduceQueryExecutor {
runs.put(qryReqId, r);
try {
+ cancel.checkCancelled();
+
if (ctx.clientDisconnected()) {
throw new CacheException("Query was cancelled, client node disconnected.",
new IgniteClientDisconnectedException(ctx.cluster().clientReconnectFuture(),
@@ -567,12 +582,20 @@ public class GridReduceQueryExecutor {
mapQry.marshallParams(m);
}
+ cancel.set(new Runnable() {
+ @Override public void run() {
+ send(finalNodes, new GridQueryCancelRequest(qryReqId), null);
+ }
+ });
+
boolean retry = false;
if (send(nodes,
- new GridQueryRequest(qryReqId, r.pageSize, space, mapQrys, topVer, extraSpaces, null), partsMap)) {
+ new GridQueryRequest(qryReqId, r.pageSize, space, mapQrys, topVer, extraSpaces, null, timeoutMillis), partsMap)) {
awaitAllReplies(r, nodes);
+ cancel.checkCancelled();
+
Object state = r.state.get();
if (state != null) {
@@ -582,6 +605,9 @@ public class GridReduceQueryExecutor {
if (err.getCause() instanceof IgniteClientDisconnectedException)
throw err;
+ if (wasCancelled(err))
+ throw new QueryCancelledException(); // Throw correct exception.
+
throw new CacheException("Failed to run map query remotely.", err);
}
@@ -627,6 +653,8 @@ public class GridReduceQueryExecutor {
resIter = res.iterator();
}
else {
+ cancel.checkCancelled();
+
GridCacheSqlQuery rdc = qry.reduceQuery();
// Statement caching is prohibited here because we can't guarantee correct merge index reuse.
@@ -634,17 +662,14 @@ public class GridReduceQueryExecutor {
r.conn,
rdc.query(),
F.asList(rdc.parameters()),
- false);
+ false,
+ timeoutMillis,
+ cancel);
resIter = new Iter(res);
}
}
- for (GridMergeIndex idx : r.idxs) {
- if (!idx.fetchedAll()) // We have to explicitly cancel queries on remote nodes.
- send(nodes, new GridQueryCancelRequest(qryReqId), null);
- }
-
if (retry) {
if (Thread.currentThread().isInterrupted())
throw new IgniteInterruptedCheckedException("Query was interrupted.");
@@ -657,8 +682,12 @@ public class GridReduceQueryExecutor {
catch (IgniteCheckedException | RuntimeException e) {
U.closeQuiet(r.conn);
- if (e instanceof CacheException)
+ if (e instanceof CacheException) {
+ if (wasCancelled((CacheException)e))
+ throw new CacheException("Failed to run reduce query locally.", new QueryCancelledException());
+
throw (CacheException)e;
+ }
Throwable cause = e;
@@ -673,6 +702,9 @@ public class GridReduceQueryExecutor {
throw new CacheException("Failed to run reduce query locally.", cause);
}
finally {
+ // Make sure any activity related to current attempt is cancelled.
+ cancelRemoteQueriesIfNeeded(nodes, r, qryReqId);
+
if (!runs.remove(qryReqId, r))
U.warn(log, "Query run was already removed: " + qryReqId);
@@ -685,6 +717,33 @@ public class GridReduceQueryExecutor {
}
/**
+ * Returns true if the exception is triggered by query cancel.
+ *
+ * @param e Exception.
+ * @return {@code true} if exception is caused by cancel.
+ */
+ private boolean wasCancelled(CacheException e) {
+ return e.getSuppressed() != null && e.getSuppressed().length > 0 &&
+ e.getSuppressed()[0] instanceof QueryCancelledException;
+ }
+
+ /**
+ * Explicitly cancels remote queries.
+ * @param nodes Nodes.
+ * @param r Query run.
+ * @param qryReqId Query id.
+ */
+ private void cancelRemoteQueriesIfNeeded(Collection<ClusterNode> nodes, QueryRun r, long qryReqId) {
+ for (GridMergeIndex idx : r.idxs) {
+ if (!idx.fetchedAll()) {
+ send(nodes, new GridQueryCancelRequest(qryReqId), null);
+
+ break;
+ }
+ }
+ }
+
+ /**
* @param r Query run.
* @param nodes Nodes to check periodically if they alive.
* @throws IgniteInterruptedCheckedException If interrupted.
@@ -986,7 +1045,7 @@ public class GridReduceQueryExecutor {
List<List<?>> lists = new ArrayList<>();
for (int i = 0, mapQrys = qry.mapQueries().size(); i < mapQrys; i++) {
- ResultSet rs = h2.executeSqlQueryWithTimer(space, c, "SELECT PLAN FROM " + table(i), null, false);
+ ResultSet rs = h2.executeSqlQueryWithTimer(space, c, "SELECT PLAN FROM " + table(i), null, false, 0, null);
lists.add(F.asList(getPlan(rs)));
}
@@ -1005,7 +1064,9 @@ public class GridReduceQueryExecutor {
c,
"EXPLAIN " + rdc.query(),
F.asList(rdc.parameters()),
- false);
+ false,
+ 0,
+ null);
lists.add(F.asList(getPlan(rs)));
@@ -1240,4 +1301,4 @@ public class GridReduceQueryExecutor {
return res;
}
}
-}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/80abd1b7/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryCancelSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryCancelSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryCancelSelfTest.java
new file mode 100644
index 0000000..3fec966
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryCancelSelfTest.java
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.near;
+
+import java.util.Arrays;
+import java.util.List;
+import javax.cache.CacheException;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.cache.query.QueryCancelledException;
+import org.apache.ignite.cache.query.QueryCursor;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+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.util.typedef.G;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ * Tests distributed SQL query cancel related scenarios.
+ */
+public class IgniteCacheDistributedQueryCancelSelfTest extends GridCommonAbstractTest {
+ /** Grids count. */
+ private static final int GRIDS_COUNT = 3;
+
+ /** IP finder. */
+ private static final TcpDiscoveryVmIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** Cache size. */
+ public static final int CACHE_SIZE = 10_000;
+
+ /** Value size. */
+ public static final int VAL_SIZE = 16;
+
+ /** */
+ private static final String QUERY = "select a._val, b._val from String a, String b";
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ super.beforeTest();
+
+ startGridsMultiThreaded(GRIDS_COUNT);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+ TcpDiscoverySpi spi = (TcpDiscoverySpi)cfg.getDiscoverySpi();
+ spi.setIpFinder(IP_FINDER);
+
+ CacheConfiguration<Integer, String> ccfg = new CacheConfiguration<>();
+ ccfg.setIndexedTypes(Integer.class, String.class);
+
+ cfg.setCacheConfiguration(ccfg);
+
+ if ("client".equals(gridName))
+ cfg.setClientMode(true);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ super.afterTest();
+
+ stopAllGrids();
+ }
+
+ /** */
+ public void testQueryCancelsOnGridShutdown() throws Exception {
+ try (Ignite client = startGrid("client")) {
+
+ IgniteCache<Object, Object> cache = client.cache(null);
+
+ assertEquals(0, cache.localSize());
+
+ int p = 1;
+ for (int i = 1; i <= CACHE_SIZE; i++) {
+ char[] tmp = new char[VAL_SIZE];
+ Arrays.fill(tmp, ' ');
+ cache.put(i, new String(tmp));
+
+ if (i / (float)CACHE_SIZE >= p / 10f) {
+ log().info("Loaded " + i + " of " + CACHE_SIZE);
+
+ p++;
+ }
+ }
+
+ SqlFieldsQuery qry = new SqlFieldsQuery(QUERY);
+
+ IgniteInternalFuture<?> fut = multithreadedAsync(new Runnable() {
+ @Override public void run() {
+ try {
+ Thread.sleep(1_500);
+ }
+ catch (InterruptedException e) {
+ throw new IgniteException(e);
+ }
+
+ for (Ignite g : G.allGrids())
+ if (!g.configuration().getDiscoverySpi().isClientMode())
+ stopGrid(g.name(), true);
+ }
+ }, 1);
+
+ try {
+ final QueryCursor<List<?>> cursor = cache.query(qry);
+
+ cursor.iterator();
+ }
+ catch (CacheException ignored) {
+ // No-op.
+ }
+
+ fut.get();
+
+ // Test must exit gracefully.
+ }
+ }
+
+ /** */
+ public void testQueryResponseFailCode() throws Exception {
+ try (Ignite client = startGrid("client")) {
+
+ CacheConfiguration<Integer, Integer> cfg = new CacheConfiguration<>();
+ cfg.setSqlFunctionClasses(Functions.class);
+ cfg.setIndexedTypes(Integer.class, Integer.class);
+ cfg.setName("test");
+
+ IgniteCache<Integer, Integer> cache = client.getOrCreateCache(cfg);
+
+ cache.put(1, 1);
+
+ QueryCursor<List<?>> qry = cache.query(new SqlFieldsQuery("select fail() from Integer"));
+
+ try {
+ qry.getAll();
+
+ fail();
+ }
+ catch (Exception e) {
+ assertTrue(e.getCause() instanceof CacheException);
+ }
+ }
+ }
+
+ /** */
+ public static class Functions {
+ /** */
+ @QuerySqlFunction
+ public static int fail() {
+ throw new IllegalArgumentException();
+ }
+ }
+}
\ No newline at end of file
[13/20] ignite git commit: IGNITE-2355 Fixed the test
HadoopClientProtocolMultipleServersSelfTest. Clear connection poll after the
test, cosmetic.
Posted by sb...@apache.org.
IGNITE-2355 Fixed the test HadoopClientProtocolMultipleServersSelfTest. Clear connection poll after the test, cosmetic.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/66c76d1f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/66c76d1f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/66c76d1f
Branch: refs/heads/ignite-4111
Commit: 66c76d1f30f024b58db8cab07ba9e7d429f596f8
Parents: 7290d88
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Tue Oct 18 20:45:06 2016 +0500
Committer: tledkov-gridgain <tl...@gridgain.com>
Committed: Tue Oct 18 20:45:06 2016 +0500
----------------------------------------------------------------------
...opClientProtocolMultipleServersSelfTest.java | 99 +++++++++-----------
1 file changed, 44 insertions(+), 55 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/66c76d1f/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java
index 0e51938..51b6164 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java
@@ -23,8 +23,8 @@ import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.concurrent.Callable;
+import java.util.concurrent.ConcurrentHashMap;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
@@ -44,6 +44,8 @@ import org.apache.ignite.IgniteFileSystem;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.hadoop.mapreduce.IgniteHadoopClientProtocolProvider;
import org.apache.ignite.igfs.IgfsPath;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.client.GridClient;
import org.apache.ignite.internal.client.GridServerUnreachableException;
import org.apache.ignite.internal.processors.hadoop.impl.HadoopAbstractSelfTest;
import org.apache.ignite.internal.processors.hadoop.impl.HadoopUtils;
@@ -79,6 +81,14 @@ public class HadoopClientProtocolMultipleServersSelfTest extends HadoopAbstractS
@Override protected void afterTest() throws Exception {
stopAllGrids();
+ ConcurrentHashMap<String, IgniteInternalFuture<GridClient>> cliMap =
+ GridTestUtils.getFieldValue(IgniteHadoopClientProtocolProvider.class, "cliMap");
+
+ for(IgniteInternalFuture<GridClient> fut : cliMap.values())
+ fut.get().close();
+
+ cliMap.clear();
+
super.afterTest();
}
@@ -114,7 +124,7 @@ public class HadoopClientProtocolMultipleServersSelfTest extends HadoopAbstractS
* @param conf Hadoop configuration.
* @throws Exception If failed.
*/
- public void checkJobSubmit(Configuration conf) throws Exception {
+ private void checkJobSubmit(Configuration conf) throws Exception {
final Job job = Job.getInstance(conf);
job.setJobName(JOB_NAME);
@@ -144,22 +154,15 @@ public class HadoopClientProtocolMultipleServersSelfTest extends HadoopAbstractS
*/
@SuppressWarnings("ConstantConditions")
public void testMultipleAddresses() throws Exception {
- try {
- restPort = REST_PORT;
+ restPort = REST_PORT;
- startGrids(gridCount());
+ startGrids(gridCount());
- beforeJob();
+ beforeJob();
- U.sleep(5000);
+ U.sleep(5000);
- checkJobSubmit(configMultipleAddrs(gridCount()));
- }
- finally {
- FileSystem fs = FileSystem.get(configMultipleAddrs(gridCount()));
-
- fs.close();
- }
+ checkJobSubmit(configMultipleAddrs(gridCount()));
}
/**
@@ -167,25 +170,18 @@ public class HadoopClientProtocolMultipleServersSelfTest extends HadoopAbstractS
*/
@SuppressWarnings({"ConstantConditions", "ThrowableResultOfMethodCallIgnored"})
public void testSingleAddress() throws Exception {
- try {
- // Don't use REST_PORT to test connection fails if the only this port is configured
- restPort = REST_PORT + 1;
-
- startGrids(gridCount());
-
- GridTestUtils.assertThrowsAnyCause(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- checkJobSubmit(configSingleAddress());
- return null;
- }
- },
- GridServerUnreachableException.class, "Failed to connect to any of the servers in list");
- }
- finally {
- FileSystem fs = FileSystem.get(configSingleAddress());
-
- fs.close();
- }
+ // Don't use REST_PORT to test connection fails if the only this port is configured
+ restPort = REST_PORT + 1;
+
+ startGrids(gridCount());
+
+ GridTestUtils.assertThrowsAnyCause(log, new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ checkJobSubmit(configSingleAddress());
+ return null;
+ }
+ },
+ GridServerUnreachableException.class, "Failed to connect to any of the servers in list");
}
/**
@@ -193,28 +189,21 @@ public class HadoopClientProtocolMultipleServersSelfTest extends HadoopAbstractS
*/
@SuppressWarnings("ConstantConditions")
public void testMixedAddrs() throws Exception {
- try {
- restPort = REST_PORT;
+ restPort = REST_PORT;
- startGrids(gridCount());
+ startGrids(gridCount());
- beforeJob();
+ beforeJob();
- stopGrid(1);
+ stopGrid(1);
- U.sleep(5000);
+ U.sleep(5000);
- checkJobSubmit(configMixed());
+ checkJobSubmit(configMixed());
- startGrid(1);
+ startGrid(1);
- awaitPartitionMapExchange();
- }
- finally {
- FileSystem fs = FileSystem.get(configMixed());
-
- fs.close();
- }
+ awaitPartitionMapExchange();
}
/**
@@ -234,19 +223,19 @@ public class HadoopClientProtocolMultipleServersSelfTest extends HadoopAbstractS
}
/**
- * @param serversCnt Count ov servers.
+ * @param srvsCnt Count ov servers.
* @return Configuration.
*/
- private Configuration configMultipleAddrs(int serversCnt) {
+ private Configuration configMultipleAddrs(int srvsCnt) {
Configuration conf = HadoopUtils.safeCreateConfiguration();
setupFileSystems(conf);
conf.set(MRConfig.FRAMEWORK_NAME, IgniteHadoopClientProtocolProvider.FRAMEWORK_NAME);
- Collection<String> addrs = new ArrayList<>(serversCnt);
+ Collection<String> addrs = new ArrayList<>(srvsCnt);
- for (int i = 0; i < serversCnt; ++i)
+ for (int i = 0; i < srvsCnt; ++i)
addrs.add("127.0.0.1:" + Integer.toString(REST_PORT + i));
conf.set(MRConfig.MASTER_ADDRESS, F.concat(addrs, ","));
@@ -305,18 +294,18 @@ public class HadoopClientProtocolMultipleServersSelfTest extends HadoopAbstractS
*/
public static class OutFormat extends OutputFormat {
/** {@inheritDoc} */
- @Override public RecordWriter getRecordWriter(TaskAttemptContext context) throws IOException,
+ @Override public RecordWriter getRecordWriter(TaskAttemptContext ctx) throws IOException,
InterruptedException {
return null;
}
/** {@inheritDoc} */
- @Override public void checkOutputSpecs(JobContext context) throws IOException, InterruptedException {
+ @Override public void checkOutputSpecs(JobContext ctx) throws IOException, InterruptedException {
// No-op.
}
/** {@inheritDoc} */
- @Override public OutputCommitter getOutputCommitter(TaskAttemptContext context) throws IOException,
+ @Override public OutputCommitter getOutputCommitter(TaskAttemptContext ctx) throws IOException,
InterruptedException {
return null;
}
[15/20] ignite git commit: IGNITE-3448 Support SQL queries with
distinct aggregates added. This closes #3448.
Posted by sb...@apache.org.
IGNITE-3448 Support SQL queries with distinct aggregates added. This closes #3448.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7ed2bb7e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7ed2bb7e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7ed2bb7e
Branch: refs/heads/ignite-4111
Commit: 7ed2bb7e341701d052220a36a2b2f8f0a46fd644
Parents: f37fbca
Author: AMRepo <an...@gmail.com>
Authored: Wed Oct 19 18:33:59 2016 +0300
Committer: AMRepo <an...@gmail.com>
Committed: Wed Oct 19 21:20:28 2016 +0300
----------------------------------------------------------------------
.../query/h2/sql/GridSqlQuerySplitter.java | 146 +++++---
.../query/IgniteSqlSplitterSelfTest.java | 339 +++++++++++++++++++
2 files changed, 447 insertions(+), 38 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ed2bb7e/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 4d34ce8..62c54bd 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
@@ -33,6 +33,8 @@ import org.jetbrains.annotations.Nullable;
import static org.apache.ignite.internal.processors.query.h2.sql.GridSqlFunctionType.AVG;
import static org.apache.ignite.internal.processors.query.h2.sql.GridSqlFunctionType.CAST;
import static org.apache.ignite.internal.processors.query.h2.sql.GridSqlFunctionType.COUNT;
+import static org.apache.ignite.internal.processors.query.h2.sql.GridSqlFunctionType.MAX;
+import static org.apache.ignite.internal.processors.query.h2.sql.GridSqlFunctionType.MIN;
import static org.apache.ignite.internal.processors.query.h2.sql.GridSqlFunctionType.SUM;
import static org.apache.ignite.internal.processors.query.h2.sql.GridSqlPlaceholder.EMPTY;
@@ -140,7 +142,8 @@ public class GridSqlQuerySplitter {
* @param igniteH2Indexing Indexing implementation.
* @return Two step query.
*/
- public static GridCacheTwoStepQuery split(JdbcPreparedStatement stmt, Object[] params, boolean collocated, IgniteH2Indexing igniteH2Indexing) {
+ public static GridCacheTwoStepQuery split(JdbcPreparedStatement stmt, Object[] params, boolean collocated,
+ IgniteH2Indexing igniteH2Indexing) {
if (params == null)
params = GridCacheSqlQuery.EMPTY_PARAMS;
@@ -169,10 +172,18 @@ public class GridSqlQuerySplitter {
Set<String> colNames = new HashSet<>();
- boolean aggregateFound = false;
+ boolean distinctAggregateFound = false;
+
+ if (!collocated) {
+ for (int i = 0, len = mapExps.size(); i < len; i++)
+ distinctAggregateFound |= hasDistinctAggregates(mapExps.get(i));
+ }
+
+ boolean aggregateFound = distinctAggregateFound;
for (int i = 0, len = mapExps.size(); i < len; i++) // Remember len because mapExps list can grow.
- aggregateFound |= splitSelectExpression(mapExps, rdcExps, colNames, i, collocated, i == havingCol);
+ aggregateFound |= splitSelectExpression(mapExps, rdcExps, colNames, i, collocated, i == havingCol,
+ distinctAggregateFound);
// Fill select expressions.
mapQry.clearColumns();
@@ -190,9 +201,14 @@ public class GridSqlQuerySplitter {
rdcQry.addColumn(column(((GridSqlAlias)mapExps.get(i)).alias()), false);
// -- GROUP BY
- if (mapQry.groupColumns() != null && !collocated)
+ if (mapQry.groupColumns() != null && !collocated) {
rdcQry.groupColumns(mapQry.groupColumns());
+ // Grouping with distinct aggregates cannot be performed on map phase
+ if (distinctAggregateFound)
+ mapQry.groupColumns(null);
+ }
+
// -- HAVING
if (havingCol >= 0 && !collocated) {
// TODO IGNITE-1140 - Find aggregate functions in HAVING clause or rewrite query to put all aggregates to SELECT clause.
@@ -477,10 +493,11 @@ public class GridSqlQuerySplitter {
* @param idx Index.
* @param collocated If it is a collocated query.
* @param isHaving If it is a HAVING expression.
+ * @param hasDistinctAggregate If query has distinct aggregate expression.
* @return {@code true} If aggregate was found.
*/
private static boolean splitSelectExpression(List<GridSqlElement> mapSelect, List<GridSqlElement> rdcSelect,
- Set<String> colNames, final int idx, boolean collocated, boolean isHaving) {
+ Set<String> colNames, final int idx, boolean collocated, boolean isHaving, boolean hasDistinctAggregate) {
GridSqlElement el = mapSelect.get(idx);
GridSqlAlias alias = null;
@@ -499,7 +516,7 @@ public class GridSqlQuerySplitter {
alias = alias(isHaving ? HAVING_COLUMN : columnName(idx), el);
// We can update original alias here as well since it will be dropped from mapSelect.
- splitAggregates(alias, 0, mapSelect, idx, true);
+ splitAggregates(alias, 0, mapSelect, idx, hasDistinctAggregate, true);
set(rdcSelect, idx, alias);
}
@@ -554,10 +571,33 @@ public class GridSqlQuerySplitter {
}
/**
+ * Lookup for distinct aggregates.
+ * Note, DISTINCT make no sense for MIN and MAX aggregates, so its will be ignored.
+ *
+ * @param el Expression.
+ * @return {@code true} If expression contains distinct aggregates.
+ */
+ private static boolean hasDistinctAggregates(GridSqlElement el) {
+ if (el instanceof GridSqlAggregateFunction) {
+ GridSqlFunctionType type = ((GridSqlAggregateFunction)el).type();
+
+ return ((GridSqlAggregateFunction)el).distinct() && type != MIN && type != MAX;
+ }
+
+ for (GridSqlElement child : el) {
+ if (hasDistinctAggregates(child))
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
* @param parentExpr Parent expression.
* @param childIdx Child index to try to split.
* @param mapSelect List of expressions in map SELECT clause.
* @param exprIdx Index of the original expression in map SELECT clause.
+ * @param hasDistinctAggregate If query has distinct aggregate expression.
* @param first If the first aggregate is already found in this expression.
* @return {@code true} If the first aggregate is already found.
*/
@@ -566,17 +606,18 @@ public class GridSqlQuerySplitter {
final int childIdx,
final List<GridSqlElement> mapSelect,
final int exprIdx,
+ boolean hasDistinctAggregate,
boolean first) {
GridSqlElement el = parentExpr.child(childIdx);
if (el instanceof GridSqlAggregateFunction) {
- splitAggregate(parentExpr, childIdx, mapSelect, exprIdx, first);
+ splitAggregate(parentExpr, childIdx, mapSelect, exprIdx, hasDistinctAggregate, first);
return true;
}
for (int i = 0; i < el.size(); i++) {
- if (splitAggregates(el, i, mapSelect, exprIdx, first))
+ if (splitAggregates(el, i, mapSelect, exprIdx, hasDistinctAggregate, first))
first = false;
}
@@ -588,6 +629,7 @@ public class GridSqlQuerySplitter {
* @param aggIdx Index of the aggregate to split in this expression.
* @param mapSelect List of expressions in map SELECT clause.
* @param exprIdx Index of the original expression in map SELECT clause.
+ * @param hasDistinctAggregate If query has distinct aggregate expression.
* @param first If this is the first aggregate found in this expression.
*/
private static void splitAggregate(
@@ -595,6 +637,7 @@ public class GridSqlQuerySplitter {
int aggIdx,
List<GridSqlElement> mapSelect,
int exprIdx,
+ boolean hasDistinctAggregate,
boolean first
) {
GridSqlAggregateFunction agg = parentExpr.child(aggIdx);
@@ -612,53 +655,80 @@ public class GridSqlQuerySplitter {
else
mapSelect.add(mapAggAlias);
+ /* Note Distinct aggregate can be performed only on reduce phase, so
+ if query contains distinct aggregate then other aggregates must be processed the same way. */
switch (agg.type()) {
- case AVG: // SUM( AVG(CAST(x AS DOUBLE))*COUNT(x) )/SUM( COUNT(x) ).
- //-- COUNT(x) map
- GridSqlElement cntMapAgg = aggregate(agg.distinct(), COUNT)
- .resultType(GridSqlType.BIGINT).addChild(agg.child());
+ case AVG: // SUM( AVG(CAST(x AS DOUBLE))*COUNT(x) )/SUM( COUNT(x) ) or AVG(CAST( x AS DOUBLE))
+ if (hasDistinctAggregate) /* and has no collocated group by */ {
+ mapAgg = agg.child();
+
+ rdcAgg = aggregate(agg.distinct(), agg.type()).resultType(GridSqlType.DOUBLE)
+ .addChild(function(CAST).resultType(GridSqlType.DOUBLE).addChild(column(mapAggAlias.alias())));
+ }
+ else {
+ //-- COUNT(x) map
+ GridSqlElement cntMapAgg = aggregate(agg.distinct(), COUNT)
+ .resultType(GridSqlType.BIGINT).addChild(agg.child());
- // Add generated alias to COUNT(x).
- // Using size as index since COUNT will be added as the last select element to the map query.
- String cntMapAggAlias = columnName(mapSelect.size());
+ // Add generated alias to COUNT(x).
+ // Using size as index since COUNT will be added as the last select element to the map query.
+ String cntMapAggAlias = columnName(mapSelect.size());
- cntMapAgg = alias(cntMapAggAlias, cntMapAgg);
+ cntMapAgg = alias(cntMapAggAlias, cntMapAgg);
- mapSelect.add(cntMapAgg);
+ mapSelect.add(cntMapAgg);
- //-- AVG(CAST(x AS DOUBLE)) map
- mapAgg = aggregate(agg.distinct(), AVG).resultType(GridSqlType.DOUBLE).addChild(
- function(CAST).resultType(GridSqlType.DOUBLE).addChild(agg.child()));
+ //-- AVG(CAST(x AS DOUBLE)) map
+ mapAgg = aggregate(agg.distinct(), AVG).resultType(GridSqlType.DOUBLE).addChild(
+ function(CAST).resultType(GridSqlType.DOUBLE).addChild(agg.child()));
- //-- SUM( AVG(x)*COUNT(x) )/SUM( COUNT(x) ) reduce
- GridSqlElement sumUpRdc = aggregate(false, SUM).addChild(
- op(GridSqlOperationType.MULTIPLY,
- column(mapAggAlias.alias()),
- column(cntMapAggAlias)));
+ //-- SUM( AVG(x)*COUNT(x) )/SUM( COUNT(x) ) reduce
+ GridSqlElement sumUpRdc = aggregate(false, SUM).addChild(
+ op(GridSqlOperationType.MULTIPLY,
+ column(mapAggAlias.alias()),
+ column(cntMapAggAlias)));
- GridSqlElement sumDownRdc = aggregate(false, SUM).addChild(column(cntMapAggAlias));
+ GridSqlElement sumDownRdc = aggregate(false, SUM).addChild(column(cntMapAggAlias));
- rdcAgg = op(GridSqlOperationType.DIVIDE, sumUpRdc, sumDownRdc);
+ rdcAgg = op(GridSqlOperationType.DIVIDE, sumUpRdc, sumDownRdc);
+ }
break;
- case SUM: // SUM( SUM(x) )
- case MAX: // MAX( MAX(x) )
- case MIN: // MIN( MIN(x) )
- mapAgg = aggregate(agg.distinct(), agg.type()).resultType(agg.resultType()).addChild(agg.child());
- rdcAgg = aggregate(agg.distinct(), agg.type()).addChild(column(mapAggAlias.alias()));
+ case SUM: // SUM( SUM(x) ) or SUM(DISTINCT x)
+ case MAX: // MAX( MAX(x) ) or MAX(DISTINCT x)
+ case MIN: // MIN( MIN(x) ) or MIN(DISTINCT x)
+ if (hasDistinctAggregate) /* and has no collocated group by */ {
+ mapAgg = agg.child();
+
+ rdcAgg = aggregate(agg.distinct(), agg.type()).addChild(column(mapAggAlias.alias()));
+ }
+ else {
+ mapAgg = aggregate(agg.distinct(), agg.type()).resultType(agg.resultType()).addChild(agg.child());
+ rdcAgg = aggregate(agg.distinct(), agg.type()).addChild(column(mapAggAlias.alias()));
+ }
break;
case COUNT_ALL: // CAST(SUM( COUNT(*) ) AS BIGINT)
- case COUNT: // CAST(SUM( COUNT(x) ) AS BIGINT)
- mapAgg = aggregate(agg.distinct(), agg.type()).resultType(GridSqlType.BIGINT);
+ case COUNT: // CAST(SUM( COUNT(x) ) AS BIGINT) or CAST(COUNT(DISTINCT x) AS BIGINT)
+ if (hasDistinctAggregate) /* and has no collocated group by */ {
+ assert agg.type() == COUNT;
- if (agg.type() == COUNT)
- mapAgg.addChild(agg.child());
+ mapAgg = agg.child();
- rdcAgg = aggregate(false, SUM).addChild(column(mapAggAlias.alias()));
- rdcAgg = function(CAST).resultType(GridSqlType.BIGINT).addChild(rdcAgg);
+ rdcAgg = aggregate(agg.distinct(), agg.type()).resultType(GridSqlType.BIGINT)
+ .addChild(column(mapAggAlias.alias()));
+ }
+ else {
+ mapAgg = aggregate(agg.distinct(), agg.type()).resultType(GridSqlType.BIGINT);
+
+ if (agg.type() == COUNT)
+ mapAgg.addChild(agg.child());
+
+ rdcAgg = aggregate(false, SUM).addChild(column(mapAggAlias.alias()));
+ rdcAgg = function(CAST).resultType(GridSqlType.BIGINT).addChild(rdcAgg);
+ }
break;
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ed2bb7e/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
index 64be936..56658df 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
@@ -25,11 +25,15 @@ import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.atomic.AtomicLong;
+import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cache.query.QueryCursor;
import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
+import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.util.GridRandom;
@@ -98,6 +102,8 @@ public class IgniteSqlSplitterSelfTest extends GridCommonAbstractTest {
Integer.class, Integer.class));
try {
+ awaitPartitionMapExchange();
+
List<Integer> res = new ArrayList<>();
Random rnd = new GridRandom();
@@ -340,6 +346,328 @@ public class IgniteSqlSplitterSelfTest extends GridCommonAbstractTest {
}
}
+ /** @throws Exception if failed. */
+ public void testDistributedAggregates() throws Exception {
+ final String cacheName = "ints";
+
+ IgniteCache<Integer, Value> cache = ignite(0).getOrCreateCache(cacheConfig(cacheName, true,
+ Integer.class, Value.class));
+
+ AffinityKeyGenerator node0KeyGen = new AffinityKeyGenerator(ignite(0), cacheName);
+ AffinityKeyGenerator node1KeyGen = new AffinityKeyGenerator(ignite(1), cacheName);
+ AffinityKeyGenerator node2KeyGen = new AffinityKeyGenerator(ignite(2), cacheName);
+
+ try {
+ awaitPartitionMapExchange();
+
+ cache.put(node0KeyGen.next(), new Value(1, 3));
+ cache.put(node1KeyGen.next(), new Value(1, 3));
+ cache.put(node2KeyGen.next(), new Value(1, 3));
+
+ cache.put(node0KeyGen.next(), new Value(2, 1));
+ cache.put(node1KeyGen.next(), new Value(2, 2));
+ cache.put(node2KeyGen.next(), new Value(2, 3));
+
+ cache.put(node0KeyGen.next(), new Value(3, 1));
+ cache.put(node0KeyGen.next(), new Value(3, 1));
+ cache.put(node0KeyGen.next(), new Value(3, 2));
+ cache.put(node1KeyGen.next(), new Value(3, 1));
+ cache.put(node1KeyGen.next(), new Value(3, 2));
+ cache.put(node2KeyGen.next(), new Value(3, 2));
+
+ cache.put(node0KeyGen.next(), new Value(4, 2));
+ cache.put(node1KeyGen.next(), new Value(5, 2));
+ cache.put(node2KeyGen.next(), new Value(6, 2));
+
+ checkSimpleQueryWithAggr(cache);
+ checkSimpleQueryWithDistinctAggr(cache);
+
+ checkQueryWithGroupsAndAggrs(cache);
+ checkQueryWithGroupsAndDistinctAggr(cache);
+
+ checkSimpleQueryWithAggrMixed(cache);
+ checkQueryWithGroupsAndAggrMixed(cache);
+ }
+ finally {
+ cache.destroy();
+ }
+ }
+
+ /** @throws Exception if failed. */
+ public void testCollocatedAggregates() throws Exception {
+ final String cacheName = "ints";
+
+ IgniteCache<Integer, Value> cache = ignite(0).getOrCreateCache(cacheConfig(cacheName, true,
+ Integer.class, Value.class));
+
+ AffinityKeyGenerator node0KeyGen = new AffinityKeyGenerator(ignite(0), cacheName);
+ AffinityKeyGenerator node1KeyGen = new AffinityKeyGenerator(ignite(1), cacheName);
+ AffinityKeyGenerator node2KeyGen = new AffinityKeyGenerator(ignite(2), cacheName);
+
+ try {
+ awaitPartitionMapExchange();
+
+ cache.put(node0KeyGen.next(), new Value(1, 3));
+ cache.put(node0KeyGen.next(), new Value(1, 3));
+ cache.put(node0KeyGen.next(), new Value(1, 3));
+
+ cache.put(node1KeyGen.next(), new Value(2, 1));
+ cache.put(node1KeyGen.next(), new Value(2, 2));
+ cache.put(node1KeyGen.next(), new Value(2, 3));
+
+ cache.put(node2KeyGen.next(), new Value(3, 1));
+ cache.put(node2KeyGen.next(), new Value(3, 1));
+ cache.put(node2KeyGen.next(), new Value(3, 2));
+ cache.put(node2KeyGen.next(), new Value(3, 1));
+ cache.put(node2KeyGen.next(), new Value(3, 2));
+ cache.put(node2KeyGen.next(), new Value(3, 2));
+
+ cache.put(node0KeyGen.next(), new Value(4, 2));
+ cache.put(node1KeyGen.next(), new Value(5, 2));
+ cache.put(node2KeyGen.next(), new Value(6, 2));
+
+ checkQueryWithGroupsAndAggrs(cache);
+ checkQueryWithGroupsAndDistinctAggr(cache);
+ checkQueryWithGroupsAndAggrMixed(cache);
+ }
+ finally {
+ cache.destroy();
+ }
+ }
+
+ /** Simple query with aggregates */
+ private void checkSimpleQueryWithAggr(IgniteCache<Integer, Value> cache) {
+ try (QueryCursor<List<?>> qry = cache.query(new SqlFieldsQuery(
+ "SELECT count(fst), sum(snd), avg(snd), min(snd), max(snd) FROM Value"))) {
+ List<List<?>> result = qry.getAll();
+
+ assertEquals(1, result.size());
+
+ List<?> row = result.get(0);
+
+ assertEquals("count", 15L, ((Number)row.get(0)).longValue());
+ assertEquals("sum", 30L, ((Number)row.get(1)).longValue());
+ assertEquals("avg", 2.0d, ((Number)row.get(2)).doubleValue(), 0.001);
+ assertEquals("min", 1, ((Integer)row.get(3)).intValue());
+ assertEquals("max", 3, ((Integer)row.get(4)).intValue());
+ }
+ }
+
+ /** Simple query with distinct aggregates */
+ private void checkSimpleQueryWithDistinctAggr(IgniteCache<Integer, Value> cache) {
+ try (QueryCursor<List<?>> qry = cache.query(new SqlFieldsQuery(
+ "SELECT count(distinct fst), sum(distinct snd), avg(distinct snd), min(distinct snd), max(distinct snd) " +
+ "FROM Value"))) {
+ List<List<?>> result = qry.getAll();
+
+ assertEquals(1, result.size());
+
+ List<?> row = result.get(0);
+
+ assertEquals("count distinct", 6L, ((Number)row.get(0)).longValue());
+ assertEquals("sum distinct", 6L, ((Number)row.get(1)).longValue());
+ assertEquals("avg distinct", 2.0d, ((Number)row.get(2)).doubleValue(), 0.001);
+ assertEquals("min distinct", 1, ((Integer)row.get(3)).intValue());
+ assertEquals("max distinct", 3, ((Integer)row.get(4)).intValue());
+ }
+ }
+
+ /** Simple query with distinct aggregates */
+ private void checkSimpleQueryWithAggrMixed(IgniteCache<Integer, Value> cache) {
+ try (QueryCursor<List<?>> qry = cache.query(new SqlFieldsQuery(
+ "SELECT count(fst), sum(snd), avg(snd), min(snd), max(snd)," +
+ "count(distinct fst), sum(distinct snd), avg(distinct snd), min(distinct snd), max(distinct snd) " +
+ "FROM Value"))) {
+ List<List<?>> result = qry.getAll();
+
+ assertEquals(1, result.size());
+
+ List<?> row = result.get(0);
+
+ assertEquals("count", 15L, ((Number)row.get(0)).longValue());
+ assertEquals("sum", 30L, ((Number)row.get(1)).longValue());
+ assertEquals("avg", 2.0d, ((Number)row.get(2)).doubleValue(), 0.001);
+ assertEquals("min", 1, ((Integer)row.get(3)).intValue());
+ assertEquals("max", 3, ((Integer)row.get(4)).intValue());
+ assertEquals("count distinct", 6L, ((Number)row.get(5)).longValue());
+ assertEquals("sum distinct", 6L, ((Number)row.get(6)).longValue());
+ assertEquals("avg distinct", 2.0d, ((Number)row.get(7)).doubleValue(), 0.001);
+ assertEquals("min distinct", 1, ((Integer)row.get(8)).intValue());
+ assertEquals("max distinct", 3, ((Integer)row.get(9)).intValue());
+ }
+ }
+
+ /** Query with aggregates and groups */
+ private void checkQueryWithGroupsAndAggrs(IgniteCache<Integer, Value> cache) {
+ try (QueryCursor<List<?>> qry = cache.query(new SqlFieldsQuery(
+ "SELECT fst, count(snd), sum(snd), avg(snd), min(snd), max(snd) FROM Value GROUP BY fst ORDER BY fst"))) {
+ List<List<?>> result = qry.getAll();
+
+ assertEquals(6, result.size());
+
+ List<?> row = result.get(0);
+ assertEquals("fst", 1, ((Number)row.get(0)).intValue());
+ assertEquals("count", 3L, ((Number)row.get(1)).longValue());
+ assertEquals("sum", 9L, ((Number)row.get(2)).longValue());
+ assertEquals("avg", 3.0d, ((Number)row.get(3)).doubleValue(), 0.001);
+ assertEquals("min", 3, ((Integer)row.get(4)).intValue());
+ assertEquals("max", 3, ((Integer)row.get(5)).intValue());
+
+ row = result.get(1);
+ assertEquals("fst", 2, ((Number)row.get(0)).intValue());
+ assertEquals("count", 3L, ((Number)row.get(1)).longValue());
+ assertEquals("sum", 6L, ((Number)row.get(2)).longValue());
+ assertEquals("avg", 2.0d, ((Number)row.get(3)).doubleValue(), 0.001);
+ assertEquals("min", 1, ((Integer)row.get(4)).intValue());
+ assertEquals("max", 3, ((Integer)row.get(5)).intValue());
+
+ row = result.get(2);
+ assertEquals("fst", 3, ((Number)row.get(0)).intValue());
+ assertEquals("count", 6L, ((Number)row.get(1)).longValue());
+ assertEquals("sum", 9L, ((Number)row.get(2)).longValue());
+ assertEquals("avg", 1.5d, ((Number)row.get(3)).doubleValue(), 0.001);
+ assertEquals("min", 1, ((Integer)row.get(4)).intValue());
+ assertEquals("max", 2, ((Integer)row.get(5)).intValue());
+ }
+ }
+
+ /** Query with distinct aggregates and groups */
+ private void checkQueryWithGroupsAndDistinctAggr(IgniteCache<Integer, Value> cache) {
+ try (QueryCursor<List<?>> qry = cache.query(new SqlFieldsQuery(
+ "SELECT count(distinct snd), sum(distinct snd), avg(distinct snd), min(distinct snd), max(distinct snd) " +
+ "FROM Value GROUP BY fst"))) {
+ List<List<?>> result = qry.getAll();
+
+ assertEquals(6, result.size());
+
+ List<?> row = result.get(0);
+ assertEquals("count distinct", 1L, ((Number)row.get(0)).longValue());
+ assertEquals("sum distinct", 3L, ((Number)row.get(1)).longValue());
+ assertEquals("avg distinct", 3.0d, ((Number)row.get(2)).doubleValue(), 0.001);
+ assertEquals("min distinct", 3, ((Integer)row.get(3)).intValue());
+ assertEquals("max distinct", 3, ((Integer)row.get(4)).intValue());
+
+ row = result.get(1);
+ assertEquals("count distinct", 3L, ((Number)row.get(0)).longValue());
+ assertEquals("sum distinct", 6L, ((Number)row.get(1)).longValue());
+ assertEquals("avg distinct", 2.0d, ((Number)row.get(2)).doubleValue(), 0.001);
+ assertEquals("min distinct", 1, ((Integer)row.get(3)).intValue());
+ assertEquals("max distinct", 3, ((Integer)row.get(4)).intValue());
+
+ row = result.get(2);
+ assertEquals("count distinct", 2L, ((Number)row.get(0)).longValue());
+ assertEquals("sum distinct", 3L, ((Number)row.get(1)).longValue());
+ assertEquals("avg distinct", 1.5d, ((Number)row.get(2)).doubleValue(), 0.001);
+ assertEquals("min distinct", 1, ((Integer)row.get(3)).intValue());
+ assertEquals("max distinct", 2, ((Integer)row.get(4)).intValue());
+ }
+ }
+
+ /** Query with distinct aggregates and groups */
+ private void checkQueryWithGroupsAndAggrMixed(IgniteCache<Integer, Value> cache) {
+ try (QueryCursor<List<?>> qry = cache.query(new SqlFieldsQuery(
+ "SELECT fst, count(snd), sum(snd), avg(snd), min(snd), max(snd)," +
+ "count(distinct snd), sum(distinct snd), avg(distinct snd), min(distinct snd), max(distinct snd) " +
+ "FROM Value GROUP BY fst"))) {
+ List<List<?>> result = qry.getAll();
+
+ assertEquals(6, result.size());
+
+ List<?> row = result.get(0);
+ assertEquals("fst", 1, ((Number)row.get(0)).intValue());
+ assertEquals("count", 3L, ((Number)row.get(1)).longValue());
+ assertEquals("sum", 9L, ((Number)row.get(2)).longValue());
+ assertEquals("avg", 3.0d, ((Number)row.get(3)).doubleValue(), 0.001);
+ assertEquals("min", 3, ((Integer)row.get(4)).intValue());
+ assertEquals("max", 3, ((Integer)row.get(5)).intValue());
+ assertEquals("count distinct", 1L, ((Number)row.get(6)).longValue());
+ assertEquals("sum distinct", 3L, ((Number)row.get(7)).longValue());
+ assertEquals("avg distinct", 3.0d, ((Number)row.get(8)).doubleValue(), 0.001);
+ assertEquals("min distinct", 3, ((Integer)row.get(9)).intValue());
+ assertEquals("max distinct", 3, ((Integer)row.get(10)).intValue());
+
+ row = result.get(1);
+ assertEquals("fst", 2, ((Number)row.get(0)).intValue());
+ assertEquals("count", 3L, ((Number)row.get(1)).longValue());
+ assertEquals("sum", 6L, ((Number)row.get(2)).longValue());
+ assertEquals("avg", 2.0d, ((Number)row.get(3)).doubleValue(), 0.001);
+ assertEquals("min", 1, ((Integer)row.get(4)).intValue());
+ assertEquals("max", 3, ((Integer)row.get(5)).intValue());
+ assertEquals("count distinct", 3L, ((Number)row.get(6)).longValue());
+ assertEquals("sum distinct", 6L, ((Number)row.get(7)).longValue());
+ assertEquals("avg distinct", 2.0d, ((Number)row.get(8)).doubleValue(), 0.001);
+ assertEquals("min distinct", 1, ((Integer)row.get(9)).intValue());
+ assertEquals("max distinct", 3, ((Integer)row.get(10)).intValue());
+
+ row = result.get(2);
+ assertEquals("fst", 3, ((Number)row.get(0)).intValue());
+ assertEquals("count", 6L, ((Number)row.get(1)).longValue());
+ assertEquals("sum", 9L, ((Number)row.get(2)).longValue());
+ assertEquals("avg", 1.5d, ((Number)row.get(3)).doubleValue(), 0.001);
+ assertEquals("min", 1, ((Integer)row.get(4)).intValue());
+ assertEquals("max", 2, ((Integer)row.get(5)).intValue());
+ assertEquals("count distinct", 2L, ((Number)row.get(6)).longValue());
+ assertEquals("sum distinct", 3L, ((Number)row.get(7)).longValue());
+ assertEquals("avg distinct", 1.5d, ((Number)row.get(8)).doubleValue(), 0.001);
+ assertEquals("min distinct", 1, ((Integer)row.get(9)).intValue());
+ assertEquals("max distinct", 2, ((Integer)row.get(10)).intValue());
+ }
+ }
+
+ /** */
+ private static class Value {
+ /** */
+ @QuerySqlField
+ private final Integer fst;
+
+ /** */
+ @QuerySqlField
+ private final Integer snd;
+
+ /** Constructor */
+ public Value(Integer fst, Integer snd) {
+ this.fst = fst;
+ this.snd = snd;
+ }
+ }
+
+ /**
+ *
+ */
+ private static class AffinityKeyGenerator {
+ /** */
+ private final Affinity<Integer> affinity;
+
+ /** */
+ private final ClusterNode node;
+
+ /** */
+ private int start = 0;
+
+ /** Constructor */
+ AffinityKeyGenerator(Ignite node, String cacheName) {
+ this.affinity = node.affinity(cacheName);
+ this.node = node.cluster().localNode();
+ }
+
+ /** */
+ public Integer next() {
+ int key = start;
+
+ while (start < Integer.MAX_VALUE) {
+ if (affinity.isPrimary(node, key)) {
+ start = key + 1;
+
+ return key;
+ }
+
+ key++;
+ }
+
+ throw new IllegalStateException("Can't find next key");
+ }
+ }
+
/**
*
*/
@@ -391,9 +719,11 @@ public class IgniteSqlSplitterSelfTest extends GridCommonAbstractTest {
* Test value.
*/
private static class GroupIndexTestValue implements Serializable {
+ /** */
@QuerySqlField(orderedGroups = @QuerySqlField.Group(name = "grpIdx", order = 0))
private int a;
+ /** */
@QuerySqlField(orderedGroups = @QuerySqlField.Group(name = "grpIdx", order = 1))
private int b;
@@ -408,22 +738,31 @@ public class IgniteSqlSplitterSelfTest extends GridCommonAbstractTest {
}
private static class User implements Serializable {
+ /** */
@QuerySqlField
private int id;
}
+ /** */
private static class UserOrder implements Serializable {
+ /** */
@QuerySqlField
private int id;
+ /** */
@QuerySqlField
private int userId;
}
+ /**
+ *
+ */
private static class OrderGood implements Serializable {
+ /** */
@QuerySqlField
private int orderId;
+ /** */
@QuerySqlField
private int goodId;
}
[20/20] ignite git commit: ignite-4111
Posted by sb...@apache.org.
ignite-4111
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d1bc4cb2
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d1bc4cb2
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d1bc4cb2
Branch: refs/heads/ignite-4111
Commit: d1bc4cb2f0329e4696e384320707fec4bf6ddf09
Parents: 9ddb8be
Author: sboikov <sb...@gridgain.com>
Authored: Fri Oct 28 14:47:48 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Oct 28 15:16:55 2016 +0300
----------------------------------------------------------------------
.../GridCachePartitionExchangeManager.java | 10 +-
.../ignite/spi/discovery/tcp/ClientImpl.java | 10 +-
.../ignite/spi/discovery/tcp/ServerImpl.java | 160 +++++++++++++------
.../spi/discovery/tcp/TcpDiscoveryImpl.java | 59 ++++++-
.../messages/TcpDiscoveryAbstractMessage.java | 7 +
.../messages/TcpDiscoveryClientAckResponse.java | 5 +
.../TcpDiscoveryClientHeartbeatMessage.java | 5 +
.../TcpDiscoveryConnectionCheckMessage.java | 5 +
.../messages/TcpDiscoveryHeartbeatMessage.java | 5 +
9 files changed, 207 insertions(+), 59 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d1bc4cb2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
index 4eb61e3..a901e2a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
@@ -718,7 +718,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
/**
* Partition refresh callback.
*/
- void refreshPartitions() {
+ private void refreshPartitions() {
ClusterNode oldest = CU.oldestAliveCacheServerNode(cctx, AffinityTopologyVersion.NONE);
if (oldest == null) {
@@ -735,7 +735,13 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
// If this is the oldest node.
if (oldest.id().equals(cctx.localNodeId())) {
- rmts = CU.remoteNodes(cctx, AffinityTopologyVersion.NONE);
+ GridDhtPartitionsExchangeFuture lastFut = lastInitializedFut;
+
+ // No need to send to nodes which did not finish their first exchange.
+ AffinityTopologyVersion rmtTopVer =
+ lastFut != null ? lastFut.topologyVersion() : AffinityTopologyVersion.NONE;
+
+ rmts = CU.remoteNodes(cctx, rmtTopVer);
if (log.isDebugEnabled())
log.debug("Refreshing partitions from oldest node: " + cctx.localNodeId());
http://git-wip-us.apache.org/repos/asf/ignite/blob/d1bc4cb2/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 2d948da..6713771 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
@@ -929,8 +929,10 @@ class ClientImpl extends TcpDiscoveryImpl {
msg.senderNodeId(rmtNodeId);
- if (log.isDebugEnabled())
- log.debug("Message has been received: " + msg);
+ DebugLogger debugLog = messageLogger(msg);
+
+ if (debugLog.isDebugEnabled())
+ debugLog.debug("Message has been received: " + msg);
spi.stats.onMessageReceived(msg);
@@ -2079,6 +2081,8 @@ class ClientImpl extends TcpDiscoveryImpl {
@Nullable DiscoverySpiCustomMessage data) {
DiscoverySpiListener lsnr = spi.lsnr;
+ DebugLogger log = type == EVT_NODE_METRICS_UPDATED ? traceLog : debugLog;
+
if (lsnr != null) {
if (log.isDebugEnabled())
log.debug("Discovery notification [node=" + node + ", type=" + U.gridEventName(type) +
@@ -2094,7 +2098,7 @@ class ClientImpl extends TcpDiscoveryImpl {
/**
* @param msg Message.
*/
- public void addMessage(Object msg) {
+ void addMessage(Object msg) {
queue.add(msg);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d1bc4cb2/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 78a5f39..0303565 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
@@ -214,6 +214,12 @@ class ServerImpl extends TcpDiscoveryImpl {
/** Leaving nodes (but still in topology). */
private final Collection<TcpDiscoveryNode> leavingNodes = new HashSet<>();
+ /** Collection to track joining nodes. */
+ private Set<UUID> joiningNodes = new HashSet<>();
+
+ /** Pending custom messages that should not be sent between NodeAdded and NodeAddFinished messages. */
+ private Queue<TcpDiscoveryCustomEventMessage> pendingCustomMsgs = new ArrayDeque<>();
+
/** If non-shared IP finder is used this flag shows whether IP finder contains local address. */
private boolean ipFinderHasLocAddr;
@@ -296,7 +302,7 @@ class ServerImpl extends TcpDiscoveryImpl {
throw new IgniteSpiException("Info log level should be enabled for TCP discovery to work " +
"in debug mode.");
- debugLog = new ConcurrentLinkedDeque<>();
+ debugLogQ = new ConcurrentLinkedDeque<>();
U.quietAndWarn(log, "TCP discovery SPI is configured in debug mode.");
}
@@ -1288,6 +1294,8 @@ class ServerImpl extends TcpDiscoveryImpl {
TcpDiscoverySpiState spiState = spiStateCopy();
+ DebugLogger log = type == EVT_NODE_METRICS_UPDATED ? traceLog : debugLog;
+
if (lsnr != null && node.visible() && (spiState == CONNECTED || spiState == DISCONNECTING)) {
if (log.isDebugEnabled())
log.debug("Discovery notification [node=" + node + ", spiState=" + spiState +
@@ -1410,10 +1418,14 @@ class ServerImpl extends TcpDiscoveryImpl {
if (log.isInfoEnabled() && spi.statsPrintFreq > 0) {
int failedNodesSize;
int leavingNodesSize;
+ int joiningNodesSize;
+ int pendingCustomMsgsSize;
synchronized (mux) {
failedNodesSize = failedNodes.size();
leavingNodesSize = leavingNodes.size();
+ joiningNodesSize = joiningNodes.size();
+ pendingCustomMsgsSize = pendingCustomMsgs.size();
}
Runtime runtime = Runtime.getRuntime();
@@ -1422,8 +1434,13 @@ class ServerImpl extends TcpDiscoveryImpl {
log.info("Discovery SPI statistics [statistics=" + spi.stats + ", spiState=" + spiStateCopy() +
", coord=" + coord +
+ ", next=" + (msgWorker != null ? msgWorker.next : "N/A") +
+ ", intOrder=" + (locNode != null ? locNode.internalOrder() : "N/A") +
", topSize=" + ring.allNodes().size() +
- ", leavingNodesSize=" + leavingNodesSize + ", failedNodesSize=" + failedNodesSize +
+ ", leavingNodesSize=" + leavingNodesSize +
+ ", failedNodesSize=" + failedNodesSize +
+ ", joiningNodesSize=" + joiningNodesSize +
+ ", pendingCustomMsgs=" + pendingCustomMsgsSize +
", msgWorker.queue.size=" + (msgWorker != null ? msgWorker.queueSize() : "N/A") +
", clients=" + ring.clientNodes().size() +
", clientWorkers=" + clientMsgWorkers.size() +
@@ -1612,7 +1629,7 @@ class ServerImpl extends TcpDiscoveryImpl {
b.append("In-memory log messages: ").append(U.nl());
- for (String msg : debugLog)
+ for (String msg : debugLogQ)
b.append(" ").append(msg).append(U.nl());
b.append(U.nl());
@@ -2177,12 +2194,6 @@ class ServerImpl extends TcpDiscoveryImpl {
/** Connection check threshold. */
private long connCheckThreshold;
- /** Pending custom messages that should not be sent between NodeAdded and NodeAddFinished messages. */
- private Queue<TcpDiscoveryCustomEventMessage> pendingCustomMsgs = new ArrayDeque<>();
-
- /** Collection to track joining nodes. */
- private Set<UUID> joiningNodes = new HashSet<>();
-
/**
*/
protected RingMessageWorker() {
@@ -2197,6 +2208,8 @@ class ServerImpl extends TcpDiscoveryImpl {
* @param msg Message to add.
*/
void addMessage(TcpDiscoveryAbstractMessage msg) {
+ DebugLogger log = messageLogger(msg);
+
if ((msg instanceof TcpDiscoveryStatusCheckMessage ||
msg instanceof TcpDiscoveryJoinRequestMessage ||
msg instanceof TcpDiscoveryCustomEventMessage ||
@@ -2278,6 +2291,8 @@ class ServerImpl extends TcpDiscoveryImpl {
* @param msg Message to process.
*/
@Override protected void processMessage(TcpDiscoveryAbstractMessage msg) {
+ DebugLogger log = messageLogger(msg);
+
if (log.isDebugEnabled())
log.debug("Processing message [cls=" + msg.getClass().getSimpleName() + ", id=" + msg.id() + ']');
@@ -2285,12 +2300,12 @@ class ServerImpl extends TcpDiscoveryImpl {
debugLog(msg, "Processing message [cls=" + msg.getClass().getSimpleName() + ", id=" + msg.id() + ']');
if (locNode.internalOrder() == 0) {
- boolean process = false;
+ boolean proc = false;
if (msg instanceof TcpDiscoveryNodeAddedMessage)
- process = ((TcpDiscoveryNodeAddedMessage)msg).node().equals(locNode);
+ proc = ((TcpDiscoveryNodeAddedMessage)msg).node().equals(locNode);
- if (!process) {
+ if (!proc) {
if (log.isDebugEnabled()) {
log.debug("Ignore message, local node order is not initialized [msg=" + msg +
", locNode=" + locNode + ']');
@@ -2488,8 +2503,8 @@ class ServerImpl extends TcpDiscoveryImpl {
newNextNode = true;
}
- else if (log.isDebugEnabled())
- log.debug("Next node remains the same [nextId=" + next.id() +
+ else if (log.isTraceEnabled())
+ log.trace("Next node remains the same [nextId=" + next.id() +
", nextOrder=" + next.internalOrder() + ']');
// Flag that shows whether next node exists and accepts incoming connections.
@@ -2752,8 +2767,10 @@ class ServerImpl extends TcpDiscoveryImpl {
onMessageExchanged();
- if (log.isDebugEnabled()) {
- log.debug("Message has been sent to next node [msg=" + msg +
+ DebugLogger debugLog = messageLogger(msg);
+
+ if (debugLog.isDebugEnabled()) {
+ debugLog.debug("Message has been sent to next node [msg=" + msg +
", next=" + next.id() +
", res=" + res + ']');
}
@@ -3783,7 +3800,9 @@ class ServerImpl extends TcpDiscoveryImpl {
return;
}
- joiningNodes.add(node.id());
+ synchronized (mux) {
+ joiningNodes.add(node.id());
+ }
if (!isLocalNodeCoordinator() && spi.nodeAuth != null && spi.nodeAuth.isGlobalNodeAuthentication()) {
boolean authFailed = true;
@@ -3895,7 +3914,9 @@ class ServerImpl extends TcpDiscoveryImpl {
n.visible(true);
}
- joiningNodes.clear();
+ synchronized (mux) {
+ joiningNodes.clear();
+ }
locNode.setAttributes(node.attributes());
@@ -4021,7 +4042,9 @@ class ServerImpl extends TcpDiscoveryImpl {
}
}
- joiningNodes.remove(nodeId);
+ synchronized (mux) {
+ joiningNodes.remove(nodeId);
+ }
TcpDiscoverySpiState state = spiStateCopy();
@@ -4240,7 +4263,9 @@ class ServerImpl extends TcpDiscoveryImpl {
}
}
- joiningNodes.remove(leftNode.id());
+ synchronized (mux) {
+ joiningNodes.remove(leftNode.id());
+ }
spi.stats.onNodeLeft();
@@ -4418,7 +4443,9 @@ class ServerImpl extends TcpDiscoveryImpl {
", msg=" + msg.warning() + ']');
}
- joiningNodes.remove(node.id());
+ synchronized (mux) {
+ joiningNodes.remove(node.id());
+ }
notifyDiscovery(EVT_NODE_FAILED, topVer, node);
@@ -4619,8 +4646,8 @@ class ServerImpl extends TcpDiscoveryImpl {
}
if (locNodeId.equals(msg.creatorNodeId()) && !hasMetrics(msg, locNodeId) && msg.senderNodeId() != null) {
- if (log.isDebugEnabled())
- log.debug("Discarding heartbeat message that has made two passes: " + msg);
+ if (log.isTraceEnabled())
+ log.trace("Discarding heartbeat message that has made two passes: " + msg);
return;
}
@@ -4821,18 +4848,28 @@ class ServerImpl extends TcpDiscoveryImpl {
assert ring.minimumNodeVersion() != null : ring;
+ boolean joiningEmpty;
+
+ synchronized (mux) {
+ joiningEmpty = joiningNodes.isEmpty();
+ }
+
if (ring.minimumNodeVersion().compareTo(CUSTOM_MSG_ALLOW_JOINING_FOR_VERIFIED_SINCE) >= 0)
- delayMsg = msg.topologyVersion() == 0L && !joiningNodes.isEmpty();
+ delayMsg = msg.topologyVersion() == 0L && !joiningEmpty;
else
- delayMsg = !joiningNodes.isEmpty();
+ delayMsg = !joiningEmpty;
if (delayMsg) {
if (log.isDebugEnabled()) {
- log.debug("Delay custom message processing, there are joining nodes [msg=" + msg +
- ", joiningNodes=" + joiningNodes + ']');
+ synchronized (mux) {
+ log.debug("Delay custom message processing, there are joining nodes [msg=" + msg +
+ ", joiningNodes=" + joiningNodes + ']');
+ }
}
- pendingCustomMsgs.add(msg);
+ synchronized (mux) {
+ pendingCustomMsgs.add(msg);
+ }
return;
}
@@ -4973,10 +5010,16 @@ class ServerImpl extends TcpDiscoveryImpl {
* Checks and flushes custom event messages if no nodes are attempting to join the grid.
*/
private void checkPendingCustomMessages() {
- if (joiningNodes.isEmpty() && isLocalNodeCoordinator()) {
+ boolean joiningEmpty;
+
+ synchronized (mux) {
+ joiningEmpty = joiningNodes.isEmpty();
+ }
+
+ if (joiningEmpty && isLocalNodeCoordinator()) {
TcpDiscoveryCustomEventMessage msg;
- while ((msg = pendingCustomMsgs.poll()) != null) {
+ while ((msg = pollPendingCustomeMessage()) != null) {
processCustomMessage(msg);
if (msg.verified())
@@ -4986,6 +5029,15 @@ class ServerImpl extends TcpDiscoveryImpl {
}
/**
+ * @return Pending custom message.
+ */
+ @Nullable private TcpDiscoveryCustomEventMessage pollPendingCustomeMessage() {
+ synchronized (mux) {
+ return pendingCustomMsgs.poll();
+ }
+ }
+
+ /**
* @param msg Custom message.
*/
private void notifyDiscoveryListener(TcpDiscoveryCustomEventMessage msg) {
@@ -5134,8 +5186,12 @@ class ServerImpl extends TcpDiscoveryImpl {
else
srvrSock = new ServerSocket(port, 0, spi.locHost);
- if (log.isInfoEnabled())
- log.info("Successfully bound to TCP port [port=" + port + ", localHost=" + spi.locHost + ']');
+ if (log.isInfoEnabled()) {
+ log.info("Successfully bound to TCP port [port=" + port +
+ ", localHost=" + spi.locHost +
+ ", locNodeId=" + spi.ignite().configuration().getNodeId() +
+ ']');
+ }
return;
}
@@ -5450,7 +5506,7 @@ class ServerImpl extends TcpDiscoveryImpl {
return;
}
- long socketTimeout = spi.failureDetectionTimeoutEnabled() ? spi.failureDetectionTimeout() :
+ long sockTimeout = spi.failureDetectionTimeoutEnabled() ? spi.failureDetectionTimeout() :
spi.getSocketTimeout();
while (!isInterrupted()) {
@@ -5460,8 +5516,10 @@ class ServerImpl extends TcpDiscoveryImpl {
msg.senderNodeId(nodeId);
- if (log.isDebugEnabled())
- log.debug("Message has been received: " + msg);
+ DebugLogger debugLog = messageLogger(msg);
+
+ if (debugLog.isDebugEnabled())
+ debugLog.debug("Message has been received: " + msg);
spi.stats.onMessageReceived(msg);
@@ -5469,7 +5527,7 @@ class ServerImpl extends TcpDiscoveryImpl {
debugLog(msg, "Message has been received: " + msg);
if (msg instanceof TcpDiscoveryConnectionCheckMessage) {
- spi.writeToSocket(msg, sock, RES_OK, socketTimeout);
+ spi.writeToSocket(msg, sock, RES_OK, sockTimeout);
continue;
}
@@ -5491,7 +5549,7 @@ class ServerImpl extends TcpDiscoveryImpl {
TcpDiscoverySpiState state = spiStateCopy();
if (state == CONNECTED) {
- spi.writeToSocket(msg, sock, RES_OK, socketTimeout);
+ spi.writeToSocket(msg, sock, RES_OK, sockTimeout);
if (clientMsgWrk.getState() == State.NEW)
clientMsgWrk.start();
@@ -5501,7 +5559,7 @@ class ServerImpl extends TcpDiscoveryImpl {
continue;
}
else {
- spi.writeToSocket(msg, sock, RES_CONTINUE_JOIN, socketTimeout);
+ spi.writeToSocket(msg, sock, RES_CONTINUE_JOIN, sockTimeout);
break;
}
@@ -5509,7 +5567,7 @@ class ServerImpl extends TcpDiscoveryImpl {
}
else if (msg instanceof TcpDiscoveryDuplicateIdMessage) {
// Send receipt back.
- spi.writeToSocket(msg, sock, RES_OK, socketTimeout);
+ spi.writeToSocket(msg, sock, RES_OK, sockTimeout);
boolean ignored = false;
@@ -5538,7 +5596,7 @@ class ServerImpl extends TcpDiscoveryImpl {
}
else if (msg instanceof TcpDiscoveryAuthFailedMessage) {
// Send receipt back.
- spi.writeToSocket(msg, sock, RES_OK, socketTimeout);
+ spi.writeToSocket(msg, sock, RES_OK, sockTimeout);
boolean ignored = false;
@@ -5567,7 +5625,7 @@ class ServerImpl extends TcpDiscoveryImpl {
}
else if (msg instanceof TcpDiscoveryCheckFailedMessage) {
// Send receipt back.
- spi.writeToSocket(msg, sock, RES_OK, socketTimeout);
+ spi.writeToSocket(msg, sock, RES_OK, sockTimeout);
boolean ignored = false;
@@ -5596,7 +5654,7 @@ class ServerImpl extends TcpDiscoveryImpl {
}
else if (msg instanceof TcpDiscoveryLoopbackProblemMessage) {
// Send receipt back.
- spi.writeToSocket(msg, sock, RES_OK, socketTimeout);
+ spi.writeToSocket(msg, sock, RES_OK, sockTimeout);
boolean ignored = false;
@@ -5650,7 +5708,7 @@ class ServerImpl extends TcpDiscoveryImpl {
clientMsgWrk.addMessage(ack);
}
else
- spi.writeToSocket(msg, sock, RES_OK, socketTimeout);
+ spi.writeToSocket(msg, sock, RES_OK, sockTimeout);
if (heartbeatMsg != null)
processClientHeartbeatMessage(heartbeatMsg);
@@ -5930,6 +5988,8 @@ class ServerImpl extends TcpDiscoveryImpl {
else
queue.add(t);
+ DebugLogger log = messageLogger(msg);
+
if (log.isDebugEnabled())
log.debug("Message has been added to client queue: " + msg);
}
@@ -5948,22 +6008,24 @@ class ServerImpl extends TcpDiscoveryImpl {
if (msgBytes == null)
msgBytes = U.marshal(spi.marshaller(), msg);
+ DebugLogger msgLog = messageLogger(msg);
+
if (msg instanceof TcpDiscoveryClientAckResponse) {
if (clientVer == null) {
ClusterNode node = spi.getNode(clientNodeId);
if (node != null)
clientVer = IgniteUtils.productVersion(node);
- else if (log.isDebugEnabled())
- log.debug("Skip sending message ack to client, fail to get client node " +
+ else if (msgLog.isDebugEnabled())
+ msgLog.debug("Skip sending message ack to client, fail to get client node " +
"[sock=" + sock + ", locNodeId=" + getLocalNodeId() +
", rmtNodeId=" + clientNodeId + ", msg=" + msg + ']');
}
if (clientVer != null &&
clientVer.compareTo(TcpDiscoveryClientAckResponse.CLIENT_ACK_SINCE_VERSION) >= 0) {
- if (log.isDebugEnabled())
- log.debug("Sending message ack to client [sock=" + sock + ", locNodeId="
+ if (msgLog.isDebugEnabled())
+ msgLog.debug("Sending message ack to client [sock=" + sock + ", locNodeId="
+ getLocalNodeId() + ", rmtNodeId=" + clientNodeId + ", msg=" + msg + ']');
spi.writeToSocket(sock, msg, msgBytes, spi.failureDetectionTimeoutEnabled() ?
@@ -5971,8 +6033,8 @@ class ServerImpl extends TcpDiscoveryImpl {
}
}
else {
- if (log.isDebugEnabled())
- log.debug("Redirecting message to client [sock=" + sock + ", locNodeId="
+ if (msgLog.isDebugEnabled())
+ msgLog.debug("Redirecting message to client [sock=" + sock + ", locNodeId="
+ getLocalNodeId() + ", rmtNodeId=" + clientNodeId + ", msg=" + msg + ']');
assert topologyInitialized(msg) : msg;
http://git-wip-us.apache.org/repos/asf/ignite/blob/d1bc4cb2/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryImpl.java
index 30b83e5..18d7b72 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryImpl.java
@@ -70,7 +70,33 @@ abstract class TcpDiscoveryImpl {
/** Received messages. */
@SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
- protected ConcurrentLinkedDeque<String> debugLog;
+ protected ConcurrentLinkedDeque<String> debugLogQ;
+
+ /** */
+ protected final ServerImpl.DebugLogger debugLog = new ServerImpl.DebugLogger() {
+ /** {@inheritDoc} */
+ @Override public boolean isDebugEnabled() {
+ return log.isDebugEnabled();
+ }
+
+ /** {@inheritDoc} */
+ @Override public void debug(String msg) {
+ log.debug(msg);
+ }
+ };
+
+ /** */
+ protected final ServerImpl.DebugLogger traceLog = new ServerImpl.DebugLogger() {
+ /** {@inheritDoc} */
+ @Override public boolean isDebugEnabled() {
+ return log.isTraceEnabled();
+ }
+
+ /** {@inheritDoc} */
+ @Override public void debug(String msg) {
+ log.trace(msg);
+ }
+ };
/**
* @param spi Adapter.
@@ -111,12 +137,12 @@ abstract class TcpDiscoveryImpl {
"-" + locNode.internalOrder() + "] " +
msg;
- debugLog.add(msg0);
+ debugLogQ.add(msg0);
- int delta = debugLog.size() - debugMsgHist;
+ int delta = debugLogQ.size() - debugMsgHist;
- for (int i = 0; i < delta && debugLog.size() > debugMsgHist; i++)
- debugLog.poll();
+ for (int i = 0; i < delta && debugLogQ.size() > debugMsgHist; i++)
+ debugLogQ.poll();
}
/**
@@ -326,4 +352,27 @@ abstract class TcpDiscoveryImpl {
return res;
}
+
+ /**
+ * @param msg Message.
+ * @return Message logger.
+ */
+ protected final DebugLogger messageLogger(TcpDiscoveryAbstractMessage msg) {
+ return msg.traceLogLevel() ? traceLog : debugLog;
+ }
+
+ /**
+ *
+ */
+ interface DebugLogger {
+ /**
+ * @return {@code True} if debug logging is enabled.
+ */
+ boolean isDebugEnabled();
+
+ /**
+ * @param msg Message to log.
+ */
+ void debug(String msg);
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d1bc4cb2/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryAbstractMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryAbstractMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryAbstractMessage.java
index 24f2a5a..39170ea 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryAbstractMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryAbstractMessage.java
@@ -99,6 +99,13 @@ public abstract class TcpDiscoveryAbstractMessage implements Serializable {
}
/**
+ * @return
+ */
+ public boolean traceLogLevel() {
+ return false;
+ }
+
+ /**
* Gets creator node.
*
* @return Creator node ID.
http://git-wip-us.apache.org/repos/asf/ignite/blob/d1bc4cb2/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientAckResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientAckResponse.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientAckResponse.java
index 6505765..0a656d5 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientAckResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientAckResponse.java
@@ -53,6 +53,11 @@ public class TcpDiscoveryClientAckResponse extends TcpDiscoveryAbstractMessage {
}
/** {@inheritDoc} */
+ @Override public boolean traceLogLevel() {
+ return true;
+ }
+
+ /** {@inheritDoc} */
@Override public boolean highPriority() {
return true;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d1bc4cb2/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientHeartbeatMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientHeartbeatMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientHeartbeatMessage.java
index 3993de0..0eb1355 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientHeartbeatMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientHeartbeatMessage.java
@@ -61,6 +61,11 @@ public class TcpDiscoveryClientHeartbeatMessage extends TcpDiscoveryAbstractMess
}
/** {@inheritDoc} */
+ @Override public boolean traceLogLevel() {
+ return true;
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
return S.toString(TcpDiscoveryClientHeartbeatMessage.class, this, "super", super.toString());
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d1bc4cb2/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryConnectionCheckMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryConnectionCheckMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryConnectionCheckMessage.java
index a152936..7793a3a 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryConnectionCheckMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryConnectionCheckMessage.java
@@ -50,6 +50,11 @@ public class TcpDiscoveryConnectionCheckMessage extends TcpDiscoveryAbstractMess
}
/** {@inheritDoc} */
+ @Override public boolean traceLogLevel() {
+ return true;
+ }
+
+ /** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
// This method has been left empty intentionally to keep message size at min.
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d1bc4cb2/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHeartbeatMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHeartbeatMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHeartbeatMessage.java
index 338e3f5..0ae253a 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHeartbeatMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHeartbeatMessage.java
@@ -214,6 +214,11 @@ public class TcpDiscoveryHeartbeatMessage extends TcpDiscoveryAbstractMessage {
}
/** {@inheritDoc} */
+ @Override public boolean traceLogLevel() {
+ return true;
+ }
+
+ /** {@inheritDoc} */
@Override public boolean highPriority() {
return true;
}
[14/20] ignite git commit: IGNITE-3705: Fixed compiliation warnings.
This closes #1169.
Posted by sb...@apache.org.
IGNITE-3705: Fixed compiliation warnings. This closes #1169.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f37fbcab
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f37fbcab
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f37fbcab
Branch: refs/heads/ignite-4111
Commit: f37fbcab1ae2c7553696e96b7a9c3194a570d7af
Parents: 66c76d1
Author: isapego <is...@gridgain.com>
Authored: Wed Oct 19 13:06:42 2016 +0300
Committer: isapego <is...@gridgain.com>
Committed: Wed Oct 19 13:06:42 2016 +0300
----------------------------------------------------------------------
modules/platforms/cpp/binary/project/vs/binary.vcxproj | 2 --
modules/platforms/cpp/common/project/vs/common.vcxproj | 1 -
modules/platforms/cpp/core/project/vs/core.vcxproj | 2 --
modules/platforms/cpp/ignite/project/vs/ignite.vcxproj | 4 ++--
modules/platforms/cpp/jni/project/vs/jni.vcxproj | 1 -
modules/platforms/cpp/odbc-test/src/queries_test.cpp | 4 ++--
modules/platforms/cpp/odbc/project/vs/odbc.vcxproj | 4 ++--
7 files changed, 6 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f37fbcab/modules/platforms/cpp/binary/project/vs/binary.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/project/vs/binary.vcxproj b/modules/platforms/cpp/binary/project/vs/binary.vcxproj
index 212c554..a29b361 100644
--- a/modules/platforms/cpp/binary/project/vs/binary.vcxproj
+++ b/modules/platforms/cpp/binary/project/vs/binary.vcxproj
@@ -140,7 +140,6 @@
<Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
- <SDLCheck>false</SDLCheck>
<AdditionalIncludeDirectories>$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\include</AdditionalIncludeDirectories>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
@@ -162,7 +161,6 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
- <SDLCheck>false</SDLCheck>
<AdditionalIncludeDirectories>$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\include</AdditionalIncludeDirectories>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f37fbcab/modules/platforms/cpp/common/project/vs/common.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/project/vs/common.vcxproj b/modules/platforms/cpp/common/project/vs/common.vcxproj
index e0abed2..149fa48 100644
--- a/modules/platforms/cpp/common/project/vs/common.vcxproj
+++ b/modules/platforms/cpp/common/project/vs/common.vcxproj
@@ -149,7 +149,6 @@
<Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
- <SDLCheck>false</SDLCheck>
<AdditionalIncludeDirectories>$(ProjectDir)\..\..\include;$(ProjectDir)\..\..\os\win\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f37fbcab/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 ca14a1d..6320323 100644
--- a/modules/platforms/cpp/core/project/vs/core.vcxproj
+++ b/modules/platforms/cpp/core/project/vs/core.vcxproj
@@ -149,7 +149,6 @@
<Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
- <SDLCheck>false</SDLCheck>
<AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\..\jni\include;$(ProjectDir)\..\..\..\jni\os\win\include;$(ProjectDir)\..\..\..\binary\include;$(ProjectDir)\..\..\..\binary\os\win\include;$(ProjectDir)\..\..\include;$(ProjectDir)\..\..\os\win\include</AdditionalIncludeDirectories>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
@@ -173,7 +172,6 @@
<Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
- <SDLCheck>false</SDLCheck>
<AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\..\jni\include;$(ProjectDir)\..\..\..\jni\os\win\include;$(ProjectDir)\..\..\..\binary\include;$(ProjectDir)\..\..\..\binary\os\win\include;$(ProjectDir)\..\..\include;$(ProjectDir)\..\..\os\win\include</AdditionalIncludeDirectories>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f37fbcab/modules/platforms/cpp/ignite/project/vs/ignite.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/ignite/project/vs/ignite.vcxproj b/modules/platforms/cpp/ignite/project/vs/ignite.vcxproj
index 6b6bed3..9a912ef 100644
--- a/modules/platforms/cpp/ignite/project/vs/ignite.vcxproj
+++ b/modules/platforms/cpp/ignite/project/vs/ignite.vcxproj
@@ -120,10 +120,10 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
- <SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\..\jni\include;$(ProjectDir)\..\..\..\jni\os\win\include;$(ProjectDir)\..\..\..\binary\include;$(ProjectDir)\..\..\..\binary\os\win\include;$(ProjectDir)\..\..\..\core\include;$(ProjectDir)\..\..\..\core\os\win\include;$(BOOST_HOME)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;IGNITE_IMPL;_CRT_SECURE_NO_WARNINGS;IGNITE_FRIEND;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Async</ExceptionHandling>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -138,10 +138,10 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
- <SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\..\jni\include;$(ProjectDir)\..\..\..\jni\os\win\include;$(ProjectDir)\..\..\..\binary\include;$(ProjectDir)\..\..\..\binary\os\win\include;$(ProjectDir)\..\..\..\core\include;$(ProjectDir)\..\..\..\core\os\win\include;$(BOOST_HOME)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;IGNITE_IMPL;_CRT_SECURE_NO_WARNINGS;IGNITE_FRIEND;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Async</ExceptionHandling>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f37fbcab/modules/platforms/cpp/jni/project/vs/jni.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/project/vs/jni.vcxproj b/modules/platforms/cpp/jni/project/vs/jni.vcxproj
index ac17ad3..f080a68 100644
--- a/modules/platforms/cpp/jni/project/vs/jni.vcxproj
+++ b/modules/platforms/cpp/jni/project/vs/jni.vcxproj
@@ -161,7 +161,6 @@
<Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
- <SDLCheck>false</SDLCheck>
<AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\include;$(ProjectDir)\..\..\os\win\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f37fbcab/modules/platforms/cpp/odbc-test/src/queries_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/queries_test.cpp b/modules/platforms/cpp/odbc-test/src/queries_test.cpp
index b7ea967..eb6e153 100644
--- a/modules/platforms/cpp/odbc-test/src/queries_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/queries_test.cpp
@@ -584,12 +584,12 @@ BOOST_AUTO_TEST_CASE(TestDataAtExecution)
SQLLEN len1 = SQL_DATA_AT_EXEC;
SQLLEN len2 = SQL_LEN_DATA_AT_EXEC(static_cast<SQLLEN>(in1.strField.size()));
- ret = SQLBindParam(stmt, 1, SQL_C_SLONG, SQL_INTEGER, 100, 100, &ind1, &len1);
+ ret = SQLBindParameter(stmt, 1, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 100, 100, &ind1, sizeof(ind1), &len1);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
- ret = SQLBindParam(stmt, 2, SQL_C_CHAR, SQL_VARCHAR, 100, 100, &ind2, &len2);
+ ret = SQLBindParameter(stmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, 100, 100, &ind2, sizeof(ind2), &len2);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
http://git-wip-us.apache.org/repos/asf/ignite/blob/f37fbcab/modules/platforms/cpp/odbc/project/vs/odbc.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/project/vs/odbc.vcxproj b/modules/platforms/cpp/odbc/project/vs/odbc.vcxproj
index 348a11a..4e4ff5b 100644
--- a/modules/platforms/cpp/odbc/project/vs/odbc.vcxproj
+++ b/modules/platforms/cpp/odbc/project/vs/odbc.vcxproj
@@ -122,9 +122,9 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
- <SDLCheck>false</SDLCheck>
<AdditionalIncludeDirectories>$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\..\binary\include;$(ProjectDir)\..\..\..\binary\os\win\include;$(ProjectDir)\..\..\include;$(ProjectDir)\..\..\os\win\include;$(ProjectDir)\..\..\src</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;IGNITE_IMPL;IGNITE_FRIEND;TARGET_MODULE_FULL_NAME="$(TargetFileName)";%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -140,9 +140,9 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
- <SDLCheck>false</SDLCheck>
<AdditionalIncludeDirectories>$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\..\binary\include;$(ProjectDir)\..\..\..\binary\os\win\include;$(ProjectDir)\..\..\include;$(ProjectDir)\..\..\os\win\include;$(ProjectDir)\..\..\src</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;IGNITE_IMPL;IGNITE_FRIEND;TARGET_MODULE_FULL_NAME="$(TargetFileName)";%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
[11/20] ignite git commit: IGNITE-1924 Incomplete marshaller cache
rebalancing causes Grid hangs under SSL (HOTFIX)
Posted by sb...@apache.org.
IGNITE-1924 Incomplete marshaller cache rebalancing causes Grid hangs under SSL (HOTFIX)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a863eeed
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a863eeed
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a863eeed
Branch: refs/heads/ignite-4111
Commit: a863eeed9d152eed8418416291b9b19bd5b5e88b
Parents: e6430bd
Author: Anton Vinogradov <av...@apache.org>
Authored: Tue Oct 18 13:20:30 2016 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Tue Oct 18 13:20:30 2016 +0300
----------------------------------------------------------------------
.../apache/ignite/internal/util/nio/ssl/BlockingSslHandler.java | 2 --
1 file changed, 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a863eeed/modules/core/src/main/java/org/apache/ignite/internal/util/nio/ssl/BlockingSslHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/ssl/BlockingSslHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/ssl/BlockingSslHandler.java
index 273df5d..b3e8201 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/ssl/BlockingSslHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/ssl/BlockingSslHandler.java
@@ -472,8 +472,6 @@ public class BlockingSslHandler {
*/
private void readFromNet() throws IgniteCheckedException {
try {
- inNetBuf.clear();
-
int read = ch.read(inNetBuf);
if (read == -1)
[08/20] ignite git commit: Revert "IGNITE-3875: Added separate thread
pool for data streamer. This closes #1067."
Posted by sb...@apache.org.
Revert "IGNITE-3875: Added separate thread pool for data streamer. This closes #1067."
This reverts commit f597aff1bdf65d3d430cf85c9932391a72c2d7dc.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4edcf126
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4edcf126
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4edcf126
Branch: refs/heads/ignite-4111
Commit: 4edcf126baf75840e3816a3e0876200c7e9c0d45
Parents: 44eff48
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Tue Oct 18 12:25:56 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Oct 18 12:25:56 2016 +0300
----------------------------------------------------------------------
.../configuration/IgniteConfiguration.java | 31 -------
.../ignite/internal/GridKernalContext.java | 7 --
.../ignite/internal/GridKernalContextImpl.java | 12 ---
.../apache/ignite/internal/IgniteKernal.java | 3 -
.../org/apache/ignite/internal/IgnitionEx.java | 20 +---
.../managers/communication/GridIoManager.java | 2 -
.../managers/communication/GridIoPolicy.java | 3 -
.../closure/GridClosureProcessor.java | 3 +-
.../datastreamer/DataStreamProcessor.java | 82 ++---------------
.../datastreamer/DataStreamerImpl.java | 31 ++++++-
.../internal/processors/pool/PoolProcessor.java | 3 -
.../DataStreamProcessorSelfTest.java | 97 --------------------
.../junits/GridTestKernalContext.java | 12 +--
13 files changed, 44 insertions(+), 262 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/4edcf126/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
index 412ecbf..73de470 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
@@ -148,9 +148,6 @@ public class IgniteConfiguration {
/** Default core size of public thread pool. */
public static final int DFLT_PUBLIC_THREAD_CNT = Math.max(8, AVAILABLE_PROC_CNT) * 2;
- /** Default size of data streamer thread pool. */
- public static final int DFLT_DATA_STREAMER_POOL_SIZE = DFLT_PUBLIC_THREAD_CNT;
-
/** Default keep alive time for public thread pool. */
@Deprecated
public static final long DFLT_PUBLIC_KEEP_ALIVE_TIME = 0;
@@ -248,9 +245,6 @@ public class IgniteConfiguration {
/** IGFS pool size. */
private int igfsPoolSize = AVAILABLE_PROC_CNT;
- /** Data stream pool size. */
- private int dataStreamerPoolSize = DFLT_DATA_STREAMER_POOL_SIZE;
-
/** Utility cache pool size. */
private int utilityCachePoolSize = DFLT_SYSTEM_CORE_THREAD_CNT;
@@ -514,7 +508,6 @@ public class IgniteConfiguration {
clockSyncFreq = cfg.getClockSyncFrequency();
clockSyncSamples = cfg.getClockSyncSamples();
consistentId = cfg.getConsistentId();
- dataStreamerPoolSize = cfg.getDataStreamerThreadPoolSize();
deployMode = cfg.getDeploymentMode();
discoStartupDelay = cfg.getDiscoveryStartupDelay();
failureDetectionTimeout = cfg.getFailureDetectionTimeout();
@@ -796,17 +789,6 @@ public class IgniteConfiguration {
}
/**
- * Size of thread pool that is in charge of processing data stream messages.
- * <p>
- * If not provided, executor service will have size {@link #DFLT_DATA_STREAMER_POOL_SIZE}.
- *
- * @return Thread pool size to be used for data stream messages.
- */
- public int getDataStreamerThreadPoolSize() {
- return dataStreamerPoolSize;
- }
-
- /**
* Default size of thread pool that is in charge of processing utility cache messages.
* <p>
* If not provided, executor service will have size {@link #DFLT_SYSTEM_CORE_THREAD_CNT}.
@@ -930,19 +912,6 @@ public class IgniteConfiguration {
}
/**
- * Set thread pool size that will be used to process data stream messages.
- *
- * @param poolSize Executor service to use for data stream messages.
- * @see IgniteConfiguration#getDataStreamerThreadPoolSize()
- * @return {@code this} for chaining.
- */
- public IgniteConfiguration setDataStreamerThreadPoolSize(int poolSize) {
- dataStreamerPoolSize = poolSize;
-
- return this;
- }
-
- /**
* Sets default thread pool size that will be used to process utility cache messages.
*
* @param poolSize Default executor service size to use for utility cache messages.
http://git-wip-us.apache.org/repos/asf/ignite/blob/4edcf126/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java
index 178239b..e608af2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java
@@ -532,13 +532,6 @@ public interface GridKernalContext extends Iterable<GridComponent> {
public ExecutorService getIgfsExecutorService();
/**
- * Executor service that is in charge of processing data stream messages.
- *
- * @return Thread pool implementation to be used for data stream messages.
- */
- public ExecutorService getDataStreamerExecutorService();
-
- /**
* Should return an instance of fully configured thread pool to be used for
* processing of client messages (REST requests).
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/4edcf126/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
index 1a9663b..ddef345 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
@@ -312,10 +312,6 @@ public class GridKernalContextImpl implements GridKernalContext, Externalizable
/** */
@GridToStringExclude
- private ExecutorService dataStreamExecSvc;
-
- /** */
- @GridToStringExclude
protected ExecutorService restExecSvc;
/** */
@@ -384,7 +380,6 @@ public class GridKernalContextImpl implements GridKernalContext, Externalizable
* @param p2pExecSvc P2P executor service.
* @param mgmtExecSvc Management executor service.
* @param igfsExecSvc IGFS executor service.
- * @param dataStreamExecSvc data stream executor service.
* @param restExecSvc REST executor service.
* @param affExecSvc Affinity executor service.
* @param plugins Plugin providers.
@@ -403,7 +398,6 @@ public class GridKernalContextImpl implements GridKernalContext, Externalizable
ExecutorService p2pExecSvc,
ExecutorService mgmtExecSvc,
ExecutorService igfsExecSvc,
- ExecutorService dataStreamExecSvc,
ExecutorService restExecSvc,
ExecutorService affExecSvc,
IgniteStripedThreadPoolExecutor callbackExecSvc,
@@ -422,7 +416,6 @@ public class GridKernalContextImpl implements GridKernalContext, Externalizable
this.p2pExecSvc = p2pExecSvc;
this.mgmtExecSvc = mgmtExecSvc;
this.igfsExecSvc = igfsExecSvc;
- this.dataStreamExecSvc = dataStreamExecSvc;
this.restExecSvc = restExecSvc;
this.affExecSvc = affExecSvc;
this.callbackExecSvc = callbackExecSvc;
@@ -963,11 +956,6 @@ public class GridKernalContextImpl implements GridKernalContext, Externalizable
}
/** {@inheritDoc} */
- @Override public ExecutorService getDataStreamerExecutorService() {
- return dataStreamExecSvc;
- }
-
- /** {@inheritDoc} */
@Override public ExecutorService getRestExecutorService() {
return restExecSvc;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4edcf126/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index e838dd2..586215a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -666,7 +666,6 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
* @param p2pExecSvc P2P executor service.
* @param mgmtExecSvc Management executor service.
* @param igfsExecSvc IGFS executor service.
- * @param dataStreamExecSvc data stream executor service.
* @param restExecSvc Reset executor service.
* @param affExecSvc Affinity executor service.
* @param errHnd Error handler to use for notification about startup problems.
@@ -681,7 +680,6 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
ExecutorService p2pExecSvc,
ExecutorService mgmtExecSvc,
ExecutorService igfsExecSvc,
- ExecutorService dataStreamExecSvc,
ExecutorService restExecSvc,
ExecutorService affExecSvc,
IgniteStripedThreadPoolExecutor callbackExecSvc,
@@ -788,7 +786,6 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
p2pExecSvc,
mgmtExecSvc,
igfsExecSvc,
- dataStreamExecSvc,
restExecSvc,
affExecSvc,
callbackExecSvc,
http://git-wip-us.apache.org/repos/asf/ignite/blob/4edcf126/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
index 104599c..a6860b3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
@@ -1468,9 +1468,6 @@ public class IgnitionEx {
/** IGFS executor service. */
private ThreadPoolExecutor igfsExecSvc;
- /** Data streamer executor service. */
- private ThreadPoolExecutor dataStreamerExecSvc;
-
/** REST requests executor service. */
private ThreadPoolExecutor restExecSvc;
@@ -1690,17 +1687,6 @@ public class IgnitionEx {
p2pExecSvc.allowCoreThreadTimeOut(true);
- // Note that we do not pre-start threads here as this pool may not be needed.
- dataStreamerExecSvc = new IgniteThreadPoolExecutor(
- "data-streamer",
- cfg.getGridName(),
- cfg.getDataStreamerThreadPoolSize(),
- cfg.getDataStreamerThreadPoolSize(),
- DFLT_THREAD_KEEP_ALIVE_TIME,
- new LinkedBlockingQueue<Runnable>());
-
- dataStreamerExecSvc.allowCoreThreadTimeOut(true);
-
// Note that we do not pre-start threads here as igfs pool may not be needed.
igfsExecSvc = new IgniteThreadPoolExecutor(
cfg.getIgfsThreadPoolSize(),
@@ -1773,7 +1759,7 @@ public class IgnitionEx {
grid = grid0;
grid0.start(myCfg, utilityCacheExecSvc, marshCacheExecSvc, execSvc, sysExecSvc, p2pExecSvc, mgmtExecSvc,
- igfsExecSvc, dataStreamerExecSvc, restExecSvc, affExecSvc, callbackExecSvc,
+ igfsExecSvc, restExecSvc, affExecSvc, callbackExecSvc,
new CA() {
@Override public void apply() {
startLatch.countDown();
@@ -2391,10 +2377,6 @@ public class IgnitionEx {
p2pExecSvc = null;
- U.shutdownNow(getClass(), dataStreamerExecSvc, log);
-
- dataStreamerExecSvc = null;
-
U.shutdownNow(getClass(), igfsExecSvc, log);
igfsExecSvc = null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/4edcf126/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
index ba41dab..cd43318 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
@@ -84,7 +84,6 @@ import static org.apache.ignite.events.EventType.EVT_NODE_JOINED;
import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
import static org.apache.ignite.internal.GridTopic.TOPIC_COMM_USER;
import static org.apache.ignite.internal.managers.communication.GridIoPolicy.AFFINITY_POOL;
-import static org.apache.ignite.internal.managers.communication.GridIoPolicy.DATA_STREAMER_POOL;
import static org.apache.ignite.internal.managers.communication.GridIoPolicy.IGFS_POOL;
import static org.apache.ignite.internal.managers.communication.GridIoPolicy.MANAGEMENT_POOL;
import static org.apache.ignite.internal.managers.communication.GridIoPolicy.MARSH_CACHE_POOL;
@@ -575,7 +574,6 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
case UTILITY_CACHE_POOL:
case MARSH_CACHE_POOL:
case IGFS_POOL:
- case DATA_STREAMER_POOL:
{
if (msg.isOrdered())
processOrderedMessage(nodeId, msg, plc, msgC);
http://git-wip-us.apache.org/repos/asf/ignite/blob/4edcf126/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoPolicy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoPolicy.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoPolicy.java
index 71279d9..00590ba 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoPolicy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoPolicy.java
@@ -46,9 +46,6 @@ public class GridIoPolicy {
/** Marshaller cache execution pool. */
public static final byte IGFS_POOL = 7;
- /** Data streamer execution pool. */
- public static final byte DATA_STREAMER_POOL = 8;
-
/**
* Defines the range of reserved pools that are not available for plugins.
* @param key The key.
http://git-wip-us.apache.org/repos/asf/ignite/blob/4edcf126/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
index 4bd22c5..d388584 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
@@ -27,6 +27,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
+import java.util.concurrent.Executor;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.TimeUnit;
import org.apache.ignite.IgniteCheckedException;
@@ -969,7 +970,7 @@ public class GridClosureProcessor extends GridProcessorAdapter {
* @param plc Policy to choose executor pool.
* @return Future.
*/
- public <R> IgniteInternalFuture<R> callLocalSafe(Callable<R> c, byte plc) {
+ private <R> IgniteInternalFuture<R> callLocalSafe(Callable<R> c, byte plc) {
try {
return callLocal(c, plc);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4edcf126/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessor.java
index bd33f62..7663735 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessor.java
@@ -21,12 +21,10 @@ import java.util.Collection;
import java.util.UUID;
import java.util.concurrent.DelayQueue;
import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
import org.apache.ignite.internal.managers.communication.GridIoManager;
-import org.apache.ignite.internal.managers.communication.GridIoPolicy;
import org.apache.ignite.internal.managers.communication.GridMessageListener;
import org.apache.ignite.internal.managers.deployment.GridDeployment;
import org.apache.ignite.internal.processors.GridProcessorAdapter;
@@ -37,7 +35,6 @@ import org.apache.ignite.internal.util.typedef.CI1;
import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.internal.util.worker.GridWorker;
-import org.apache.ignite.lang.IgniteClosure;
import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.marshaller.Marshaller;
import org.apache.ignite.stream.StreamReceiver;
@@ -45,23 +42,12 @@ import org.apache.ignite.thread.IgniteThread;
import org.jetbrains.annotations.Nullable;
import static org.apache.ignite.internal.GridTopic.TOPIC_DATASTREAM;
+import static org.apache.ignite.internal.managers.communication.GridIoPolicy.PUBLIC_POOL;
/**
- * Data stream processor.
+ *
*/
public class DataStreamProcessor<K, V> extends GridProcessorAdapter {
- /** Data streamer separate pool feature major version. */
- private static final int DATA_STREAMER_POOL_MAJOR_VER = 1;
-
- /** Data streamer separate pool feature minor version. */
- private static final int DATA_STREAMER_POOL_MINOR_VER = 6;
-
- /** Data streamer separate pool feature maintenance version. */
- private static final int DATA_STREAMER_POOL_MAINTENANCE_VER = 10;
-
- /** Default pool for data streamer messages processing. */
- public static final byte DFLT_POLICY = GridIoPolicy.PUBLIC_POOL;
-
/** Loaders map (access is not supposed to be highly concurrent). */
private Collection<DataStreamerImpl> ldrs = new GridConcurrentHashSet<>();
@@ -232,15 +218,13 @@ public class DataStreamProcessor<K, V> extends GridProcessorAdapter {
IgniteInternalFuture<?> fut = ctx.cache().context().exchange().affinityReadyFuture(rmtAffVer);
if (fut != null && !fut.isDone()) {
- final byte plc = threadIoPolicy();
-
fut.listen(new CI1<IgniteInternalFuture<?>>() {
@Override public void apply(IgniteInternalFuture<?> t) {
ctx.closure().runLocalSafe(new Runnable() {
@Override public void run() {
processRequest(nodeId, req);
}
- }, plc);
+ }, false);
}
});
@@ -356,7 +340,12 @@ public class DataStreamProcessor<K, V> extends GridProcessorAdapter {
DataStreamerResponse res = new DataStreamerResponse(reqId, errBytes, forceLocDep);
try {
- ctx.io().send(nodeId, resTopic, res, threadIoPolicy());
+ Byte plc = GridIoManager.currentPolicy();
+
+ if (plc == null)
+ plc = PUBLIC_POOL;
+
+ ctx.io().send(nodeId, resTopic, res, plc);
}
catch (IgniteCheckedException e) {
if (ctx.discovery().alive(nodeId))
@@ -366,59 +355,6 @@ public class DataStreamProcessor<K, V> extends GridProcessorAdapter {
}
}
- /**
- * Get IO policy.
- *
- * @return IO policy.
- */
- private static byte threadIoPolicy() {
- Byte plc = GridIoManager.currentPolicy();
-
- if (plc == null)
- plc = DFLT_POLICY;
-
- return plc;
- }
-
- /**
- * Get IO policy for particular node.
- *
- * @param node Node.
- * @return Policy.
- */
- public static byte ioPolicy(ClusterNode node) {
- assert node != null;
-
- if (node.isLocal() || node.version().greaterThanEqual(
- DATA_STREAMER_POOL_MAJOR_VER,
- DATA_STREAMER_POOL_MINOR_VER,
- DATA_STREAMER_POOL_MAINTENANCE_VER))
- return GridIoPolicy.DATA_STREAMER_POOL;
- else
- return DFLT_POLICY;
- }
-
- /**
- * Get IO policy for particular node with provided resolver.
- *
- * @param rslvr Resolver.
- * @param node Node.
- * @return IO policy.
- */
- public static byte ioPolicy(@Nullable IgniteClosure<ClusterNode, Byte> rslvr, ClusterNode node) {
- assert node != null;
-
- Byte res = null;
-
- if (rslvr != null)
- res = rslvr.apply(node);
-
- if (res == null)
- res = ioPolicy(node);
-
- return res;
- }
-
/** {@inheritDoc} */
@Override public void printMemoryStats() {
X.println(">>>");
http://git-wip-us.apache.org/repos/asf/ignite/blob/4edcf126/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
index 46f6380..c2f226c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
@@ -39,6 +39,7 @@ import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
import javax.cache.CacheException;
import javax.cache.expiry.ExpiryPolicy;
+
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
@@ -59,6 +60,7 @@ import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
import org.apache.ignite.internal.cluster.ClusterTopologyServerNotFoundException;
+import org.apache.ignite.internal.managers.communication.GridIoPolicy;
import org.apache.ignite.internal.managers.communication.GridMessageListener;
import org.apache.ignite.internal.managers.deployment.GridDeployment;
import org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener;
@@ -104,12 +106,16 @@ import org.jsr166.ConcurrentHashMap8;
import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
import static org.apache.ignite.internal.GridTopic.TOPIC_DATASTREAM;
+import static org.apache.ignite.internal.managers.communication.GridIoPolicy.PUBLIC_POOL;
/**
* Data streamer implementation.
*/
@SuppressWarnings("unchecked")
public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed {
+ /** Default policy reoslver. */
+ private static final DefaultIoPolicyResolver DFLT_IO_PLC_RSLVR = new DefaultIoPolicyResolver();
+
/** Isolated receiver. */
private static final StreamReceiver ISOLATED_UPDATER = new IsolatedUpdater();
@@ -120,7 +126,7 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
private byte[] updaterBytes;
/** IO policy resovler for data load request. */
- private IgniteClosure<ClusterNode, Byte> ioPlcRslvr;
+ private IgniteClosure<ClusterNode, Byte> ioPlcRslvr = DFLT_IO_PLC_RSLVR;
/** Max remap count before issuing an error. */
private static final int DFLT_MAX_REMAP_CNT = 32;
@@ -1307,12 +1313,14 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
IgniteInternalFuture<Object> fut;
- byte plc = DataStreamProcessor.ioPolicy(ioPlcRslvr, node);
+ Byte plc = ioPlcRslvr.apply(node);
+
+ if (plc == null)
+ plc = PUBLIC_POOL;
- if (isLocNode) {
+ if (isLocNode && plc == GridIoPolicy.PUBLIC_POOL) {
fut = ctx.closure().callLocalSafe(
- new DataStreamerUpdateJob(ctx, log, cacheName, entries, false, skipStore, keepBinary, rcvr),
- plc);
+ new DataStreamerUpdateJob(ctx, log, cacheName, entries, false, skipStore, keepBinary, rcvr), false);
locFuts.add(fut);
@@ -1676,6 +1684,19 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
}
/**
+ * Default IO policy resolver.
+ */
+ private static class DefaultIoPolicyResolver implements IgniteClosure<ClusterNode, Byte> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** {@inheritDoc} */
+ @Override public Byte apply(ClusterNode gridNode) {
+ return PUBLIC_POOL;
+ }
+ }
+
+ /**
* Key object wrapper. Using identity equals prevents slow down in case of hash code collision.
*/
private static class KeyCacheObjectWrapper {
http://git-wip-us.apache.org/repos/asf/ignite/blob/4edcf126/modules/core/src/main/java/org/apache/ignite/internal/processors/pool/PoolProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/pool/PoolProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/pool/PoolProcessor.java
index 5d38e16..41e805e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/pool/PoolProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/pool/PoolProcessor.java
@@ -123,9 +123,6 @@ public class PoolProcessor extends GridProcessorAdapter {
return ctx.getIgfsExecutorService();
- case GridIoPolicy.DATA_STREAMER_POOL:
- return ctx.getDataStreamerExecutorService();
-
default: {
if (plc < 0)
throw new IgniteCheckedException("Policy cannot be negative: " + plc);
http://git-wip-us.apache.org/repos/asf/ignite/blob/4edcf126/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorSelfTest.java
index 401b09c..9fedc35 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorSelfTest.java
@@ -33,7 +33,6 @@ import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteDataStreamer;
-import org.apache.ignite.IgniteException;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.CachePeekMode;
import org.apache.ignite.cache.affinity.Affinity;
@@ -50,7 +49,6 @@ import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter;
-import org.apache.ignite.internal.util.lang.GridAbsPredicate;
import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteClosure;
@@ -61,7 +59,6 @@ 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;
import org.apache.ignite.stream.StreamReceiver;
-import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.jetbrains.annotations.Nullable;
@@ -952,100 +949,6 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
}
/**
- * @throws Exception If failed.
- */
- public void testLocalDataStreamerDedicatedThreadPool() throws Exception {
- try {
- useCache = true;
-
- Ignite ignite = startGrid(1);
-
- final IgniteCache<String, String> cache = ignite.cache(null);
-
- IgniteDataStreamer<String, String> ldr = ignite.dataStreamer(null);
- try {
- ldr.receiver(new StreamReceiver<String, String>() {
- @Override public void receive(IgniteCache<String, String> cache,
- Collection<Map.Entry<String, String>> entries) throws IgniteException {
- String threadName = Thread.currentThread().getName();
-
- cache.put("key", threadName);
- }
- });
- ldr.addData("key", "value");
-
- ldr.tryFlush();
-
- GridTestUtils.waitForCondition(new GridAbsPredicate() {
- @Override public boolean apply() {
- return cache.get("key") != null;
- }
- }, 3_000);
- }
- finally {
- ldr.close(true);
- }
-
- assertNotNull(cache.get("key"));
-
- assertTrue(cache.get("key").startsWith("data-streamer"));
-
- }
- finally {
- stopAllGrids();
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testRemoteDataStreamerDedicatedThreadPool() throws Exception {
- try {
- useCache = true;
-
- Ignite ignite = startGrid(1);
-
- useCache = false;
-
- Ignite client = startGrid(0);
-
- final IgniteCache<String, String> cache = ignite.cache(null);
-
- IgniteDataStreamer<String, String> ldr = client.dataStreamer(null);
- try {
- ldr.receiver(new StreamReceiver<String, String>() {
- @Override public void receive(IgniteCache<String, String> cache,
- Collection<Map.Entry<String, String>> entries) throws IgniteException {
- String threadName = Thread.currentThread().getName();
-
- cache.put("key", threadName);
- }
- });
-
- ldr.addData("key", "value");
-
- ldr.tryFlush();
-
- GridTestUtils.waitForCondition(new GridAbsPredicate() {
- @Override public boolean apply() {
- return cache.get("key") != null;
- }
- }, 3_000);
- }
- finally {
- ldr.close(true);
- }
-
- assertNotNull(cache.get("key"));
-
- assertTrue(cache.get("key").startsWith("data-streamer"));
- }
- finally {
- stopAllGrids();
- }
- }
-
- /**
*
*/
public static class TestObject {
http://git-wip-us.apache.org/repos/asf/ignite/blob/4edcf126/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridTestKernalContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridTestKernalContext.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridTestKernalContext.java
index 1d72d46..cba67e0 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridTestKernalContext.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridTestKernalContext.java
@@ -62,7 +62,6 @@ public class GridTestKernalContext extends GridKernalContextImpl {
null,
null,
null,
- null,
U.allPluginProviders());
GridTestUtils.setFieldValue(grid(), "cfg", config());
@@ -96,6 +95,11 @@ public class GridTestKernalContext extends GridKernalContextImpl {
}
}
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridTestKernalContext.class, this, super.toString());
+ }
+
/**
* Sets system executor service.
*
@@ -105,6 +109,7 @@ public class GridTestKernalContext extends GridKernalContextImpl {
this.sysExecSvc = sysExecSvc;
}
+
/**
* Sets executor service.
*
@@ -113,9 +118,4 @@ public class GridTestKernalContext extends GridKernalContextImpl {
public void setExecutorService(ExecutorService execSvc){
this.execSvc = execSvc;
}
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(GridTestKernalContext.class, this, super.toString());
- }
}
[03/20] ignite git commit: IGNITE-4054: Hadoop: added map-reduce plan
debug output.
Posted by sb...@apache.org.
IGNITE-4054: Hadoop: added map-reduce plan debug output.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/43ac3f5d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/43ac3f5d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/43ac3f5d
Branch: refs/heads/ignite-4111
Commit: 43ac3f5d5e8ab664e07f26d99be34f284f7941dd
Parents: 80abd1b
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Mon Oct 17 11:26:12 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Mon Oct 17 11:26:12 2016 +0300
----------------------------------------------------------------------
.../hadoop/HadoopMapReducePlanner.java | 1 +
.../processors/hadoop/HadoopExternalSplit.java | 8 +++
.../processors/hadoop/HadoopSplitWrapper.java | 9 +++
.../hadoop/jobtracker/HadoopJobTracker.java | 61 ++++++++++++++++++++
4 files changed, 79 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/43ac3f5d/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopMapReducePlanner.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopMapReducePlanner.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopMapReducePlanner.java
index 185994f..0009c4a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopMapReducePlanner.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopMapReducePlanner.java
@@ -33,6 +33,7 @@ public interface HadoopMapReducePlanner {
* @param top Topology.
* @param oldPlan Old plan in case of partial failure.
* @return Map reduce plan.
+ * @throws IgniteCheckedException If an error occurs.
*/
public HadoopMapReducePlan preparePlan(HadoopJob job, Collection<ClusterNode> top,
@Nullable HadoopMapReducePlan oldPlan) throws IgniteCheckedException;
http://git-wip-us.apache.org/repos/asf/ignite/blob/43ac3f5d/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopExternalSplit.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopExternalSplit.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopExternalSplit.java
index bd767b3..a9b4532 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopExternalSplit.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopExternalSplit.java
@@ -17,10 +17,13 @@
package org.apache.ignite.internal.processors.hadoop;
+import org.apache.ignite.internal.util.typedef.internal.S;
+
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
+import java.util.Arrays;
/**
* Split serialized in external file.
@@ -85,4 +88,9 @@ public class HadoopExternalSplit extends HadoopInputSplit {
@Override public int hashCode() {
return (int)(off ^ (off >>> 32));
}
+
+ /** {@inheritDoc} */
+ public String toString() {
+ return S.toString(HadoopExternalSplit.class, this, "hosts", Arrays.toString(hosts));
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/43ac3f5d/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopSplitWrapper.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopSplitWrapper.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopSplitWrapper.java
index 511aa5a..fb6d0f3 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopSplitWrapper.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopSplitWrapper.java
@@ -20,7 +20,10 @@ package org.apache.ignite.internal.processors.hadoop;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
+import java.util.Arrays;
+import org.apache.ignite.internal.util.tostring.GridToStringExclude;
+import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
/**
@@ -33,6 +36,7 @@ public class HadoopSplitWrapper extends HadoopInputSplit {
private static final long serialVersionUID = 0L;
/** Native hadoop input split. */
+ @GridToStringExclude
private byte[] bytes;
/** */
@@ -116,4 +120,9 @@ public class HadoopSplitWrapper extends HadoopInputSplit {
@Override public int hashCode() {
return id;
}
+
+ /** {@inheritDoc} */
+ public String toString() {
+ return S.toString(HadoopSplitWrapper.class, this, "hosts", Arrays.toString(hosts));
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/43ac3f5d/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/jobtracker/HadoopJobTracker.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/jobtracker/HadoopJobTracker.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/jobtracker/HadoopJobTracker.java
index bffb82b..36782bf 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/jobtracker/HadoopJobTracker.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/jobtracker/HadoopJobTracker.java
@@ -75,6 +75,7 @@ import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.SB;
import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.lang.IgniteInClosure;
import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentHashMap8;
@@ -313,6 +314,8 @@ public class HadoopJobTracker extends HadoopComponent {
HadoopMapReducePlan mrPlan = mrPlanner.preparePlan(job, ctx.nodes(), null);
+ logPlan(info, mrPlan);
+
HadoopJobMetadata meta = new HadoopJobMetadata(ctx.localNodeId(), jobId, info);
meta.mapReducePlan(mrPlan);
@@ -354,6 +357,64 @@ public class HadoopJobTracker extends HadoopComponent {
}
/**
+ * Log map-reduce plan if needed.
+ *
+ * @param info Job info.
+ * @param plan Plan.
+ */
+ @SuppressWarnings("StringConcatenationInsideStringBufferAppend")
+ private void logPlan(HadoopJobInfo info, HadoopMapReducePlan plan) {
+ if (log.isDebugEnabled()) {
+ Map<UUID, IgniteBiTuple<Collection<HadoopInputSplit>, int[]>> map = new HashMap<>();
+
+ for (UUID nodeId : plan.mapperNodeIds())
+ map.put(nodeId, new IgniteBiTuple<Collection<HadoopInputSplit>, int[]>(plan.mappers(nodeId), null));
+
+ for (UUID nodeId : plan.reducerNodeIds()) {
+ int[] reducers = plan.reducers(nodeId);
+
+ IgniteBiTuple<Collection<HadoopInputSplit>, int[]> entry = map.get(nodeId);
+
+ if (entry == null)
+ map.put(nodeId, new IgniteBiTuple<Collection<HadoopInputSplit>, int[]>(null, reducers));
+ else
+ entry.set2(reducers);
+ }
+
+ StringBuilder details = new StringBuilder("[");
+
+ boolean first = true;
+
+ for (Map.Entry<UUID, IgniteBiTuple<Collection<HadoopInputSplit>, int[]>> entry : map.entrySet()) {
+ if (first)
+ first = false;
+ else
+ details.append(", ");
+
+ UUID nodeId = entry.getKey();
+
+ Collection<HadoopInputSplit> mappers = entry.getValue().get1();
+
+ if (mappers == null)
+ mappers = Collections.emptyList();
+
+ int[] reducers = entry.getValue().get2();
+
+ if (reducers == null)
+ reducers = new int[0];
+
+ details.append("[nodeId=" + nodeId + ", mappers=" + mappers.size() + ", reducers=" + reducers.length +
+ ", mapperDetails=" + mappers + ", reducerDetails=" + Arrays.toString(reducers) + ']');
+ }
+
+ details.append(']');
+
+ log.debug("Prepared map-reduce plan [jobName=" + info.jobName() + ", mappers=" + plan.mappers() +
+ ", reducers=" + plan.reducers() + ", details=" + details + ']');
+ }
+ }
+
+ /**
* Convert Hadoop job metadata to job status.
*
* @param meta Metadata.
[05/20] ignite git commit: Re-generated GridQueryFailResponse.
Posted by sb...@apache.org.
Re-generated GridQueryFailResponse.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/59de231c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/59de231c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/59de231c
Branch: refs/heads/ignite-4111
Commit: 59de231c0d0dce56b0cf5c386b19a2880d9c0603
Parents: d3f042b
Author: sboikov <sb...@gridgain.com>
Authored: Mon Oct 17 16:31:35 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Oct 17 16:31:35 2016 +0300
----------------------------------------------------------------------
.../query/h2/twostep/messages/GridQueryFailResponse.java | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/59de231c/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryFailResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryFailResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryFailResponse.java
index 0baf6ea..261241e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryFailResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/messages/GridQueryFailResponse.java
@@ -113,13 +113,13 @@ public class GridQueryFailResponse implements Message {
writer.incrementState();
case 1:
- if (!writer.writeLong("qryReqId", qryReqId))
+ if (!writer.writeByte("failCode", failCode))
return false;
writer.incrementState();
case 2:
- if (!writer.writeByte("failCode", failCode))
+ if (!writer.writeLong("qryReqId", qryReqId))
return false;
writer.incrementState();
@@ -146,7 +146,7 @@ public class GridQueryFailResponse implements Message {
reader.incrementState();
case 1:
- qryReqId = reader.readLong("qryReqId");
+ failCode = reader.readByte("failCode");
if (!reader.isLastRead())
return false;
@@ -154,7 +154,7 @@ public class GridQueryFailResponse implements Message {
reader.incrementState();
case 2:
- failCode = reader.readByte("failCode");
+ qryReqId = reader.readLong("qryReqId");
if (!reader.isLastRead())
return false;
@@ -175,4 +175,4 @@ public class GridQueryFailResponse implements Message {
@Override public byte fieldsCount() {
return 3;
}
-}
\ No newline at end of file
+}
[06/20] ignite git commit: GG-11360 Fix java8 compilation.
Posted by sb...@apache.org.
GG-11360 Fix java8 compilation.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/717e91fe
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/717e91fe
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/717e91fe
Branch: refs/heads/ignite-4111
Commit: 717e91fed944082df35ecdc2e647de2ad3fca2c7
Parents: 59de231
Author: ascherbakoff <al...@gmail.com>
Authored: Mon Oct 17 22:30:38 2016 +0300
Committer: ascherbakoff <al...@gmail.com>
Committed: Mon Oct 17 22:30:38 2016 +0300
----------------------------------------------------------------------
.../IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/717e91fe/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest.java
index f75c907..0f60db2 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest.java
@@ -235,7 +235,7 @@ public class IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest extends Gr
IgniteEx grid = grid(i);
// Validate everything was cleaned up.
- ConcurrentMap<UUID, ConcurrentMap<Long, ?>> map = U.field(((IgniteH2Indexing)U.field(U.field(
+ ConcurrentMap<UUID, ConcurrentMap<Long, ?>> map = U.field(((IgniteH2Indexing)U.field((Object)U.field(
grid.context(), "qryProc"), "idx")).mapQueryExecutor(), "qryRess");
String msg = "Map executor state is not cleared";
[18/20] ignite git commit: IGNITE-4062: fix BinaryObject.equals:
compare only bytes containing the fields' data (without header and footer).
This closes #1182.
Posted by sb...@apache.org.
IGNITE-4062: fix BinaryObject.equals: compare only bytes containing the fields' data (without header and footer). This closes #1182.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/44740465
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/44740465
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/44740465
Branch: refs/heads/ignite-4111
Commit: 44740465677c39068dc813dabd464e60f09e5f49
Parents: ec12a9d
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Wed Oct 26 18:00:11 2016 +0500
Committer: tledkov-gridgain <tl...@gridgain.com>
Committed: Wed Oct 26 18:00:11 2016 +0500
----------------------------------------------------------------------
.../ignite/internal/binary/BinaryContext.java | 2 +-
.../internal/binary/BinaryObjectExImpl.java | 57 ++-
.../internal/binary/BinaryObjectImpl.java | 23 ++
.../binary/BinaryObjectOffheapImpl.java | 24 +-
.../util/offheap/unsafe/GridUnsafeMemory.java | 33 +-
.../binary/BinaryMarshallerSelfTest.java | 343 ++++++++++++++++++-
6 files changed, 447 insertions(+), 35 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/44740465/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
index 0d66970..2ac8b7f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
@@ -501,7 +501,7 @@ public class BinaryContext {
}
/**
- * @return Intenal mpper used as default.
+ * @return Internal mapper used as default.
*/
public static BinaryInternalMapper defaultMapper() {
return DFLT_MAPPER;
http://git-wip-us.apache.org/repos/asf/ignite/blob/44740465/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectExImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectExImpl.java
index 063bd83..e15e770 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectExImpl.java
@@ -77,12 +77,26 @@ public abstract class BinaryObjectExImpl implements BinaryObjectEx {
}
/**
+ * Get offset of data begin.
+ *
+ * @return Field value.
+ */
+ @Nullable protected abstract int dataStartOffset();
+
+ /**
+ * Get offset of the footer begin.
+ *
+ * @return Field value.
+ */
+ @Nullable protected abstract int footerStartOffset();
+
+ /**
* Get field by offset.
*
- * @param fieldOffset Field offset.
+ * @param order Field order.
* @return Field value.
*/
- @Nullable protected abstract <F> F fieldByOrder(int fieldOffset);
+ @Nullable protected abstract <F> F fieldByOrder(int order);
/**
* @param ctx Reader context.
@@ -126,20 +140,29 @@ public abstract class BinaryObjectExImpl implements BinaryObjectEx {
if (!(other instanceof BinaryObjectExImpl))
return false;
- BinaryObjectExImpl otherPo = (BinaryObjectExImpl)other;
+ BinaryObjectExImpl other0 = (BinaryObjectExImpl)other;
+
+ if (typeId() != other0.typeId())
+ return false;
+
+ int start = dataStartOffset();
+ int end = footerStartOffset();
+
+ int otherStart = other0.dataStartOffset();
+ int otherEnd = other0.footerStartOffset();
+
+ int len = end - start;
- if (length() != otherPo.length() || typeId() != otherPo.typeId())
+ if (len != otherEnd - otherStart)
return false;
if (hasArray()) {
- if (otherPo.hasArray()) {
- int len = length();
- int end = start() + len;
+ byte[] arr = array();
- byte[] arr = array();
- byte[] otherArr = otherPo.array();
+ if (other0.hasArray()) {
+ byte[] otherArr = other0.array();
- for (int i = start(), j = otherPo.start(); i < end; i++, j++) {
+ for (int i = start, j = otherStart; i < end; i++, j++) {
if (arr[i] != otherArr[j])
return false;
}
@@ -147,22 +170,20 @@ public abstract class BinaryObjectExImpl implements BinaryObjectEx {
return true;
}
else {
- assert otherPo.offheapAddress() > 0;
+ assert other0.offheapAddress() > 0;
- return GridUnsafeMemory.compare(otherPo.offheapAddress() + otherPo.start(), array());
+ return GridUnsafeMemory.compare(other0.offheapAddress() + otherStart, arr, start, len);
}
}
else {
assert offheapAddress() > 0;
- if (otherPo.hasArray())
- return GridUnsafeMemory.compare(offheapAddress() + start(), otherPo.array());
+ if (other0.hasArray())
+ return GridUnsafeMemory.compare(offheapAddress() + start, other0.array(), otherStart, len);
else {
- assert otherPo.offheapAddress() > 0;
+ assert other0.offheapAddress() > 0;
- return GridUnsafeMemory.compare(offheapAddress() + start(),
- otherPo.offheapAddress() + otherPo.start(),
- length());
+ return GridUnsafeMemory.compare(offheapAddress() + start, other0.offheapAddress() + otherStart, len);
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/44740465/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
index f37d7c2..54a7c08 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
@@ -296,6 +296,29 @@ public final class BinaryObjectImpl extends BinaryObjectExImpl implements Extern
}
/** {@inheritDoc} */
+ @Nullable @Override protected int dataStartOffset() {
+ int typeId = BinaryPrimitives.readInt(arr, start + GridBinaryMarshaller.TYPE_ID_POS);
+
+ if (typeId == GridBinaryMarshaller.UNREGISTERED_TYPE_ID) {
+ int len = BinaryPrimitives.readInt(arr, start + GridBinaryMarshaller.DFLT_HDR_LEN + 1);
+
+ return start + GridBinaryMarshaller.DFLT_HDR_LEN + len + 5;
+ }
+ else
+ return start + GridBinaryMarshaller.DFLT_HDR_LEN;
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override protected int footerStartOffset() {
+ short flags = BinaryPrimitives.readShort(arr, start + GridBinaryMarshaller.FLAGS_POS);
+
+ if (!BinaryUtils.hasSchema(flags))
+ return start + length();
+
+ return start + BinaryPrimitives.readInt(arr, start + GridBinaryMarshaller.SCHEMA_OR_RAW_OFF_POS);
+ }
+
+ /** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Nullable @Override protected <F> F fieldByOrder(int order) {
Object val;
http://git-wip-us.apache.org/repos/asf/ignite/blob/44740465/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectOffheapImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectOffheapImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectOffheapImpl.java
index 9cbbaa2..7550b19 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectOffheapImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectOffheapImpl.java
@@ -96,7 +96,7 @@ public class BinaryObjectOffheapImpl extends BinaryObjectExImpl implements Exter
if (typeId == GridBinaryMarshaller.UNREGISTERED_TYPE_ID) {
int off = start + GridBinaryMarshaller.DFLT_HDR_LEN;
- String clsName = BinaryUtils.doReadClassName(new BinaryOffheapInputStream(off, size));
+ String clsName = BinaryUtils.doReadClassName(new BinaryOffheapInputStream(ptr + off, size));
typeId = ctx.typeId(clsName);
}
@@ -174,6 +174,28 @@ public class BinaryObjectOffheapImpl extends BinaryObjectExImpl implements Exter
}
/** {@inheritDoc} */
+ @Nullable @Override protected int dataStartOffset() {
+ int typeId = BinaryPrimitives.readInt(ptr, start + GridBinaryMarshaller.TYPE_ID_POS);
+
+ if (typeId == GridBinaryMarshaller.UNREGISTERED_TYPE_ID) {
+ int len = BinaryPrimitives.readInt(ptr, start + GridBinaryMarshaller.DFLT_HDR_LEN + 1);
+
+ return start + GridBinaryMarshaller.DFLT_HDR_LEN + len + 5;
+ } else
+ return start + GridBinaryMarshaller.DFLT_HDR_LEN;
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override protected int footerStartOffset() {
+ short flags = BinaryPrimitives.readShort(ptr, start + GridBinaryMarshaller.FLAGS_POS);
+
+ if (!BinaryUtils.hasSchema(flags))
+ return start + length();
+
+ return start + BinaryPrimitives.readInt(ptr, start + GridBinaryMarshaller.SCHEMA_OR_RAW_OFF_POS);
+ }
+
+ /** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Nullable @Override protected <F> F fieldByOrder(int order) {
Object val;
http://git-wip-us.apache.org/repos/asf/ignite/blob/44740465/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafeMemory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafeMemory.java b/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafeMemory.java
index 87ba2f2..718e1a6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafeMemory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/offheap/unsafe/GridUnsafeMemory.java
@@ -153,7 +153,8 @@ public class GridUnsafeMemory {
* @param reserved If {@code false}, means that memory counter was reserved and size will not
* be added to counter.
* @param cnt Counter to account allocated memory.
- * @throws GridOffHeapOutOfMemoryException
+ * @throws GridOffHeapOutOfMemoryException In case of out of the off-heap memory.
+ * @return Pointer to the allocated memory.
*/
@SuppressWarnings("ErrorNotRethrown")
private long allocate0(long size, boolean init, boolean reserved,
@@ -507,20 +508,32 @@ public class GridUnsafeMemory {
* @return {@code True} if equals.
*/
public static boolean compare(long ptr, byte[] bytes) {
+ return compare(ptr, bytes, 0, bytes.length);
+ }
+
+ /**
+ * Compares memory.
+ *
+ * @param ptr Pointer.
+ * @param bytes Bytes to compare.
+ * @param bytesOff Offset in the bytes array.
+ * @param len Count of compared bytes.
+ * @return {@code True} if equals.
+ */
+ public static boolean compare(long ptr, byte[] bytes, int bytesOff, int len) {
+ assert bytesOff + len <= bytes.length : "Check compare bounds: [offset=" + bytesOff + ", len=" + len +
+ ", bytes.length=" + bytes.length + ']';
+
final int addrSize = GridUnsafe.ADDR_SIZE;
// Align reads to address size.
int off = (int)(ptr % addrSize);
int align = addrSize - off;
- int len = bytes.length;
-
if (align != addrSize) {
- for (int i = 0; i < align && i < len; i++) {
- if (GridUnsafe.getByte(ptr) != bytes[i])
+ for (int i = 0, tmpOff = bytesOff; i < align && i < len; i++, tmpOff++, ptr++) {
+ if (GridUnsafe.getByte(ptr) != bytes[tmpOff])
return false;
-
- ptr++;
}
}
else
@@ -542,7 +555,7 @@ public class GridUnsafeMemory {
int word = GridUnsafe.getInt(ptr);
- int comp = GridUnsafe.getInt(bytes, GridUnsafe.BYTE_ARR_OFF + step);
+ int comp = GridUnsafe.getInt(bytes, GridUnsafe.BYTE_ARR_OFF + step + bytesOff);
if (word != comp)
return false;
@@ -558,7 +571,7 @@ public class GridUnsafeMemory {
long word = GridUnsafe.getLong(ptr);
- long comp = GridUnsafe.getLong(bytes, GridUnsafe.BYTE_ARR_OFF + step);
+ long comp = GridUnsafe.getLong(bytes, GridUnsafe.BYTE_ARR_OFF + step + bytesOff);
if (word != comp)
return false;
@@ -572,7 +585,7 @@ public class GridUnsafeMemory {
if (left != 0) {
// Compare left overs byte by byte.
for (int i = 0; i < left; i++)
- if (GridUnsafe.getByte(ptr + i) != bytes[i + align + words * GridUnsafe.ADDR_SIZE])
+ if (GridUnsafe.getByte(ptr + i) != bytes[bytesOff + i + align + words * GridUnsafe.ADDR_SIZE])
return false;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/44740465/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java
index f415472..39a4d32 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryMarshallerSelfTest.java
@@ -842,8 +842,6 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest {
assertEquals(clazz, marshalUnmarshal(clazz));
}
-
-
/**
*
*/
@@ -2922,6 +2920,209 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest {
}
/**
+ * @throws Exception If failed.
+ */
+ public void testBinaryEquals() throws Exception {
+ Collection<String> excludedClasses = Arrays.asList(
+ ObjectRaw.class.getName(),
+ ObjectWithRaw.class.getName(),
+ Value.class.getName());
+
+ BinaryMarshaller m0 = binaryMarshaller(null, excludedClasses);
+ BinaryMarshaller m1 = binaryMarshaller();
+
+ Value obj = new Value(27);
+ ObjectWithRaw objectWithRaw = new ObjectWithRaw(27, 13);
+ ObjectRaw objectRaw = new ObjectRaw(27, 13);
+
+ Value objOther = new Value(26);
+ ObjectWithRaw objectWithRawOther = new ObjectWithRaw(26, 13);
+ ObjectRaw objectRawOther = new ObjectRaw(26, 13);
+
+ BinaryObjectImpl binObj0 = marshal(obj, m0);
+ BinaryObjectImpl binObj1 = marshal(obj, m1);
+ BinaryObjectImpl binObjWithRaw0 = marshal(objectWithRaw, m0);
+ BinaryObjectImpl binObjWithRaw1 = marshal(objectWithRaw, m1);
+ BinaryObjectImpl binObjRaw0 = marshal(objectRaw, m0);
+ BinaryObjectImpl binObjRaw1 = marshal(objectRaw, m1);
+
+ assertNotEquals(binObj0.array().length, binObj1.array().length);
+ assertNotEquals(binObjWithRaw0.array().length, binObjWithRaw1.array().length);
+ assertNotEquals(binObjRaw0.array().length, binObjRaw1.array().length);
+
+ checkEquals(binObj0, binObj1);
+
+ checkEquals(binObjWithRaw0, binObjWithRaw1);
+
+ checkEquals(binObjRaw0, binObjRaw1);
+
+ BinaryObjectOffheapImpl binObjOffheap0 = null;
+ BinaryObjectOffheapImpl binObjOffheap1 = null;
+ BinaryObjectOffheapImpl binObjWithRawOffheap0 = null;
+ BinaryObjectOffheapImpl binObjWithRawOffheap1 = null;
+ BinaryObjectOffheapImpl binObjRawOffheap0 = null;
+ BinaryObjectOffheapImpl binObjRawOffheap1 = null;
+
+ BinaryObjectImpl binObjOther0 = marshal(objOther, m0);
+ BinaryObjectImpl binObjOther1 = marshal(objOther, m1);
+ BinaryObjectImpl binObjWithRawOther0 = marshal(objectWithRawOther, m0);
+ BinaryObjectImpl binObjWithRawOther1 = marshal(objectWithRawOther, m1);
+ BinaryObjectImpl binObjRawOther0 = marshal(objectRawOther, m0);
+ BinaryObjectImpl binObjRawOther1 = marshal(objectRawOther, m1);
+
+ assertEquals(binObjOther0.length(), binObj0.length());
+ assertEquals(binObjOther1.length(), binObj1.length());
+ assertEquals(binObjWithRawOther0.length(), binObjWithRaw0.length());
+ assertEquals(binObjWithRawOther1.length(), binObjWithRaw1.length());
+ assertEquals(binObjRawOther0.length(), binObjRaw0.length());
+ assertEquals(binObjRawOther1.length(), binObjRaw1.length());
+
+ assertNotEquals(binObjOther0, binObj0);
+ assertNotEquals(binObjOther1, binObj1);
+ assertNotEquals(binObjWithRawOther0, binObjWithRaw0);
+ assertNotEquals(binObjWithRawOther1, binObjWithRaw1);
+ assertNotEquals(binObjRawOther0, binObjRaw0);
+ assertNotEquals(binObjRawOther1, binObjRaw1);
+
+ try {
+ binObjOffheap0 = marshalOffHeap(binObj0, m0);
+ binObjOffheap1 = marshalOffHeap(binObj1, m1);
+ binObjWithRawOffheap0 = marshalOffHeap(binObjWithRaw0, m0);
+ binObjWithRawOffheap1 = marshalOffHeap(binObjWithRaw1, m1);
+ binObjRawOffheap0 = marshalOffHeap(binObjRaw0, m0);
+ binObjRawOffheap1 = marshalOffHeap(binObjRaw1, m1);
+
+ checkEquals(binObj0, binObjOffheap0);
+ checkEquals(binObj1, binObjOffheap0);
+ checkEquals(binObj0, binObjOffheap1);
+ checkEquals(binObj1, binObjOffheap1);
+ checkEquals(binObjOffheap0, binObjOffheap1);
+
+ checkEquals(binObjWithRaw0, binObjWithRawOffheap0);
+ checkEquals(binObjWithRaw0, binObjWithRawOffheap1);
+ checkEquals(binObjWithRaw1, binObjWithRawOffheap0);
+ checkEquals(binObjWithRaw1, binObjWithRawOffheap1);
+ checkEquals(binObjWithRawOffheap0, binObjWithRawOffheap1);
+
+ checkEquals(binObjRaw0, binObjRawOffheap0);
+ checkEquals(binObjRaw1, binObjRawOffheap0);
+ checkEquals(binObjRaw0, binObjRawOffheap1);
+ checkEquals(binObjRaw1, binObjRawOffheap1);
+ checkEquals(binObjRawOffheap0, binObjRawOffheap1);
+ }
+ finally {
+ if (binObjOffheap0 != null) {
+ GridUnsafe.freeMemory(binObjOffheap0.offheapAddress());
+ binObjOffheap0 = null;
+ }
+
+ if (binObjOffheap1 != null) {
+ GridUnsafe.freeMemory(binObjOffheap1.offheapAddress());
+ binObjOffheap1 = null;
+ }
+
+ if (binObjWithRawOffheap0 != null) {
+ GridUnsafe.freeMemory(binObjWithRawOffheap0.offheapAddress());
+ binObjOffheap1 = null;
+ }
+
+ if (binObjWithRawOffheap1 != null) {
+ GridUnsafe.freeMemory(binObjWithRawOffheap1.offheapAddress());
+ binObjOffheap1 = null;
+ }
+
+ if (binObjRawOffheap0 != null) {
+ GridUnsafe.freeMemory(binObjRawOffheap0.offheapAddress());
+ binObjOffheap1 = null;
+ }
+
+ if (binObjRawOffheap1 != null) {
+ GridUnsafe.freeMemory(binObjRawOffheap1.offheapAddress());
+ binObjOffheap1 = null;
+ }
+ }
+ }
+
+ /**
+ * @param binObj0 Object #0.
+ * @param binObj1 Object #1.
+ */
+ private void checkEquals(Object binObj0, Object binObj1) {
+ assertEquals(binObj0, binObj1);
+ assertEquals(binObj1, binObj0);
+ assertEquals(binObj0, binObj0);
+ assertEquals(binObj1, binObj1);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testBinaryEqualsComplexObject() throws Exception {
+ List<String> excludedClasses = Arrays.asList(
+ TestClass0.class.getName(),
+ TestClass1.class.getName(),
+ TestClass2.class.getName());
+
+ BinaryMarshaller m0 = binaryMarshaller(null, excludedClasses);
+ BinaryMarshaller m1 = binaryMarshaller(null);
+
+ TestClass0 obj0 = new TestClass0();
+ TestClass1 obj1 = new TestClass1();
+ TestClass2 obj2 = new TestClass2();
+
+ BinaryObjectImpl binObj00 = marshal(obj0, m0);
+ BinaryObjectImpl binObj01 = marshal(obj1, m0);
+ BinaryObjectImpl binObj02 = marshal(obj2, m0);
+
+ // The length of array must be equal. Object are different only by the class.
+ assertEquals(binObj00.array().length, binObj01.array().length);
+ assertEquals(binObj00.array().length, binObj02.array().length);
+
+ BinaryObjectImpl binObj10 = marshal(obj0, m1);
+ BinaryObjectImpl binObj11 = marshal(obj1, m1);
+ BinaryObjectImpl binObj12 = marshal(obj2, m1);
+
+ // The length of array must be equal. Object are different only by the class.
+ assertEquals(binObj10.array().length, binObj11.array().length);
+ assertEquals(binObj10.array().length, binObj12.array().length);
+
+ assertNotEquals(binObj10.array().length, binObj00.array().length);
+
+ assertEquals(binObj00, binObj10);
+ assertEquals(binObj01, binObj11);
+ assertEquals(binObj02, binObj12);
+
+ assertNotEquals(binObj00, binObj01);
+ assertNotEquals(binObj00, binObj02);
+ assertNotEquals(binObj00, binObj11);
+ assertNotEquals(binObj00, binObj12);
+
+ assertNotEquals(binObj01, binObj00);
+ assertNotEquals(binObj01, binObj02);
+ assertNotEquals(binObj01, binObj10);
+ assertNotEquals(binObj01, binObj12);
+
+ assertNotEquals(binObj02, binObj00);
+ assertNotEquals(binObj02, binObj01);
+ assertNotEquals(binObj02, binObj00);
+ assertNotEquals(binObj02, binObj11);
+ }
+
+ /**
+ * @param obj Instance of the BinaryObjectImpl to offheap marshalling.
+ * @param marsh Binary marshaller.
+ * @return Instance of BinaryObjectOffheapImpl.
+ */
+ private BinaryObjectOffheapImpl marshalOffHeap(BinaryObjectImpl obj, BinaryMarshaller marsh) {
+ long ptr = copyOffheap(obj);
+
+ return new BinaryObjectOffheapImpl(binaryContext(marsh),
+ ptr,
+ 0,
+ obj.array().length);
+ }
+
+ /**
*
*/
private static interface SomeItf {
@@ -3331,7 +3532,7 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest {
/**
* @return Simple object.
*/
- private SimpleObject simpleObject() {
+ private static SimpleObject simpleObject() {
SimpleObject inner = new SimpleObject();
inner.b = 1;
@@ -4903,7 +5104,8 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest {
/**
*/
- private static class SingleHandleB {}
+ private static class SingleHandleB {
+ }
/**
*/
@@ -4918,4 +5120,135 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest {
this.cls = cls;
}
}
-}
+
+ /**
+ *
+ */
+ private static class TestClass0 {
+ /** */
+ private int intVal = 33;
+
+ /** */
+ private String strVal = "Test string value";
+
+ /** */
+ private SimpleObject obj = constSimpleObject();
+
+ /**
+ * @return Constant value of the SimpleObject.
+ */
+ public static SimpleObject constSimpleObject() {
+ SimpleObject obj = simpleObject();
+
+ obj.uuid = null;
+ obj.date = new Date(33);
+ obj.ts = new Timestamp(22);
+ obj.uuidArr = new UUID[] {null, null, null};
+ obj.dateArr = new Date[] {new Date(11111), new Date(22222), new Date(33333)};
+ obj.objArr = new Object[] {null, null, null};
+
+ obj.inner.uuid = null;
+ obj.inner.date = new Date(33);
+ obj.inner.ts = new Timestamp(22);
+ obj.inner.uuidArr = new UUID[] {null, null, null};
+ obj.inner.dateArr = new Date[] {new Date(11111), new Date(22222), new Date(33333)};
+ obj.inner.objArr = new Object[] {null, null, null};
+
+ return obj;
+ }
+ }
+
+ /**
+ *
+ */
+ private static class TestClass1 {
+ /** */
+ private int intVal = 33;
+
+ /** */
+ private String strVal = "Test string value";
+
+ /** */
+ private SimpleObject obj = TestClass0.constSimpleObject();
+ }
+
+ /**
+ *
+ */
+ private static class TestClass2 extends TestClass0 {
+ }
+
+ /** */
+ private static class ObjectWithRaw implements Binarylizable {
+ /** */
+ private int val;
+
+ /** */
+ private int rawVal;
+
+ /**
+ *
+ */
+ public ObjectWithRaw() {
+ }
+
+ /**
+ * @param val Value.
+ * @param rawVal Raw value.
+ */
+ public ObjectWithRaw(int val, int rawVal) {
+ this.val = val;
+ this.rawVal = rawVal;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
+ writer.writeInt("val", val);
+
+ writer.rawWriter().writeInt(rawVal);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readBinary(BinaryReader reader) throws BinaryObjectException {
+ val = reader.readInt("val");
+
+ rawVal = reader.rawReader().readInt();
+ }
+ }
+
+ /** */
+ private static class ObjectRaw implements Binarylizable {
+ /** */
+ private int val0;
+
+ /** */
+ private int val1;
+
+ /**
+ *
+ */
+ public ObjectRaw() {
+ }
+
+ /**
+ * @param val0 Value.
+ * @param val1 Raw value.
+ */
+ public ObjectRaw(int val0, int val1) {
+ this.val0 = val0;
+ this.val1 = val1;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
+ writer.rawWriter().writeInt(val0);
+ writer.rawWriter().writeInt(val1);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readBinary(BinaryReader reader) throws BinaryObjectException {
+ val0 = reader.rawReader().readInt();
+ val1 = reader.rawReader().readInt();
+ }
+ }
+}
\ No newline at end of file
[10/20] ignite git commit: Merge remote-tracking branch
'community/ignite-1.6.10' into ignite-1.6.10
Posted by sb...@apache.org.
Merge remote-tracking branch 'community/ignite-1.6.10' into ignite-1.6.10
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e6430bdf
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e6430bdf
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e6430bdf
Branch: refs/heads/ignite-4111
Commit: e6430bdf14e457e7497bf6e84013747f06f71fc3
Parents: ccae52c 4edcf12
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Tue Oct 18 15:01:41 2016 +0500
Committer: tledkov-gridgain <tl...@gridgain.com>
Committed: Tue Oct 18 15:01:41 2016 +0500
----------------------------------------------------------------------
.../configuration/IgniteConfiguration.java | 31 -------
.../ignite/internal/GridKernalContext.java | 7 --
.../ignite/internal/GridKernalContextImpl.java | 12 ---
.../apache/ignite/internal/IgniteKernal.java | 3 -
.../org/apache/ignite/internal/IgnitionEx.java | 20 +---
.../managers/communication/GridIoManager.java | 2 -
.../managers/communication/GridIoPolicy.java | 3 -
.../closure/GridClosureProcessor.java | 3 +-
.../datastreamer/DataStreamProcessor.java | 82 ++---------------
.../datastreamer/DataStreamerImpl.java | 31 ++++++-
.../internal/processors/pool/PoolProcessor.java | 3 -
.../twostep/messages/GridQueryFailResponse.java | 10 +-
.../DataStreamProcessorSelfTest.java | 97 --------------------
.../junits/GridTestKernalContext.java | 12 +--
...butedQueryStopOnCancelOrTimeoutSelfTest.java | 2 +-
modules/platforms/cpp/common/Makefile.am | 4 +-
.../common/include/ignite/common/concurrent.h | 5 +-
.../cpp/common/include/ignite/ignite_error.h | 4 +-
.../platforms/cpp/common/src/ignite_error.cpp | 4 +-
modules/platforms/cpp/core-test/Makefile.am | 10 +-
.../cpp/core-test/src/decimal_test.cpp | 2 +-
.../cpp/core-test/src/interop_memory_test.cpp | 5 +-
modules/platforms/cpp/jni/src/java.cpp | 2 +-
modules/platforms/cpp/odbc-test/Makefile.am | 4 +-
.../cpp/odbc-test/src/queries_test.cpp | 4 +-
.../cpp/odbc/src/config/configuration.cpp | 2 +-
26 files changed, 77 insertions(+), 287 deletions(-)
----------------------------------------------------------------------