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 2017/09/15 08:08:30 UTC
[01/25] ignite git commit: IGNITE-6345: Wrong message about cluster
activation. - Fixes #2640.
Repository: ignite
Updated Branches:
refs/heads/ignite-6149 1a7e10ac5 -> 393f80246
IGNITE-6345: Wrong message about cluster activation. - Fixes #2640.
Signed-off-by: shroman <rs...@yahoo.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/581d91b3
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/581d91b3
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/581d91b3
Branch: refs/heads/ignite-6149
Commit: 581d91b3f029ee75f3b5803f5dae3496399bb164
Parents: cc3ab69
Author: shroman <rs...@yahoo.com>
Authored: Wed Sep 13 17:46:15 2017 +0900
Committer: shroman <rs...@yahoo.com>
Committed: Wed Sep 13 17:46:15 2017 +0900
----------------------------------------------------------------------
.../src/main/java/org/apache/ignite/internal/IgniteKernal.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/581d91b3/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 a3b8651..f4b180c 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
@@ -3764,7 +3764,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
if (!ctx.state().publicApiActiveState()) {
throw new IgniteException("Can not perform the operation because the cluster is inactive. Note, that " +
"the cluster is considered inactive by default if Ignite Persistent Store is used to let all the nodes " +
- "join the cluster. To activate the cluster call Ignite.activate(true).");
+ "join the cluster. To activate the cluster call Ignite.active(true).");
}
}
[12/25] ignite git commit: IGNITE-5896: Thin client: base server-side
infrastructure.
Posted by sb...@apache.org.
IGNITE-5896: Thin client: base server-side infrastructure.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4af18327
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4af18327
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4af18327
Branch: refs/heads/ignite-6149
Commit: 4af18327ba41350a46e3a852a32f7a56091d3eec
Parents: 948f31c
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Wed Sep 13 14:28:38 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed Sep 13 14:28:38 2017 +0300
----------------------------------------------------------------------
.../processors/odbc/SqlListenerNioListener.java | 13 ++-
.../client/ClientConnectionContext.java | 76 +++++++++++++++++
.../platform/client/ClientMessageParser.java | 90 ++++++++++++++++++++
.../platform/client/ClientRequestHandler.java | 58 +++++++++++++
4 files changed, 235 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/4af18327/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java
index 98cd8ea..339c8c1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java
@@ -28,6 +28,9 @@ import org.apache.ignite.internal.binary.streams.BinaryHeapOutputStream;
import org.apache.ignite.internal.binary.streams.BinaryInputStream;
import org.apache.ignite.internal.processors.odbc.jdbc.JdbcConnectionContext;
import org.apache.ignite.internal.processors.odbc.odbc.OdbcConnectionContext;
+import org.apache.ignite.internal.processors.platform.client.ClientConnectionContext;
+import org.apache.ignite.internal.processors.platform.client.ClientMessageParser;
+import org.apache.ignite.internal.processors.platform.client.ClientRequestHandler;
import org.apache.ignite.internal.util.GridSpinBusyLock;
import org.apache.ignite.internal.util.nio.GridNioServerListenerAdapter;
import org.apache.ignite.internal.util.nio.GridNioSession;
@@ -38,12 +41,15 @@ import org.jetbrains.annotations.Nullable;
* SQL message listener.
*/
public class SqlListenerNioListener extends GridNioServerListenerAdapter<byte[]> {
- /** The value corresponds to ODBC driver of the parser field of the handshake request. */
+ /** ODBC driver handshake code. */
public static final byte ODBC_CLIENT = 0;
- /** The value corresponds to JDBC driver of the parser field of the handshake request. */
+ /** JDBC driver handshake code. */
public static final byte JDBC_CLIENT = 1;
+ /** Thin client handshake code. */
+ public static final byte THIN_CLIENT = 2;
+
/** Connection-related metadata key. */
private static final int CONN_CTX_META_KEY = GridNioSessionMetaKey.nextUniqueKey();
@@ -227,6 +233,9 @@ public class SqlListenerNioListener extends GridNioServerListenerAdapter<byte[]>
case JDBC_CLIENT:
return new JdbcConnectionContext(ctx, busyLock, maxCursors);
+ case THIN_CLIENT:
+ return new ClientConnectionContext(ctx);
+
default:
throw new IgniteException("Unknown client type: " + clientType);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4af18327/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientConnectionContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientConnectionContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientConnectionContext.java
new file mode 100644
index 0000000..c6c2c3b
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientConnectionContext.java
@@ -0,0 +1,76 @@
+/*
+ * 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.platform.client;
+
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.binary.BinaryReaderExImpl;
+import org.apache.ignite.internal.processors.odbc.SqlListenerConnectionContext;
+import org.apache.ignite.internal.processors.odbc.SqlListenerMessageParser;
+import org.apache.ignite.internal.processors.odbc.SqlListenerProtocolVersion;
+import org.apache.ignite.internal.processors.odbc.SqlListenerRequestHandler;
+
+/**
+ * Thin Client connection context.
+ */
+public class ClientConnectionContext implements SqlListenerConnectionContext {
+ /** Version 1.0.0. */
+ private static final SqlListenerProtocolVersion VER_1_0_0 = SqlListenerProtocolVersion.create(1, 0, 0);
+
+ /** Message parser. */
+ private final ClientMessageParser parser;
+
+ /** Request handler. */
+ private final ClientRequestHandler handler;
+
+ /**
+ * Ctor.
+ *
+ * @param ctx Kernal context.
+ */
+ public ClientConnectionContext(GridKernalContext ctx) {
+ assert ctx != null;
+
+ parser = new ClientMessageParser(ctx);
+ handler = new ClientRequestHandler(ctx);
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isVersionSupported(SqlListenerProtocolVersion ver) {
+ return VER_1_0_0.equals(ver);
+ }
+
+ /** {@inheritDoc} */
+ @Override public SqlListenerProtocolVersion currentVersion() {
+ return VER_1_0_0;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void initializeFromHandshake(SqlListenerProtocolVersion ver, BinaryReaderExImpl reader) {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public SqlListenerRequestHandler handler() {
+ return handler;
+ }
+
+ /** {@inheritDoc} */
+ @Override public SqlListenerMessageParser parser() {
+ return parser;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4af18327/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientMessageParser.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientMessageParser.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientMessageParser.java
new file mode 100644
index 0000000..3626de8
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientMessageParser.java
@@ -0,0 +1,90 @@
+/*
+ * 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.platform.client;
+
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.binary.BinaryRawWriter;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.binary.BinaryRawReaderEx;
+import org.apache.ignite.internal.binary.GridBinaryMarshaller;
+import org.apache.ignite.internal.binary.streams.BinaryHeapInputStream;
+import org.apache.ignite.internal.binary.streams.BinaryHeapOutputStream;
+import org.apache.ignite.internal.binary.streams.BinaryInputStream;
+import org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl;
+import org.apache.ignite.internal.processors.odbc.SqlListenerMessageParser;
+import org.apache.ignite.internal.processors.odbc.SqlListenerRequest;
+import org.apache.ignite.internal.processors.odbc.SqlListenerResponse;
+import org.apache.ignite.internal.processors.platform.client.cache.ClientCacheGetRequest;
+import org.apache.ignite.internal.processors.platform.client.cache.ClientCachePutRequest;
+
+/**
+ * Thin client message parser.
+ */
+public class ClientMessageParser implements SqlListenerMessageParser {
+ /** */
+ private static final short OP_CACHE_GET = 1;
+
+ /** */
+ private static final short OP_CACHE_PUT = 4;
+
+ /** Marshaller. */
+ private final GridBinaryMarshaller marsh;
+
+ /**
+ * Ctor.
+ *
+ * @param ctx Kernal context.
+ */
+ ClientMessageParser(GridKernalContext ctx) {
+ assert ctx != null;
+
+ CacheObjectBinaryProcessorImpl cacheObjProc = (CacheObjectBinaryProcessorImpl)ctx.cacheObjects();
+ marsh = cacheObjProc.marshaller();
+ }
+
+ /** {@inheritDoc} */
+ @Override public SqlListenerRequest decode(byte[] msg) {
+ assert msg != null;
+
+ BinaryInputStream inStream = new BinaryHeapInputStream(msg);
+ BinaryRawReaderEx reader = marsh.reader(inStream);
+
+ short opCode = reader.readShort();
+
+ switch (opCode) {
+ case OP_CACHE_GET:
+ return new ClientCacheGetRequest(reader);
+
+ case OP_CACHE_PUT:
+ return new ClientCachePutRequest(reader);
+ }
+
+ throw new IgniteException("Invalid operation: " + opCode);
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte[] encode(SqlListenerResponse resp) {
+ BinaryHeapOutputStream outStream = new BinaryHeapOutputStream(32);
+
+ BinaryRawWriter writer = marsh.writer(outStream);
+
+ ((ClientResponse)resp).encode(writer);
+
+ return outStream.array();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4af18327/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientRequestHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientRequestHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientRequestHandler.java
new file mode 100644
index 0000000..30fb1a8
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientRequestHandler.java
@@ -0,0 +1,58 @@
+/*
+ * 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.platform.client;
+
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.binary.BinaryWriterExImpl;
+import org.apache.ignite.internal.processors.odbc.SqlListenerRequest;
+import org.apache.ignite.internal.processors.odbc.SqlListenerRequestHandler;
+import org.apache.ignite.internal.processors.odbc.SqlListenerResponse;
+
+/**
+ * Thin client request handler.
+ */
+public class ClientRequestHandler implements SqlListenerRequestHandler {
+ /** Kernal context. */
+ private final GridKernalContext ctx;
+
+ /**
+ * Constructor.
+ *
+ * @param ctx Kernal context.
+ */
+ ClientRequestHandler(GridKernalContext ctx) {
+ assert ctx != null;
+
+ this.ctx = ctx;
+ }
+
+ /** {@inheritDoc} */
+ @Override public SqlListenerResponse handle(SqlListenerRequest req) {
+ return ((ClientRequest)req).process(ctx);
+ }
+
+ /** {@inheritDoc} */
+ @Override public SqlListenerResponse handleException(Exception e) {
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeHandshake(BinaryWriterExImpl writer) {
+ writer.writeBoolean(true);
+ }
+}
\ No newline at end of file
[11/25] ignite git commit: Merge remote-tracking branch
'origin/master'
Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/master'
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/948f31c0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/948f31c0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/948f31c0
Branch: refs/heads/ignite-6149
Commit: 948f31c0a7673dc468c9e404ca34c52668a5dd64
Parents: 1f43e07 40a9cc1
Author: devozerov <vo...@gridgain.com>
Authored: Wed Sep 13 14:13:05 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed Sep 13 14:13:05 2017 +0300
----------------------------------------------------------------------
modules/web-console/backend/app/agentsHandler.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
[20/25] ignite git commit: IGNITE-6314: Fixed test failures in
H2DynamicColumnsAbstractBasicSelfTest for simple name mapper. This closes
#2639.
Posted by sb...@apache.org.
IGNITE-6314: Fixed test failures in H2DynamicColumnsAbstractBasicSelfTest for simple name mapper. This closes #2639.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/39b93fa6
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/39b93fa6
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/39b93fa6
Branch: refs/heads/ignite-6149
Commit: 39b93fa6bc256a099daf2c34f339eb5b2a311ffb
Parents: 2776cb6
Author: Alexander Paschenko <al...@gmail.com>
Authored: Thu Sep 14 12:39:33 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Thu Sep 14 12:39:33 2017 +0300
----------------------------------------------------------------------
.../H2DynamicColumnsAbstractBasicSelfTest.java | 23 +++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/39b93fa6/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicColumnsAbstractBasicSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicColumnsAbstractBasicSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicColumnsAbstractBasicSelfTest.java
index 6455cad..39b26a8 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicColumnsAbstractBasicSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicColumnsAbstractBasicSelfTest.java
@@ -30,6 +30,9 @@ import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.query.QueryField;
import org.apache.ignite.internal.processors.query.QueryUtils;
+import org.apache.ignite.testframework.config.GridTestProperties;
+
+import static org.apache.ignite.testframework.config.GridTestProperties.BINARY_MARSHALLER_USE_SIMPLE_NAME_MAPPER;
/**
* Test to check dynamic columns related features.
@@ -238,7 +241,7 @@ public abstract class H2DynamicColumnsAbstractBasicSelfTest extends DynamicColum
CacheConfiguration<Integer, City> ccfg = defaultCacheConfiguration().setName("City")
.setIndexedTypes(Integer.class, City.class);
- IgniteCache<Integer, City> cache = ignite(nodeIndex()).getOrCreateCache(ccfg);
+ IgniteCache<Integer, ?> cache = ignite(nodeIndex()).getOrCreateCache(ccfg);
run(cache, "ALTER TABLE \"City\".City ADD COLUMN population int");
@@ -256,11 +259,21 @@ public abstract class H2DynamicColumnsAbstractBasicSelfTest extends DynamicColum
assertEquals(Collections.singletonList(Arrays.asList(1, 1, "Washington", "DC", 2500000)), res);
- City city = cache.get(1);
+ if (!Boolean.valueOf(GridTestProperties.getProperty(BINARY_MARSHALLER_USE_SIMPLE_NAME_MAPPER))) {
+ City city = (City)cache.get(1);
+
+ assertEquals(1, city.id());
+ assertEquals("Washington", city.name());
+ assertEquals("DC", city.state());
+ }
+ else {
+ BinaryObject city = (BinaryObject)cache.withKeepBinary().get(1);
- assertEquals(1, city.id());
- assertEquals("Washington", city.name());
- assertEquals("DC", city.state());
+ assertEquals(1, city.field("id"));
+ assertEquals("Washington", city.field("name"));
+ assertEquals("DC", city.field("state"));
+ assertEquals(2500000, city.field("population"));
+ }
cache.destroy();
}
[25/25] ignite git commit: Merge remote-tracking branch
'remotes/origin/master' into ignite-6149
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-6149
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/393f8024
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/393f8024
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/393f8024
Branch: refs/heads/ignite-6149
Commit: 393f802465c8b68d5a5de59ed9107fe25ad23777
Parents: 1a7e10a 50c7002
Author: sboikov <sb...@gridgain.com>
Authored: Fri Sep 15 11:06:58 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Sep 15 11:06:58 2017 +0300
----------------------------------------------------------------------
.../configuration/CacheConfiguration.java | 2 +-
.../apache/ignite/internal/IgniteKernal.java | 5 +-
.../processors/cache/GridCacheAdapter.java | 87 ++++----
.../processors/cache/GridCacheProcessor.java | 2 +-
.../dht/preloader/GridDhtPartitionMap.java | 4 +-
.../odbc/SqlListenerConnectionContext.java | 6 +
.../processors/odbc/SqlListenerNioListener.java | 29 ++-
.../processors/odbc/SqlListenerRequest.java | 16 +-
.../processors/odbc/SqlListenerRequestNoId.java | 28 +++
.../odbc/jdbc/JdbcConnectionContext.java | 5 +
.../processors/odbc/jdbc/JdbcRequest.java | 4 +-
.../odbc/jdbc/JdbcRequestHandler.java | 20 +-
.../odbc/odbc/OdbcConnectionContext.java | 5 +
.../processors/odbc/odbc/OdbcRequest.java | 4 +-
.../odbc/odbc/OdbcRequestHandler.java | 18 ++
.../platform/PlatformContextImpl.java | 125 +-----------
.../platform/client/ClientBooleanResponse.java | 46 +++++
.../client/ClientConnectionContext.java | 81 ++++++++
.../platform/client/ClientMessageParser.java | 118 +++++++++++
.../platform/client/ClientObjectResponse.java | 46 +++++
.../platform/client/ClientRequest.java | 53 +++++
.../platform/client/ClientRequestHandler.java | 58 ++++++
.../platform/client/ClientResponse.java | 47 +++++
.../platform/client/ClientStringResponse.java | 47 +++++
.../binary/ClientBinaryTypeGetRequest.java | 50 +++++
.../binary/ClientBinaryTypeGetResponse.java | 51 +++++
.../binary/ClientBinaryTypeNameGetRequest.java | 61 ++++++
.../binary/ClientBinaryTypeNamePutRequest.java | 65 ++++++
.../binary/ClientBinaryTypePutRequest.java | 56 +++++
.../client/cache/ClientCacheGetRequest.java | 50 +++++
.../client/cache/ClientCachePutRequest.java | 53 +++++
.../client/cache/ClientCacheRequest.java | 56 +++++
.../platform/utils/PlatformUtils.java | 204 +++++++++++++++++--
.../visor/file/VisorLatestTextFilesTask.java | 13 +-
.../internal/visor/log/VisorLogSearchTask.java | 25 +--
.../internal/visor/util/VisorTaskUtils.java | 43 +++-
.../org/apache/ignite/thread/IgniteThread.java | 2 +-
...CacheExchangeMessageDuplicatedStateTest.java | 27 ++-
.../cache/ConcurrentCacheStartTest.java | 67 ++++++
.../distributed/Cache64kPartitionsTest.java | 86 ++++++++
.../MemoryPolicyInitializationTest.java | 2 +-
.../testsuites/IgniteCacheTestSuite5.java | 7 +-
.../H2DynamicColumnsAbstractBasicSelfTest.java | 23 ++-
.../Cache/Query/CacheQueriesTest.cs | 5 +-
.../Query/Linq/CacheLinqTest.Introspection.cs | 17 +-
.../Apache.Ignite.Core.csproj | 1 +
.../Cache/Query/SqlFieldsQuery.cs | 17 +-
.../Impl/Binary/BinaryProcessor.cs | 155 +++++++-------
.../Impl/Binary/IBinaryProcessor.cs | 73 +++++++
.../Impl/Binary/Marshaller.cs | 6 +-
.../Impl/Binary/Metadata/BinaryType.cs | 24 ++-
.../Apache.Ignite.Core/Impl/Cache/CacheImpl.cs | 2 +-
.../Apache.Ignite.Core/Impl/IIgniteInternal.cs | 2 +-
.../dotnet/Apache.Ignite.Core/Impl/Ignite.cs | 2 +-
.../Impl/CacheFieldsQueryExecutor.cs | 3 +-
.../dotnet/Apache.Ignite.Linq/QueryOptions.cs | 13 ++
.../web-console/backend/app/agentsHandler.js | 2 +-
.../generator/AbstractTransformer.js | 4 +-
.../generator/ConfigurationGenerator.js | 70 ++++---
.../generator/JavaTransformer.service.js | 7 +-
.../generator/SpringTransformer.service.js | 2 +-
.../agent/handlers/AbstractListener.java | 14 +-
62 files changed, 1838 insertions(+), 378 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/393f8024/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/393f8024/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/393f8024/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
[06/25] ignite git commit: IGNITE-5896: Preparing base client request
for integration with thin client.
Posted by sb...@apache.org.
IGNITE-5896: Preparing base client request for integration with thin client.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/22b15786
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/22b15786
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/22b15786
Branch: refs/heads/ignite-6149
Commit: 22b157865c304be4d13fcca6f435d2fcad842d00
Parents: 0542c76
Author: devozerov <vo...@gridgain.com>
Authored: Wed Sep 13 13:46:13 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed Sep 13 13:46:13 2017 +0300
----------------------------------------------------------------------
.../processors/odbc/SqlListenerNioListener.java | 11 +++-----
.../processors/odbc/SqlListenerRequest.java | 16 ++---------
.../processors/odbc/SqlListenerRequestNoId.java | 28 ++++++++++++++++++++
.../processors/odbc/jdbc/JdbcRequest.java | 4 +--
.../processors/odbc/odbc/OdbcRequest.java | 4 +--
5 files changed, 37 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/22b15786/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java
index e2d444b..98cd8ea 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java
@@ -47,9 +47,6 @@ public class SqlListenerNioListener extends GridNioServerListenerAdapter<byte[]>
/** Connection-related metadata key. */
private static final int CONN_CTX_META_KEY = GridNioSessionMetaKey.nextUniqueKey();
- /** Request ID generator. */
- private static final AtomicLong REQ_ID_GEN = new AtomicLong();
-
/** Busy lock. */
private final GridSpinBusyLock busyLock;
@@ -123,15 +120,13 @@ public class SqlListenerNioListener extends GridNioServerListenerAdapter<byte[]>
assert req != null;
- req.requestId(REQ_ID_GEN.incrementAndGet());
-
try {
long startTime = 0;
if (log.isDebugEnabled()) {
startTime = System.nanoTime();
- log.debug("SQL client request received [reqId=" + req.requestId() + ", addr=" +
+ log.debug("Client request received [reqId=" + req.requestId() + ", addr=" +
ses.remoteAddress() + ", req=" + req + ']');
}
@@ -140,7 +135,7 @@ public class SqlListenerNioListener extends GridNioServerListenerAdapter<byte[]>
if (log.isDebugEnabled()) {
long dur = (System.nanoTime() - startTime) / 1000;
- log.debug("SQL client request processed [reqId=" + req.requestId() + ", dur(mcs)=" + dur +
+ log.debug("Client request processed [reqId=" + req.requestId() + ", dur(mcs)=" + dur +
", resp=" + resp.status() + ']');
}
@@ -149,7 +144,7 @@ public class SqlListenerNioListener extends GridNioServerListenerAdapter<byte[]>
ses.send(outMsg);
}
catch (Exception e) {
- log.error("Failed to process SQL client request [req=" + req + ']', e);
+ log.error("Failed to process client request [req=" + req + ']', e);
ses.send(parser.encode(handler.handleException(e)));
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/22b15786/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerRequest.java
index 3c74752..5b1c5fb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerRequest.java
@@ -20,24 +20,12 @@ package org.apache.ignite.internal.processors.odbc;
/**
* SQL listener command request.
*/
-public abstract class SqlListenerRequest {
+public interface SqlListenerRequest {
/** Handshake request. */
public static final int HANDSHAKE = 1;
- /** Request ID. */
- private long reqId;
-
/**
* @return Request ID.
*/
- public long requestId() {
- return reqId;
- }
-
- /**
- * @param reqId Request ID.
- */
- public void requestId(long reqId) {
- this.reqId = reqId;
- }
+ public long requestId();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/22b15786/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerRequestNoId.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerRequestNoId.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerRequestNoId.java
new file mode 100644
index 0000000..68dbc5c
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerRequestNoId.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.odbc;
+
+/**
+ * Client request with no ID.
+ */
+public abstract class SqlListenerRequestNoId implements SqlListenerRequest {
+ /** {@inheritDoc} */
+ @Override public long requestId() {
+ return 0;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/22b15786/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcRequest.java
index 4ef75f6..ab97dc5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcRequest.java
@@ -21,12 +21,12 @@ import org.apache.ignite.IgniteException;
import org.apache.ignite.binary.BinaryObjectException;
import org.apache.ignite.internal.binary.BinaryReaderExImpl;
import org.apache.ignite.internal.binary.BinaryWriterExImpl;
-import org.apache.ignite.internal.processors.odbc.SqlListenerRequest;
+import org.apache.ignite.internal.processors.odbc.SqlListenerRequestNoId;
/**
* JDBC request.
*/
-public class JdbcRequest extends SqlListenerRequest implements JdbcRawBinarylizable {
+public class JdbcRequest extends SqlListenerRequestNoId implements JdbcRawBinarylizable {
/** Execute sql query request. */
static final byte QRY_EXEC = 2;
http://git-wip-us.apache.org/repos/asf/ignite/blob/22b15786/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequest.java
index 62c4de3..58ffad6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequest.java
@@ -17,12 +17,12 @@
package org.apache.ignite.internal.processors.odbc.odbc;
-import org.apache.ignite.internal.processors.odbc.SqlListenerRequest;
+import org.apache.ignite.internal.processors.odbc.SqlListenerRequestNoId;
/**
* SQL listener command request.
*/
-public class OdbcRequest extends SqlListenerRequest {
+public class OdbcRequest extends SqlListenerRequestNoId {
/** Execute sql query. */
public static final int QRY_EXEC = 2;
[21/25] ignite git commit: IGNITE-6314 - Fixed compilation
Posted by sb...@apache.org.
IGNITE-6314 - Fixed compilation
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e4e0a280
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e4e0a280
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e4e0a280
Branch: refs/heads/ignite-6149
Commit: e4e0a280853b896f32ae3d85545f83faeb7aa680
Parents: 39b93fa
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Thu Sep 14 15:54:26 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Thu Sep 14 15:54:26 2017 +0300
----------------------------------------------------------------------
.../cache/index/H2DynamicColumnsAbstractBasicSelfTest.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e4e0a280/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicColumnsAbstractBasicSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicColumnsAbstractBasicSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicColumnsAbstractBasicSelfTest.java
index 39b26a8..7329fa8 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicColumnsAbstractBasicSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicColumnsAbstractBasicSelfTest.java
@@ -269,10 +269,10 @@ public abstract class H2DynamicColumnsAbstractBasicSelfTest extends DynamicColum
else {
BinaryObject city = (BinaryObject)cache.withKeepBinary().get(1);
- assertEquals(1, city.field("id"));
- assertEquals("Washington", city.field("name"));
- assertEquals("DC", city.field("state"));
- assertEquals(2500000, city.field("population"));
+ assertEquals(1, (int)city.field("id"));
+ assertEquals("Washington", (String)city.field("name"));
+ assertEquals("DC", (String)city.field("state"));
+ assertEquals(2500000, (int)city.field("population"));
}
cache.destroy();
[18/25] ignite git commit: IGNITE-6377 - Increased memory policy size
in MemoryPolicyInitializationTest
Posted by sb...@apache.org.
IGNITE-6377 - Increased memory policy size in MemoryPolicyInitializationTest
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c0bd57ce
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c0bd57ce
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c0bd57ce
Branch: refs/heads/ignite-6149
Commit: c0bd57cead1bb5d0e511519e162c985811c37039
Parents: b97aec7
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Thu Sep 14 11:22:19 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Thu Sep 14 11:22:19 2017 +0300
----------------------------------------------------------------------
.../cache/persistence/MemoryPolicyInitializationTest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c0bd57ce/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/MemoryPolicyInitializationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/MemoryPolicyInitializationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/MemoryPolicyInitializationTest.java
index 6493f88..842f618 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/MemoryPolicyInitializationTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/MemoryPolicyInitializationTest.java
@@ -38,7 +38,7 @@ public class MemoryPolicyInitializationTest extends GridCommonAbstractTest {
private static final String CUSTOM_NON_DEFAULT_MEM_PLC_NAME = "custom_mem_plc";
/** */
- private static final long USER_CUSTOM_MEM_PLC_SIZE = 10 * 1024 * 1024;
+ private static final long USER_CUSTOM_MEM_PLC_SIZE = 89 * 1024 * 1024;
/** */
private static final long USER_DEFAULT_MEM_PLC_SIZE = 99 * 1024 * 1024;
[05/25] ignite git commit: IGNITE-6356 - Fixed overflow when using
number of partitions greater than Short.MAX_VALUE
Posted by sb...@apache.org.
IGNITE-6356 - Fixed overflow when using number of partitions greater than Short.MAX_VALUE
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1aa59a69
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1aa59a69
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1aa59a69
Branch: refs/heads/ignite-6149
Commit: 1aa59a69fa7e6a38938090ca9dfdaba3dfa307d5
Parents: fdfd473
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Wed Sep 13 13:42:31 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Wed Sep 13 13:42:31 2017 +0300
----------------------------------------------------------------------
.../configuration/CacheConfiguration.java | 2 +-
.../dht/preloader/GridDhtPartitionMap.java | 4 +-
.../distributed/Cache64kPartitionsTest.java | 86 ++++++++++++++++++++
.../testsuites/IgniteCacheTestSuite5.java | 4 +-
4 files changed, 92 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/1aa59a69/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
index 2b4ec1d..6c43d13 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
@@ -77,7 +77,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
private static final long serialVersionUID = 0L;
/** Maximum number of partitions. */
- public static final int MAX_PARTITIONS_COUNT = 0xFFFF;
+ public static final int MAX_PARTITIONS_COUNT = 65000;
/** Default size of rebalance thread pool. */
@Deprecated
http://git-wip-us.apache.org/repos/asf/ignite/blob/1aa59a69/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java
index 5173a01..cb69714 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java
@@ -293,8 +293,8 @@ public class GridDhtPartitionMap implements Comparable<GridDhtPartitionMap>, Ext
map = new GridPartitionStateMap();
for (int i = 0; i < size; i++) {
- int ordinal = in.readByte();
- int part = in.readShort();
+ int ordinal = in.readUnsignedByte();
+ int part = in.readUnsignedShort();
put(part, GridDhtPartitionState.fromOrdinal(ordinal));
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1aa59a69/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/Cache64kPartitionsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/Cache64kPartitionsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/Cache64kPartitionsTest.java
new file mode 100644
index 0000000..fe139ba
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/Cache64kPartitionsTest.java
@@ -0,0 +1,86 @@
+/*
+ * 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;
+
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ *
+ */
+public class Cache64kPartitionsTest extends GridCommonAbstractTest {
+ /** */
+ private boolean persistenceEnabled;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+ CacheConfiguration ccfg = new CacheConfiguration("default");
+
+ ccfg.setAffinity(new RendezvousAffinityFunction(false, CacheConfiguration.MAX_PARTITIONS_COUNT));
+
+ cfg.setCacheConfiguration(ccfg);
+
+ cfg.setActiveOnStart(false);
+
+ if (persistenceEnabled)
+ cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration());
+
+ return cfg;
+ }
+
+ /**
+ * @throws Exception if failed.
+ */
+ public void testManyPartitionsNoPersistence() throws Exception {
+ checkManyPartitions();
+ }
+
+ /**
+ * @throws Exception if failed.
+ */
+ public void testManyPartitionsWithPersistence() throws Exception {
+ persistenceEnabled = true;
+
+ checkManyPartitions();
+ }
+
+ /**
+ * @throws Exception if failed.
+ */
+ private void checkManyPartitions() throws Exception {
+ try {
+ startGrids(4);
+
+ grid(0).active(true);
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ GridTestUtils.deleteDbFiles();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1aa59a69/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite5.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite5.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite5.java
index 953c789..38ffb4c 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite5.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite5.java
@@ -35,9 +35,9 @@ import org.apache.ignite.internal.processors.cache.IgniteCachePutStackOverflowSe
import org.apache.ignite.internal.processors.cache.IgniteCacheReadThroughEvictionsVariationsSuite;
import org.apache.ignite.internal.processors.cache.IgniteCacheStoreCollectionTest;
import org.apache.ignite.internal.processors.cache.PartitionsExchangeOnDiscoveryHistoryOverflowTest;
+import org.apache.ignite.internal.processors.cache.distributed.Cache64kPartitionsTest;
import org.apache.ignite.internal.processors.cache.distributed.CacheLateAffinityAssignmentNodeJoinValidationTest;
import org.apache.ignite.internal.processors.cache.distributed.CacheLateAffinityAssignmentTest;
-import org.apache.ignite.internal.processors.cache.distributed.GridCachePartitionEvictionDuringReadThroughSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheGroupsPartitionLossPolicySelfTest;
import org.apache.ignite.internal.processors.cache.distributed.IgniteCachePartitionLossPolicySelfTest;
import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheTxIteratorSelfTest;
@@ -96,6 +96,8 @@ public class IgniteCacheTestSuite5 extends TestSuite {
suite.addTestSuite(NotMappedPartitionInTxTest.class);
+ suite.addTestSuite(Cache64kPartitionsTest.class);
+
return suite;
}
}
[10/25] ignite git commit: IGNITE-5896: Thin client: added base
client cache get/put requests.
Posted by sb...@apache.org.
IGNITE-5896: Thin client: added base client cache get/put requests.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1f43e072
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1f43e072
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1f43e072
Branch: refs/heads/ignite-6149
Commit: 1f43e072f0211dbd21c98e36cafe00b3f2dab9fc
Parents: 2b5224f
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Wed Sep 13 14:12:41 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed Sep 13 14:12:41 2017 +0300
----------------------------------------------------------------------
.../client/cache/ClientCacheGetRequest.java | 50 +++++++++++++++++
.../client/cache/ClientCachePutRequest.java | 53 ++++++++++++++++++
.../client/cache/ClientCacheRequest.java | 56 ++++++++++++++++++++
3 files changed, 159 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/1f43e072/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetRequest.java
new file mode 100644
index 0000000..8d8487f
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetRequest.java
@@ -0,0 +1,50 @@
+/*
+ * 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.platform.client.cache;
+
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.binary.BinaryRawReaderEx;
+import org.apache.ignite.internal.processors.platform.client.ClientObjectResponse;
+import org.apache.ignite.internal.processors.platform.client.ClientResponse;
+
+/**
+ * Cache get request.
+ */
+public class ClientCacheGetRequest extends ClientCacheRequest {
+ /** Key. */
+ private final Object key;
+
+ /**
+ * Constructor.
+ *
+ * @param reader Reader.
+ */
+ public ClientCacheGetRequest(BinaryRawReaderEx reader) {
+ super(reader);
+
+ key = reader.readObjectDetached();
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override public ClientResponse process(GridKernalContext ctx) {
+ Object val = cache(ctx).get(key);
+
+ return new ClientObjectResponse(requestId(), val);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1f43e072/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCachePutRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCachePutRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCachePutRequest.java
new file mode 100644
index 0000000..5597a07
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCachePutRequest.java
@@ -0,0 +1,53 @@
+/*
+ * 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.platform.client.cache;
+
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.binary.BinaryRawReaderEx;
+import org.apache.ignite.internal.processors.platform.client.ClientResponse;
+
+/**
+ * Cache put request.
+ */
+public class ClientCachePutRequest extends ClientCacheRequest {
+ /** Key. */
+ private final Object key;
+
+ /** Value. */
+ private final Object val;
+
+ /**
+ * Ctor.
+ *
+ * @param reader Reader.
+ */
+ public ClientCachePutRequest(BinaryRawReaderEx reader) {
+ super(reader);
+
+ key = reader.readObjectDetached();
+ val = reader.readObjectDetached();
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override public ClientResponse process(GridKernalContext ctx) {
+ cache(ctx).put(key, val);
+
+ return super.process(ctx);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1f43e072/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheRequest.java
new file mode 100644
index 0000000..5232735
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheRequest.java
@@ -0,0 +1,56 @@
+/*
+ * 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.platform.client.cache;
+
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.binary.BinaryRawReader;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.processors.platform.client.ClientRequest;
+
+/**
+ * Cache get request.
+ */
+class ClientCacheRequest extends ClientRequest {
+ /** Cache ID. */
+ private final int cacheId;
+
+ /**
+ * Constructor.
+ *
+ * @param reader Reader.
+ */
+ ClientCacheRequest(BinaryRawReader reader) {
+ super(reader);
+
+ cacheId = reader.readInt();
+
+ reader.readByte(); // Flags (skipStore, etc);
+ }
+
+ /**
+ * Gets the cache for current cache id.
+ *
+ * @param ctx Kernal context.
+ * @return Cache.
+ */
+ protected IgniteCache cache(GridKernalContext ctx) {
+ String cacheName = ctx.cache().context().cacheContext(cacheId).cache().name();
+
+ return ctx.grid().cache(cacheName).withKeepBinary();
+ }
+}
[15/25] ignite git commit: IGNITE-6330: Merge-related bugfix.
Posted by sb...@apache.org.
IGNITE-6330: Merge-related bugfix.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1d95e529
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1d95e529
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1d95e529
Branch: refs/heads/ignite-6149
Commit: 1d95e52979a430a0f54ef5ce41b20638506d8317
Parents: 28b5c11
Author: Igor Sapego <is...@gridgain.com>
Authored: Wed Sep 13 18:12:13 2017 +0300
Committer: Igor Sapego <is...@gridgain.com>
Committed: Wed Sep 13 18:12:13 2017 +0300
----------------------------------------------------------------------
.../processors/platform/client/ClientConnectionContext.java | 5 +++++
1 file changed, 5 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/1d95e529/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientConnectionContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientConnectionContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientConnectionContext.java
index c6c2c3b..d4ea0be 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientConnectionContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientConnectionContext.java
@@ -73,4 +73,9 @@ public class ClientConnectionContext implements SqlListenerConnectionContext {
@Override public SqlListenerMessageParser parser() {
return parser;
}
+
+ /** {@inheritDoc} */
+ @Override public void onDisconnected() {
+ // No-op.
+ }
}
[19/25] ignite git commit: IGNITE-6379 - Fixed
CacheExchangeMessageDuplicatedStateTest
Posted by sb...@apache.org.
IGNITE-6379 - Fixed CacheExchangeMessageDuplicatedStateTest
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2776cb6f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2776cb6f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2776cb6f
Branch: refs/heads/ignite-6149
Commit: 2776cb6f33c409e582311a0c250f2afa652ae863
Parents: c0bd57c
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Thu Sep 14 11:33:19 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Thu Sep 14 11:33:19 2017 +0300
----------------------------------------------------------------------
...CacheExchangeMessageDuplicatedStateTest.java | 27 +++++++++++++-------
1 file changed, 18 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2776cb6f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheExchangeMessageDuplicatedStateTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheExchangeMessageDuplicatedStateTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheExchangeMessageDuplicatedStateTest.java
index bff63fb..3341095 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheExchangeMessageDuplicatedStateTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheExchangeMessageDuplicatedStateTest.java
@@ -27,6 +27,8 @@ import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.TestRecordingCommunicationSpi;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.CachePartitionFullCountersMap;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.CachePartitionPartialCountersMap;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsAbstractMessage;
@@ -193,7 +195,7 @@ public class CacheExchangeMessageDuplicatedStateTest extends GridCommonAbstractT
List<Object> msgs = commSpi0.recordedMessages(false);
- assertTrue(msgs.size() > 0);
+ assertTrue(!msgs.isEmpty());
for (Object msg : msgs) {
assertTrue("Unexpected messages: " + msg, msg instanceof GridDhtPartitionsFullMessage);
@@ -217,7 +219,7 @@ public class CacheExchangeMessageDuplicatedStateTest extends GridCommonAbstractT
List<Object> msgs = commSpi0.recordedMessages(false);
- assertTrue(msgs.size() > 0);
+ assertTrue(!msgs.isEmpty());
for (Object msg : msgs) {
assertTrue("Unexpected messages: " + msg, msg instanceof GridDhtPartitionsSingleMessage);
@@ -244,12 +246,19 @@ public class CacheExchangeMessageDuplicatedStateTest extends GridCommonAbstractT
assertFalse(dupPartsData.containsKey(CU.cacheId(AFF3_CACHE1)));
- Map<Integer, Map<Integer, Long>> partCntrs =
- getFieldValue(getFieldValue(msg, "partCntrs"), "map");
+ Map<Integer, CachePartitionFullCountersMap> partCntrs =
+ getFieldValue(getFieldValue(msg, "partCntrs2"), "map");
if (partCntrs != null) {
- for (Map<Integer, Long> cntrs : partCntrs.values())
- assertTrue(cntrs.isEmpty());
+ for (CachePartitionFullCountersMap cntrs : partCntrs.values()) {
+ long[] initialUpdCntrs = getFieldValue(cntrs, "initialUpdCntrs");
+ long[] updCntrs = getFieldValue(cntrs, "updCntrs");
+
+ for (int i = 0; i < initialUpdCntrs.length; i++) {
+ assertEquals(0, initialUpdCntrs[i]);
+ assertEquals(0, updCntrs[i]);
+ }
+ }
}
}
@@ -266,11 +275,11 @@ public class CacheExchangeMessageDuplicatedStateTest extends GridCommonAbstractT
assertFalse(dupPartsData.containsKey(CU.cacheId(AFF3_CACHE1)));
- Map<Integer, Map<Integer, Long>> partCntrs = getFieldValue(msg, "partCntrs");
+ Map<Integer, CachePartitionPartialCountersMap> partCntrs = getFieldValue(msg, "partCntrs");
if (partCntrs != null) {
- for (Map<Integer, Long> cntrs : partCntrs.values())
- assertTrue(cntrs.isEmpty());
+ for (CachePartitionPartialCountersMap cntrs : partCntrs.values())
+ assertEquals(0, cntrs.size());
}
}
[13/25] ignite git commit: IGNITE-6002 Make log message more pretty
when instance name is null
Posted by sb...@apache.org.
IGNITE-6002 Make log message more pretty when instance name is null
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/60d75882
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/60d75882
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/60d75882
Branch: refs/heads/ignite-6149
Commit: 60d758820486273ab701185af6f533d66d13e0b4
Parents: 4af1832
Author: Kousuke Saruta <sa...@oss.nttdata.co.jp>
Authored: Wed Sep 13 15:53:00 2017 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Wed Sep 13 15:53:00 2017 +0300
----------------------------------------------------------------------
.../src/main/java/org/apache/ignite/internal/IgniteKernal.java | 3 ++-
.../core/src/main/java/org/apache/ignite/thread/IgniteThread.java | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/60d75882/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 f4b180c..3922b39 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
@@ -1254,7 +1254,8 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
String msg = NL +
"Metrics for local node (to disable set 'metricsLogFrequency' to 0)" + NL +
- " ^-- Node [id=" + id + ", name=" + name() + ", uptime=" + getUpTimeFormatted() + "]" + NL +
+ " ^-- Node [id=" + id + (name() != null ? ", name=" + name() : "") + ", uptime=" +
+ getUpTimeFormatted() + "]" + NL +
" ^-- H/N/C [hosts=" + hosts + ", nodes=" + nodes + ", CPUs=" + cpus + "]" + NL +
" ^-- CPU [cur=" + dblFmt.format(cpuLoadPct) + "%, avg=" +
dblFmt.format(avgCpuLoadPct) + "%, GC=" + dblFmt.format(gcPct) + "%]" + NL +
http://git-wip-us.apache.org/repos/asf/ignite/blob/60d75882/modules/core/src/main/java/org/apache/ignite/thread/IgniteThread.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/thread/IgniteThread.java b/modules/core/src/main/java/org/apache/ignite/thread/IgniteThread.java
index b8a91a2..70b75e3 100644
--- a/modules/core/src/main/java/org/apache/ignite/thread/IgniteThread.java
+++ b/modules/core/src/main/java/org/apache/ignite/thread/IgniteThread.java
@@ -176,7 +176,7 @@ public class IgniteThread extends Thread {
* @return New thread name.
*/
protected static String createName(long num, String threadName, String igniteInstanceName) {
- return threadName + "-#" + num + '%' + igniteInstanceName + '%';
+ return threadName + "-#" + num + (igniteInstanceName != null ? '%' + igniteInstanceName + '%' : "");
}
/** {@inheritDoc} */
[24/25] ignite git commit: Code style.
Posted by sb...@apache.org.
Code style.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/50c70022
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/50c70022
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/50c70022
Branch: refs/heads/ignite-6149
Commit: 50c70022eb30474aed770efbf0bd4a53375f5e81
Parents: b2c61b6
Author: sboikov <sb...@gridgain.com>
Authored: Fri Sep 15 11:00:25 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Sep 15 11:00:25 2017 +0300
----------------------------------------------------------------------
.../internal/processors/cache/ConcurrentCacheStartTest.java | 4 ----
1 file changed, 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/50c70022/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/ConcurrentCacheStartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/ConcurrentCacheStartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/ConcurrentCacheStartTest.java
index 1d97ed9..28a6683 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/ConcurrentCacheStartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/ConcurrentCacheStartTest.java
@@ -18,12 +18,9 @@
package org.apache.ignite.internal.processors.cache;
-import java.util.ArrayList;
-import java.util.List;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
@@ -66,6 +63,5 @@ public class ConcurrentCacheStartTest extends GridCommonAbstractTest {
finally {
stopAllGrids();
}
-
}
}
[07/25] ignite git commit: Merge remote-tracking branch
'origin/master'
Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/master'
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c105f03f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c105f03f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c105f03f
Branch: refs/heads/ignite-6149
Commit: c105f03f8d89905e60f195533ae9370d6a217747
Parents: 22b1578 1aa59a6
Author: devozerov <vo...@gridgain.com>
Authored: Wed Sep 13 13:47:08 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed Sep 13 13:47:08 2017 +0300
----------------------------------------------------------------------
.../configuration/CacheConfiguration.java | 2 +-
.../dht/preloader/GridDhtPartitionMap.java | 4 +-
.../distributed/Cache64kPartitionsTest.java | 86 ++++++++++++++++++++
.../testsuites/IgniteCacheTestSuite5.java | 4 +-
.../generator/AbstractTransformer.js | 4 +-
.../generator/ConfigurationGenerator.js | 70 ++++++++--------
.../generator/JavaTransformer.service.js | 7 +-
.../generator/SpringTransformer.service.js | 2 +-
.../agent/handlers/AbstractListener.java | 14 ++--
9 files changed, 146 insertions(+), 47 deletions(-)
----------------------------------------------------------------------
[03/25] ignite git commit: IGNITE-6229 Fixes in code generation.
Posted by sb...@apache.org.
IGNITE-6229 Fixes in code generation.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d753e900
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d753e900
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d753e900
Branch: refs/heads/ignite-6149
Commit: d753e9005c5a86cb4adde090149d600177d87a13
Parents: 0542c76
Author: Vasiliy Sisko <vs...@gridgain.com>
Authored: Wed Sep 13 17:09:03 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Wed Sep 13 17:09:03 2017 +0700
----------------------------------------------------------------------
.../generator/AbstractTransformer.js | 4 +-
.../generator/ConfigurationGenerator.js | 70 +++++++++++---------
.../generator/JavaTransformer.service.js | 7 +-
.../generator/SpringTransformer.service.js | 2 +-
4 files changed, 46 insertions(+), 37 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d753e900/modules/web-console/frontend/app/modules/configuration/generator/AbstractTransformer.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/AbstractTransformer.js b/modules/web-console/frontend/app/modules/configuration/generator/AbstractTransformer.js
index 7e89fbd..a67f7b9 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/AbstractTransformer.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/AbstractTransformer.js
@@ -134,8 +134,8 @@ export default class AbstractTransformer {
}
// Generate memory configuration group.
- static clusterMemory(memoryConfiguration) {
- return this.toSection(this.generator.clusterMemory(memoryConfiguration));
+ static clusterMemory(memoryConfiguration, available) {
+ return this.toSection(this.generator.clusterMemory(memoryConfiguration, available));
}
// Generate marshaller group.
http://git-wip-us.apache.org/repos/asf/ignite/blob/d753e900/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js b/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
index 24dc0d3..428a8d0 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
@@ -91,7 +91,7 @@ export default class IgniteConfigurationGenerator {
// Since ignite 2.0
if (available('2.0.0'))
- this.clusterMemory(cluster.memoryConfiguration, cfg);
+ this.clusterMemory(cluster.memoryConfiguration, available, cfg);
this.clusterMisc(cluster, available, cfg);
this.clusterMetrics(cluster, available, cfg);
@@ -974,6 +974,35 @@ export default class IgniteConfigurationGenerator {
return discoSpi;
}
+ // Execute event filtration in accordance to generated project version.
+ static filterEvents(eventGrps, available) {
+ if (available('2.0.0')) {
+ return _.reduce(eventGrps, (acc, eventGrp) => {
+ switch (eventGrp.value) {
+ case 'EVTS_SWAPSPACE':
+ // Removed.
+
+ break;
+ case 'EVTS_CACHE':
+ const eventGrpX2 = _.cloneDeep(eventGrp);
+
+ eventGrpX2.events = _.filter(eventGrpX2.events, (ev) =>
+ !_.includes(['EVT_CACHE_OBJECT_SWAPPED', 'EVT_CACHE_OBJECT_UNSWAPPED'], ev));
+
+ acc.push(eventGrpX2);
+
+ break;
+ default:
+ acc.push(eventGrp);
+ }
+
+ return acc;
+ }, []);
+ }
+
+ return eventGrps;
+ }
+
// Generate events group.
static clusterEvents(cluster, available, cfg = this.igniteConfigurationBean(cluster)) {
const eventStorage = cluster.eventStorage;
@@ -1009,33 +1038,7 @@ export default class IgniteConfigurationGenerator {
if (_.nonEmpty(cluster.includeEventTypes)) {
const eventGrps = _.filter(this.eventGrps, ({value}) => _.includes(cluster.includeEventTypes, value));
- if (available('2.0.0')) {
- const events = _.reduce(eventGrps, (acc, eventGrp) => {
- switch (eventGrp.value) {
- case 'EVTS_SWAPSPACE':
- // Removed.
-
- break;
- case 'EVTS_CACHE':
- const eventGrpX2 = _.cloneDeep(eventGrp);
-
- eventGrpX2.events = _.filter(eventGrpX2.events, (ev) =>
- !_.includes(['EVT_CACHE_OBJECT_SWAPPED', 'EVT_CACHE_OBJECT_UNSWAPPED'], ev));
-
- acc.push(eventGrpX2);
-
- break;
- default:
- acc.push(eventGrp);
- }
-
- return acc;
- }, []);
-
- cfg.eventTypes('evts', 'includeEventTypes', events);
- }
- else
- cfg.eventTypes('evts', 'includeEventTypes', eventGrps);
+ cfg.eventTypes('evts', 'includeEventTypes', this.filterEvents(eventGrps, available));
}
}
@@ -1282,8 +1285,8 @@ export default class IgniteConfigurationGenerator {
return cfg;
}
- // Generate logger group.
- static clusterMemory(memoryConfiguration, cfg = this.igniteConfigurationBean()) {
+ // Generate memory configuration.
+ static clusterMemory(memoryConfiguration, available, cfg = this.igniteConfigurationBean()) {
const memoryBean = new Bean('org.apache.ignite.configuration.MemoryConfiguration', 'memoryConfiguration', memoryConfiguration, clusterDflts.memoryConfiguration);
memoryBean.intProperty('pageSize')
@@ -1307,10 +1310,13 @@ export default class IgniteConfigurationGenerator {
.enumProperty('pageEvictionMode')
.doubleProperty('evictionThreshold')
.intProperty('emptyPagesPoolSize')
- .intProperty('subIntervals')
- .longProperty('rateTimeInterval')
.boolProperty('metricsEnabled');
+ if (available('2.1.0')) {
+ plcBean.intProperty('subIntervals')
+ .longProperty('rateTimeInterval');
+ }
+
if (plcBean.isEmpty()) return;
policies.push(plcBean);
http://git-wip-us.apache.org/repos/asf/ignite/blob/d753e900/modules/web-console/frontend/app/modules/configuration/generator/JavaTransformer.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/JavaTransformer.service.js b/modules/web-console/frontend/app/modules/configuration/generator/JavaTransformer.service.js
index 8739608..64fc172 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/JavaTransformer.service.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/JavaTransformer.service.js
@@ -778,7 +778,8 @@ export default class IgniteJavaTransformer extends AbstractTransformer {
break;
case 'ARRAY':
- imports.push(prop.typeClsName);
+ if (!prop.varArg)
+ imports.push(prop.typeClsName);
if (this._isBean(prop.typeClsName))
_.forEach(prop.items, (item) => imports.push(...this.collectBeanImports(item)));
@@ -1589,7 +1590,7 @@ export default class IgniteJavaTransformer extends AbstractTransformer {
const sb = new StringBuilder();
- const imports = ['org.apache.ignite.Ignition', 'org.apache.ignite.Ignite'];
+ const imports = ['org.apache.ignite.Ignition'];
if (demo) {
imports.push('org.h2.tools.Server', 'java.sql.Connection', 'java.sql.PreparedStatement',
@@ -1650,6 +1651,8 @@ export default class IgniteJavaTransformer extends AbstractTransformer {
}
if ((_.nonEmpty(clientNearCaches) || demo) && shortFactoryCls) {
+ imports.push('org.apache.ignite.Ignite');
+
sb.append(`Ignite ignite = Ignition.start(${cfgRef});`);
_.forEach(clientNearCaches, (cache, idx) => {
http://git-wip-us.apache.org/repos/asf/ignite/blob/d753e900/modules/web-console/frontend/app/modules/configuration/generator/SpringTransformer.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/SpringTransformer.service.js b/modules/web-console/frontend/app/modules/configuration/generator/SpringTransformer.service.js
index eda590c..f0bfdb6 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/SpringTransformer.service.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/SpringTransformer.service.js
@@ -94,7 +94,7 @@ export default class IgniteSpringTransformer extends AbstractTransformer {
case 'java.lang.Class':
return this.javaTypes.fullClassName(item);
case 'long':
- return `${item}L`;
+ return `${item}`;
case 'java.lang.String':
case 'PATH':
return this.escapeXml(item);
[02/25] ignite git commit: IGNITE-6121 .NET: Propagate
SqlFieldsQuery.lazy property
Posted by sb...@apache.org.
IGNITE-6121 .NET: Propagate SqlFieldsQuery.lazy property
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0542c762
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0542c762
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0542c762
Branch: refs/heads/ignite-6149
Commit: 0542c762d0fafc1503d1bd83d2ac42719f38c5d5
Parents: 581d91b
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Wed Sep 13 12:50:49 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Wed Sep 13 12:50:49 2017 +0300
----------------------------------------------------------------------
.../Cache/Query/CacheQueriesTest.cs | 5 +++--
.../Query/Linq/CacheLinqTest.Introspection.cs | 17 ++++++++++-------
.../Cache/Query/SqlFieldsQuery.cs | 17 +++++++++++++++--
.../Apache.Ignite.Core/Impl/Cache/CacheImpl.cs | 2 +-
.../Impl/CacheFieldsQueryExecutor.cs | 3 ++-
.../dotnet/Apache.Ignite.Linq/QueryOptions.cs | 13 +++++++++++++
6 files changed, 44 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0542c762/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
index ae2fe8f..65ab18c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
@@ -369,7 +369,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
/// </summary>
[Test]
public void TestSqlFieldsQuery([Values(true, false)] bool loc, [Values(true, false)] bool distrJoin,
- [Values(true, false)] bool enforceJoinOrder)
+ [Values(true, false)] bool enforceJoinOrder, [Values(true, false)] bool lazy)
{
int cnt = MaxItemCnt;
@@ -386,7 +386,8 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
Colocated = !distrJoin,
ReplicatedOnly = false,
Local = loc,
- Timeout = TimeSpan.FromSeconds(2)
+ Timeout = TimeSpan.FromSeconds(2),
+ Lazy = lazy
};
using (IQueryCursor<IList> cursor = cache.QueryFields(qry))
http://git-wip-us.apache.org/repos/asf/ignite/blob/0542c762/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Linq/CacheLinqTest.Introspection.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Linq/CacheLinqTest.Introspection.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Linq/CacheLinqTest.Introspection.cs
index 9430dd8..a13131b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Linq/CacheLinqTest.Introspection.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Linq/CacheLinqTest.Introspection.cs
@@ -53,7 +53,8 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Linq
EnforceJoinOrder = true,
Timeout = TimeSpan.FromSeconds(2.5),
ReplicatedOnly = true,
- Colocated = true
+ Colocated = true,
+ Lazy = true
}).Where(x => x.Key > 10).ToCacheQueryable();
Assert.AreEqual(cache.Name, query.CacheName);
@@ -76,6 +77,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Linq
Assert.IsTrue(fq.ReplicatedOnly);
Assert.IsTrue(fq.Colocated);
Assert.AreEqual(TimeSpan.FromSeconds(2.5), fq.Timeout);
+ Assert.IsTrue(fq.Lazy);
var str = query.ToString();
Assert.AreEqual(GetSqlEscapeAll()
@@ -83,12 +85,12 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Linq
"[Sql=select _T0._KEY, _T0._VAL from \"person_org\".\"Person\" as _T0 where " +
"(_T0.\"_KEY\" > ?), Arguments=[10], " +
"Local=True, PageSize=999, EnableDistributedJoins=False, EnforceJoinOrder=True, " +
- "Timeout=00:00:02.5000000, ReplicatedOnly=True, Colocated=True, Schema=]]"
+ "Timeout=00:00:02.5000000, ReplicatedOnly=True, Colocated=True, Schema=, Lazy=True]]"
: "CacheQueryable [CacheName=person_org, TableName=Person, Query=SqlFieldsQuery " +
"[Sql=select _T0._KEY, _T0._VAL from \"person_org\".Person as _T0 where " +
"(_T0._KEY > ?), Arguments=[10], " +
"Local=True, PageSize=999, EnableDistributedJoins=False, EnforceJoinOrder=True, " +
- "Timeout=00:00:02.5000000, ReplicatedOnly=True, Colocated=True, Schema=]]", str);
+ "Timeout=00:00:02.5000000, ReplicatedOnly=True, Colocated=True, Schema=, Lazy=True]]", str);
// Check fields query
var fieldsQuery = (ICacheQueryable)cache.AsCacheQueryable().Select(x => x.Value.Name);
@@ -106,17 +108,18 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Linq
Assert.AreEqual(SqlFieldsQuery.DefaultPageSize, fq.PageSize);
Assert.IsFalse(fq.EnableDistributedJoins);
Assert.IsFalse(fq.EnforceJoinOrder);
+ Assert.IsFalse(fq.Lazy);
str = fieldsQuery.ToString();
Assert.AreEqual(GetSqlEscapeAll()
? "CacheQueryable [CacheName=person_org, TableName=Person, Query=SqlFieldsQuery " +
"[Sql=select _T0.\"Name\" from \"person_org\".\"Person\" as _T0, Arguments=[], Local=False, " +
"PageSize=1024, EnableDistributedJoins=False, EnforceJoinOrder=False, " +
- "Timeout=00:00:00, ReplicatedOnly=False, Colocated=False, Schema=]]"
+ "Timeout=00:00:00, ReplicatedOnly=False, Colocated=False, Schema=, Lazy=False]]"
: "CacheQueryable [CacheName=person_org, TableName=Person, Query=SqlFieldsQuery " +
"[Sql=select _T0.NAME from \"person_org\".Person as _T0, Arguments=[], Local=False, " +
"PageSize=1024, EnableDistributedJoins=False, EnforceJoinOrder=False, " +
- "Timeout=00:00:00, ReplicatedOnly=False, Colocated=False, Schema=]]", str);
+ "Timeout=00:00:00, ReplicatedOnly=False, Colocated=False, Schema=, Lazy=False]]", str);
// Check distributed joins flag propagation
var distrQuery = cache.AsCacheQueryable(new QueryOptions { EnableDistributedJoins = true })
@@ -133,13 +136,13 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Linq
"(((_T0.\"_KEY\" > ?) and (_T0.\"age1\" > ?)) " +
"and (_T0.\"Name\" like \'%\' || ? || \'%\') ), Arguments=[10, 20, x], Local=False, " +
"PageSize=1024, EnableDistributedJoins=True, EnforceJoinOrder=False, " +
- "Timeout=00:00:00, ReplicatedOnly=False, Colocated=False, Schema=]]"
+ "Timeout=00:00:00, ReplicatedOnly=False, Colocated=False, Schema=, Lazy=False]]"
: "CacheQueryable [CacheName=person_org, TableName=Person, Query=SqlFieldsQuery " +
"[Sql=select _T0._KEY, _T0._VAL from \"person_org\".Person as _T0 where " +
"(((_T0._KEY > ?) and (_T0.AGE1 > ?)) " +
"and (_T0.NAME like \'%\' || ? || \'%\') ), Arguments=[10, 20, x], Local=False, " +
"PageSize=1024, EnableDistributedJoins=True, EnforceJoinOrder=False, " +
- "Timeout=00:00:00, ReplicatedOnly=False, Colocated=False, Schema=]]", str);
+ "Timeout=00:00:00, ReplicatedOnly=False, Colocated=False, Schema=, Lazy=False]]", str);
}
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/0542c762/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlFieldsQuery.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlFieldsQuery.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlFieldsQuery.cs
index aa33415..a93e00d 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlFieldsQuery.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlFieldsQuery.cs
@@ -136,6 +136,19 @@ namespace Apache.Ignite.Core.Cache.Query
public string Schema { get; set; }
/// <summary>
+ /// Gets or sets a value indicating whether this <see cref="SqlFieldsQuery"/> is lazy.
+ /// <para />
+ /// By default Ignite attempts to fetch the whole query result set to memory and send it to the client.
+ /// For small and medium result sets this provides optimal performance and minimize duration of internal
+ /// database locks, thus increasing concurrency.
+ /// <para />
+ /// If result set is too big to fit in available memory this could lead to excessive GC pauses and even
+ /// OutOfMemoryError. Use this flag as a hint for Ignite to fetch result set lazily, thus minimizing memory
+ /// consumption at the cost of moderate performance hit.
+ /// </summary>
+ public bool Lazy { get; set; }
+
+ /// <summary>
/// Returns a <see cref="string" /> that represents this instance.
/// </summary>
/// <returns>
@@ -147,9 +160,9 @@ namespace Apache.Ignite.Core.Cache.Query
return string.Format("SqlFieldsQuery [Sql={0}, Arguments=[{1}], Local={2}, PageSize={3}, " +
"EnableDistributedJoins={4}, EnforceJoinOrder={5}, Timeout={6}, ReplicatedOnly={7}" +
- ", Colocated={8}, Schema={9}]", Sql, args, Local,
+ ", Colocated={8}, Schema={9}, Lazy={10}]", Sql, args, Local,
PageSize, EnableDistributedJoins, EnforceJoinOrder, Timeout, ReplicatedOnly,
- Colocated, Schema);
+ Colocated, Schema, Lazy);
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0542c762/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 05644cd..921b5e0 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
@@ -1091,7 +1091,7 @@ namespace Apache.Ignite.Core.Impl.Cache
writer.WriteBoolean(qry.EnableDistributedJoins);
writer.WriteBoolean(qry.EnforceJoinOrder);
- writer.WriteBoolean(false); // Lazy flag.
+ writer.WriteBoolean(qry.Lazy); // Lazy flag.
writer.WriteInt((int) qry.Timeout.TotalMilliseconds);
writer.WriteBoolean(qry.ReplicatedOnly);
writer.WriteBoolean(qry.Colocated);
http://git-wip-us.apache.org/repos/asf/ignite/blob/0542c762/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheFieldsQueryExecutor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheFieldsQueryExecutor.cs b/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheFieldsQueryExecutor.cs
index bc7251b..fb34270 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheFieldsQueryExecutor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheFieldsQueryExecutor.cs
@@ -207,7 +207,8 @@ namespace Apache.Ignite.Linq.Impl
ReplicatedOnly = _options.ReplicatedOnly,
Colocated = _options.Colocated,
Local = _options.Local,
- Arguments = args
+ Arguments = args,
+ Lazy = _options.Lazy
};
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0542c762/modules/platforms/dotnet/Apache.Ignite.Linq/QueryOptions.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Linq/QueryOptions.cs b/modules/platforms/dotnet/Apache.Ignite.Linq/QueryOptions.cs
index 17b3705..c727e1c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Linq/QueryOptions.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Linq/QueryOptions.cs
@@ -110,5 +110,18 @@ namespace Apache.Ignite.Linq
/// performance and network optimizations by grouping data on remote nodes.
/// </summary>
public bool Colocated { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether this query is lazy.
+ /// <para />
+ /// By default Ignite attempts to fetch the whole query result set to memory and send it to the client.
+ /// For small and medium result sets this provides optimal performance and minimize duration of internal
+ /// database locks, thus increasing concurrency.
+ /// <para />
+ /// If result set is too big to fit in available memory this could lead to excessive GC pauses and even
+ /// OutOfMemoryError. Use this flag as a hint for Ignite to fetch result set lazily, thus minimizing memory
+ /// consumption at the cost of moderate performance hit.
+ /// </summary>
+ public bool Lazy { get; set; }
}
}
[08/25] ignite git commit: IGNITE-5896: Base thin client requests.
Posted by sb...@apache.org.
IGNITE-5896: Base thin client requests.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2b5224f5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2b5224f5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2b5224f5
Branch: refs/heads/ignite-6149
Commit: 2b5224f5e1a22f57595c8c2144e0e759b2454082
Parents: c105f03
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Wed Sep 13 13:56:18 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed Sep 13 13:56:18 2017 +0300
----------------------------------------------------------------------
.../platform/client/ClientBooleanResponse.java | 46 +++++++++++++++++
.../platform/client/ClientObjectResponse.java | 46 +++++++++++++++++
.../platform/client/ClientRequest.java | 53 ++++++++++++++++++++
.../platform/client/ClientResponse.java | 47 +++++++++++++++++
4 files changed, 192 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b5224f5/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientBooleanResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientBooleanResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientBooleanResponse.java
new file mode 100644
index 0000000..7ab3dc7
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientBooleanResponse.java
@@ -0,0 +1,46 @@
+/*
+ * 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.platform.client;
+
+import org.apache.ignite.binary.BinaryRawWriter;
+
+/**
+ * Boolean response.
+ */
+public class ClientBooleanResponse extends ClientResponse {
+ /** */
+ private final boolean val;
+
+ /**
+ * Constructor.
+ *
+ * @param reqId Request id.
+ */
+ public ClientBooleanResponse(long reqId, boolean val) {
+ super(reqId);
+
+ this.val = val;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void encode(BinaryRawWriter writer) {
+ super.encode(writer);
+
+ writer.writeBoolean(val);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b5224f5/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientObjectResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientObjectResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientObjectResponse.java
new file mode 100644
index 0000000..fc851a3
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientObjectResponse.java
@@ -0,0 +1,46 @@
+/*
+ * 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.platform.client;
+
+import org.apache.ignite.binary.BinaryRawWriter;
+
+/**
+ * Single object response.
+ */
+public class ClientObjectResponse extends ClientResponse {
+ /** */
+ private final Object val;
+
+ /**
+ * Constructor.
+ *
+ * @param reqId Request id.
+ */
+ public ClientObjectResponse(long reqId, Object val) {
+ super(reqId);
+
+ this.val = val;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void encode(BinaryRawWriter writer) {
+ super.encode(writer);
+
+ writer.writeObject(val);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b5224f5/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientRequest.java
new file mode 100644
index 0000000..c16d481
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientRequest.java
@@ -0,0 +1,53 @@
+/*
+ * 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.platform.client;
+
+import org.apache.ignite.binary.BinaryRawReader;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.processors.odbc.SqlListenerRequest;
+
+/**
+ * Thin client request.
+ */
+public class ClientRequest implements SqlListenerRequest {
+ /** Request id. */
+ private final long reqId;
+
+ /**
+ * Constructor.
+ *
+ * @param reader Reader.
+ */
+ public ClientRequest(BinaryRawReader reader) {
+ reqId = reader.readLong();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long requestId() {
+ return reqId;
+ }
+
+ /**
+ * Processes the request.
+ *
+ * @return Response.
+ */
+ public ClientResponse process(GridKernalContext ctx) {
+ return new ClientResponse(reqId);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2b5224f5/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientResponse.java
new file mode 100644
index 0000000..6f2e8d6
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientResponse.java
@@ -0,0 +1,47 @@
+/*
+ * 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.platform.client;
+
+import org.apache.ignite.binary.BinaryRawWriter;
+import org.apache.ignite.internal.processors.odbc.SqlListenerResponse;
+
+/**
+ * Thin client response.
+ */
+public class ClientResponse extends SqlListenerResponse {
+ /** Request id. */
+ private final long reqId;
+
+ /**
+ * Constructor.
+ *
+ * @param reqId Request id.
+ */
+ public ClientResponse(long reqId) {
+ super(STATUS_SUCCESS, null);
+
+ this.reqId = reqId;
+ }
+
+ /**
+ * Encodes the response data.
+ */
+ public void encode(BinaryRawWriter writer) {
+ writer.writeLong(reqId);
+ }
+}
[17/25] ignite git commit: IGNITE-6340 Fixed incorrect client cache
creation on server side. Fixes #2635
Posted by sb...@apache.org.
IGNITE-6340 Fixed incorrect client cache creation on server side. Fixes #2635
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b97aec70
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b97aec70
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b97aec70
Branch: refs/heads/ignite-6149
Commit: b97aec704ba4dc64c1bbcd9abbd686128ed3e0f2
Parents: 9514d4a
Author: Ilya Lantukh <il...@gridgain.com>
Authored: Thu Sep 14 10:44:29 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Thu Sep 14 10:44:29 2017 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheProcessor.java | 2 +-
.../cache/ConcurrentCacheStartTest.java | 71 ++++++++++++++++++++
.../testsuites/IgniteCacheTestSuite5.java | 3 +
3 files changed, 75 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b97aec70/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index 5d84809..f3759e0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -3784,7 +3784,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
// If local node has near cache, return success.
req.clientStartOnly(true);
}
- else
+ else if (!CU.affinityNode(ctx.discovery().localNode(), descCfg.getNodeFilter()))
req.clientStartOnly(true);
req.deploymentId(desc.deploymentId());
http://git-wip-us.apache.org/repos/asf/ignite/blob/b97aec70/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/ConcurrentCacheStartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/ConcurrentCacheStartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/ConcurrentCacheStartTest.java
new file mode 100644
index 0000000..1d97ed9
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/ConcurrentCacheStartTest.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ *
+ */
+public class ConcurrentCacheStartTest extends GridCommonAbstractTest {
+ /**
+ * @throws Exception If failed.
+ */
+ public void test() throws Exception {
+ try {
+ final IgniteEx ignite = (IgniteEx) startGrids(4);
+
+ for (int k = 0; k < 100; k++) {
+ final String cacheName = "cache" + k;
+
+ GridTestUtils.runMultiThreaded(new Runnable() {
+ @Override public void run() {
+ try {
+ ignite.context().cache().dynamicStartCache(
+ new CacheConfiguration().setName(cacheName),
+ cacheName,
+ null,
+ false,
+ false,
+ false
+ ).get();
+
+ assertNotNull(ignite.context().cache().cache(cacheName));
+ }
+ catch (IgniteCheckedException ex) {
+ throw new IgniteException(ex);
+ }
+ }
+ }, 10, "cache-start");
+ }
+ }
+ finally {
+ stopAllGrids();
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b97aec70/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite5.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite5.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite5.java
index 38ffb4c..ee57fa7 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite5.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite5.java
@@ -30,6 +30,7 @@ import org.apache.ignite.internal.processors.cache.CacheRebalancingSelfTest;
import org.apache.ignite.internal.processors.cache.CacheSerializableTransactionsTest;
import org.apache.ignite.internal.processors.cache.ClusterStatePartitionedSelfTest;
import org.apache.ignite.internal.processors.cache.ClusterStateReplicatedSelfTest;
+import org.apache.ignite.internal.processors.cache.ConcurrentCacheStartTest;
import org.apache.ignite.internal.processors.cache.EntryVersionConsistencyReadThroughTest;
import org.apache.ignite.internal.processors.cache.IgniteCachePutStackOverflowSelfTest;
import org.apache.ignite.internal.processors.cache.IgniteCacheReadThroughEvictionsVariationsSuite;
@@ -96,6 +97,8 @@ public class IgniteCacheTestSuite5 extends TestSuite {
suite.addTestSuite(NotMappedPartitionInTxTest.class);
+ suite.addTestSuite(ConcurrentCacheStartTest.class);
+
suite.addTestSuite(Cache64kPartitionsTest.class);
return suite;
[22/25] ignite git commit: IGNITE-6258: Thin client: binary metadata
protocol. This closes #2662. This closes #2667.
Posted by sb...@apache.org.
IGNITE-6258: Thin client: binary metadata protocol. This closes #2662. This closes #2667.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/db88d6ba
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/db88d6ba
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/db88d6ba
Branch: refs/heads/ignite-6149
Commit: db88d6ba39920ace74720f7dc0e0741cfb38c450
Parents: e4e0a28
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Thu Sep 14 21:40:48 2017 +0300
Committer: devozerov <pp...@gmail.com>
Committed: Thu Sep 14 21:40:48 2017 +0300
----------------------------------------------------------------------
.../platform/PlatformContextImpl.java | 125 +-----------
.../platform/client/ClientMessageParser.java | 28 +++
.../platform/client/ClientStringResponse.java | 47 +++++
.../binary/ClientBinaryTypeGetRequest.java | 50 +++++
.../binary/ClientBinaryTypeGetResponse.java | 51 +++++
.../binary/ClientBinaryTypeNameGetRequest.java | 61 ++++++
.../binary/ClientBinaryTypeNamePutRequest.java | 65 ++++++
.../binary/ClientBinaryTypePutRequest.java | 56 +++++
.../platform/utils/PlatformUtils.java | 204 +++++++++++++++++--
.../Apache.Ignite.Core.csproj | 1 +
.../Impl/Binary/BinaryProcessor.cs | 155 +++++++-------
.../Impl/Binary/IBinaryProcessor.cs | 73 +++++++
.../Impl/Binary/Marshaller.cs | 6 +-
.../Impl/Binary/Metadata/BinaryType.cs | 24 ++-
.../Apache.Ignite.Core/Impl/IIgniteInternal.cs | 2 +-
.../dotnet/Apache.Ignite.Core/Impl/Ignite.cs | 2 +-
16 files changed, 741 insertions(+), 209 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/db88d6ba/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
index f115a9c..b141313 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
@@ -34,13 +34,10 @@ import org.apache.ignite.events.JobEvent;
import org.apache.ignite.events.TaskEvent;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.binary.BinaryContext;
-import org.apache.ignite.internal.binary.BinaryFieldMetadata;
import org.apache.ignite.internal.binary.BinaryMetadata;
import org.apache.ignite.internal.binary.BinaryRawReaderEx;
import org.apache.ignite.internal.binary.BinaryRawWriterEx;
import org.apache.ignite.internal.binary.BinaryReaderExImpl;
-import org.apache.ignite.internal.binary.BinarySchema;
-import org.apache.ignite.internal.binary.BinarySchemaRegistry;
import org.apache.ignite.internal.binary.BinaryTypeImpl;
import org.apache.ignite.internal.binary.GridBinaryMarshaller;
import org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl;
@@ -69,21 +66,15 @@ import org.apache.ignite.internal.processors.platform.memory.PlatformMemoryManag
import org.apache.ignite.internal.processors.platform.memory.PlatformOutputStream;
import org.apache.ignite.internal.processors.platform.message.PlatformMessageFilter;
import org.apache.ignite.internal.processors.platform.messaging.PlatformMessageFilterImpl;
-import org.apache.ignite.internal.processors.platform.utils.PlatformReaderBiClosure;
-import org.apache.ignite.internal.processors.platform.utils.PlatformReaderClosure;
import org.apache.ignite.internal.processors.platform.utils.PlatformUtils;
-import org.apache.ignite.lang.IgniteBiTuple;
import org.jetbrains.annotations.Nullable;
import java.sql.Timestamp;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
@@ -353,62 +344,7 @@ public class PlatformContextImpl implements PlatformContext {
/** {@inheritDoc} */
@SuppressWarnings("ConstantConditions")
@Override public void processMetadata(BinaryRawReaderEx reader) {
- Collection<BinaryMetadata> metas = PlatformUtils.readCollection(reader,
- new PlatformReaderClosure<BinaryMetadata>() {
- @Override public BinaryMetadata read(BinaryRawReaderEx reader) {
- int typeId = reader.readInt();
- String typeName = reader.readString();
- String affKey = reader.readString();
-
- Map<String, BinaryFieldMetadata> fields = PlatformUtils.readLinkedMap(reader,
- new PlatformReaderBiClosure<String, BinaryFieldMetadata>() {
- @Override public IgniteBiTuple<String, BinaryFieldMetadata> read(BinaryRawReaderEx reader) {
- String name = reader.readString();
- int typeId = reader.readInt();
- int fieldId = reader.readInt();
-
- return new IgniteBiTuple<String, BinaryFieldMetadata>(name,
- new BinaryFieldMetadata(typeId, fieldId));
- }
- });
-
- Map<String, Integer> enumMap = null;
-
- boolean isEnum = reader.readBoolean();
-
- if (isEnum) {
- int size = reader.readInt();
-
- enumMap = new LinkedHashMap<>(size);
-
- for (int idx = 0; idx < size; idx++)
- enumMap.put(reader.readString(), reader.readInt());
- }
-
- // Read schemas
- int schemaCnt = reader.readInt();
-
- List<BinarySchema> schemas = null;
-
- if (schemaCnt > 0) {
- schemas = new ArrayList<>(schemaCnt);
-
- for (int i = 0; i < schemaCnt; i++) {
- int id = reader.readInt();
- int fieldCnt = reader.readInt();
- List<Integer> fieldIds = new ArrayList<>(fieldCnt);
-
- for (int j = 0; j < fieldCnt; j++)
- fieldIds.add(reader.readInt());
-
- schemas.add(new BinarySchema(id, fieldIds));
- }
- }
-
- return new BinaryMetadata(typeId, typeName, fields, affKey, schemas, isEnum, enumMap);
- }
- }
- );
+ Collection<BinaryMetadata> metas = PlatformUtils.readBinaryMetadataCollection(reader);
BinaryContext binCtx = cacheObjProc.binaryContext();
@@ -418,7 +354,7 @@ public class PlatformContextImpl implements PlatformContext {
/** {@inheritDoc} */
@Override public void writeMetadata(BinaryRawWriterEx writer, int typeId) {
- writeMetadata0(writer, typeId, cacheObjProc.metadata(typeId));
+ writeMetadata0(writer, cacheObjProc.metadata(typeId));
}
/** {@inheritDoc} */
@@ -428,78 +364,29 @@ public class PlatformContextImpl implements PlatformContext {
writer.writeInt(metas.size());
for (BinaryType m : metas)
- writeMetadata0(writer, cacheObjProc.typeId(m.typeName()), m);
+ writeMetadata0(writer, m);
}
/** {@inheritDoc} */
@Override public void writeSchema(BinaryRawWriterEx writer, int typeId, int schemaId) {
- BinarySchemaRegistry schemaReg = cacheObjProc.binaryContext().schemaRegistry(typeId);
- BinarySchema schema = schemaReg.schema(schemaId);
-
- if (schema == null) {
- BinaryTypeImpl meta = (BinaryTypeImpl)cacheObjProc.metadata(typeId);
-
- if (meta != null) {
- for (BinarySchema typeSchema : meta.metadata().schemas()) {
- if (schemaId == typeSchema.schemaId()) {
- schema = typeSchema;
- break;
- }
- }
- }
-
- if (schema != null)
- schemaReg.addSchema(schemaId, schema);
- }
-
- int[] fieldIds = schema == null ? null : schema.fieldIds();
-
- writer.writeIntArray(fieldIds);
+ writer.writeIntArray(PlatformUtils.getSchema(cacheObjProc, typeId, schemaId));
}
/**
* Write binary metadata.
*
* @param writer Writer.
- * @param typeId Type id.
* @param meta Metadata.
*/
- private void writeMetadata0(BinaryRawWriterEx writer, int typeId, BinaryType meta) {
+ private void writeMetadata0(BinaryRawWriterEx writer, BinaryType meta) {
if (meta == null)
writer.writeBoolean(false);
else {
writer.writeBoolean(true);
BinaryMetadata meta0 = ((BinaryTypeImpl) meta).metadata();
- Map<String, BinaryFieldMetadata> fields = meta0.fieldsMap();
-
- writer.writeInt(typeId);
- writer.writeString(meta.typeName());
- writer.writeString(meta.affinityKeyFieldName());
-
- writer.writeInt(fields.size());
- for (Map.Entry<String, BinaryFieldMetadata> e : fields.entrySet()) {
- writer.writeString(e.getKey());
-
- writer.writeInt(e.getValue().typeId());
- writer.writeInt(e.getValue().fieldId());
- }
-
- if (meta.isEnum()) {
- writer.writeBoolean(true);
-
- Map<String, Integer> enumMap = meta0.enumMap();
-
- writer.writeInt(enumMap.size());
-
- for (Map.Entry<String, Integer> e: enumMap.entrySet()) {
- writer.writeString(e.getKey());
- writer.writeInt(e.getValue());
- }
- }
- else
- writer.writeBoolean(false);
+ PlatformUtils.writeBinaryMetadata(writer, meta0, false);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/db88d6ba/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientMessageParser.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientMessageParser.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientMessageParser.java
index 3626de8..f098383 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientMessageParser.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientMessageParser.java
@@ -29,6 +29,10 @@ import org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProce
import org.apache.ignite.internal.processors.odbc.SqlListenerMessageParser;
import org.apache.ignite.internal.processors.odbc.SqlListenerRequest;
import org.apache.ignite.internal.processors.odbc.SqlListenerResponse;
+import org.apache.ignite.internal.processors.platform.client.binary.ClientBinaryTypeNameGetRequest;
+import org.apache.ignite.internal.processors.platform.client.binary.ClientBinaryTypeGetRequest;
+import org.apache.ignite.internal.processors.platform.client.binary.ClientBinaryTypePutRequest;
+import org.apache.ignite.internal.processors.platform.client.binary.ClientBinaryTypeNamePutRequest;
import org.apache.ignite.internal.processors.platform.client.cache.ClientCacheGetRequest;
import org.apache.ignite.internal.processors.platform.client.cache.ClientCachePutRequest;
@@ -40,8 +44,20 @@ public class ClientMessageParser implements SqlListenerMessageParser {
private static final short OP_CACHE_GET = 1;
/** */
+ private static final short OP_GET_BINARY_TYPE_NAME = 2;
+
+ /** */
+ private static final short OP_GET_BINARY_TYPE = 3;
+
+ /** */
private static final short OP_CACHE_PUT = 4;
+ /** */
+ private static final short OP_REGISTER_BINARY_TYPE_NAME = 5;
+
+ /** */
+ private static final short OP_PUT_BINARY_TYPE = 6;
+
/** Marshaller. */
private final GridBinaryMarshaller marsh;
@@ -70,8 +86,20 @@ public class ClientMessageParser implements SqlListenerMessageParser {
case OP_CACHE_GET:
return new ClientCacheGetRequest(reader);
+ case OP_GET_BINARY_TYPE_NAME:
+ return new ClientBinaryTypeNameGetRequest(reader);
+
+ case OP_GET_BINARY_TYPE:
+ return new ClientBinaryTypeGetRequest(reader);
+
case OP_CACHE_PUT:
return new ClientCachePutRequest(reader);
+
+ case OP_REGISTER_BINARY_TYPE_NAME:
+ return new ClientBinaryTypeNamePutRequest(reader);
+
+ case OP_PUT_BINARY_TYPE:
+ return new ClientBinaryTypePutRequest(reader);
}
throw new IgniteException("Invalid operation: " + opCode);
http://git-wip-us.apache.org/repos/asf/ignite/blob/db88d6ba/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientStringResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientStringResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientStringResponse.java
new file mode 100644
index 0000000..d9f955d
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientStringResponse.java
@@ -0,0 +1,47 @@
+/*
+ * 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.platform.client;
+
+import org.apache.ignite.binary.BinaryRawWriter;
+
+/**
+ * Single string response.
+ */
+public class ClientStringResponse extends ClientResponse {
+ /** Value. */
+ private final String val;
+
+ /**
+ * Constructor.
+ *
+ * @param reqId Request id.
+ * @param val Value.
+ */
+ public ClientStringResponse(long reqId, String val) {
+ super(reqId);
+
+ this.val = val;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void encode(BinaryRawWriter writer) {
+ super.encode(writer);
+
+ writer.writeString(val);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/db88d6ba/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/binary/ClientBinaryTypeGetRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/binary/ClientBinaryTypeGetRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/binary/ClientBinaryTypeGetRequest.java
new file mode 100644
index 0000000..be64e91
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/binary/ClientBinaryTypeGetRequest.java
@@ -0,0 +1,50 @@
+/*
+ * 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.platform.client.binary;
+
+import org.apache.ignite.binary.BinaryRawReader;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.binary.BinaryTypeImpl;
+import org.apache.ignite.internal.processors.platform.client.ClientRequest;
+import org.apache.ignite.internal.processors.platform.client.ClientResponse;
+
+/**
+ * Binary type schema request.
+ */
+public class ClientBinaryTypeGetRequest extends ClientRequest {
+ /** Type id. */
+ private final int typeId;
+
+ /**
+ * Constructor.
+ *
+ * @param reader Reader.
+ */
+ public ClientBinaryTypeGetRequest(BinaryRawReader reader) {
+ super(reader);
+
+ typeId = reader.readInt();
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClientResponse process(GridKernalContext ctx) {
+ BinaryTypeImpl type = (BinaryTypeImpl) ctx.cacheObjects().binary().type(typeId);
+
+ return new ClientBinaryTypeGetResponse(requestId(), type.metadata());
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/db88d6ba/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/binary/ClientBinaryTypeGetResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/binary/ClientBinaryTypeGetResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/binary/ClientBinaryTypeGetResponse.java
new file mode 100644
index 0000000..0f44cbf
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/binary/ClientBinaryTypeGetResponse.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.platform.client.binary;
+
+import org.apache.ignite.binary.BinaryRawWriter;
+import org.apache.ignite.internal.binary.BinaryMetadata;
+import org.apache.ignite.internal.processors.platform.client.ClientResponse;
+import org.apache.ignite.internal.processors.platform.utils.PlatformUtils;
+
+/**
+ * Binary meta response.
+ */
+public class ClientBinaryTypeGetResponse extends ClientResponse {
+ /** Meta. */
+ private final BinaryMetadata meta;
+
+ /**
+ * Constructor.
+ *
+ * @param requestId Request id.
+ */
+ ClientBinaryTypeGetResponse(long requestId, BinaryMetadata meta) {
+ super(requestId);
+
+ assert meta != null;
+
+ this.meta = meta;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void encode(BinaryRawWriter writer) {
+ super.encode(writer);
+
+ PlatformUtils.writeBinaryMetadata(writer, meta, true);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/db88d6ba/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/binary/ClientBinaryTypeNameGetRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/binary/ClientBinaryTypeNameGetRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/binary/ClientBinaryTypeNameGetRequest.java
new file mode 100644
index 0000000..37f4d9e
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/binary/ClientBinaryTypeNameGetRequest.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.internal.processors.platform.client.binary;
+
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.binary.BinaryRawReader;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.processors.platform.client.ClientRequest;
+import org.apache.ignite.internal.processors.platform.client.ClientResponse;
+import org.apache.ignite.internal.processors.platform.client.ClientStringResponse;
+
+/**
+ * Gets binary type name by id.
+ */
+public class ClientBinaryTypeNameGetRequest extends ClientRequest {
+ /** Platform ID, see org.apache.ignite.internal.MarshallerPlatformIds. */
+ private final byte platformId;
+
+ /** Type id. */
+ private final int typeId;
+
+ /**
+ * Constructor.
+ *
+ * @param reader Reader.
+ */
+ public ClientBinaryTypeNameGetRequest(BinaryRawReader reader) {
+ super(reader);
+
+ platformId = reader.readByte();
+ typeId = reader.readInt();
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClientResponse process(GridKernalContext ctx) {
+ try {
+ String typeName = ctx.marshallerContext().getClassName(platformId, typeId);
+
+ return new ClientStringResponse(requestId(), typeName);
+ }
+ catch (ClassNotFoundException | IgniteCheckedException e) {
+ throw new IgniteException(e);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/db88d6ba/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/binary/ClientBinaryTypeNamePutRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/binary/ClientBinaryTypeNamePutRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/binary/ClientBinaryTypeNamePutRequest.java
new file mode 100644
index 0000000..268e13b
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/binary/ClientBinaryTypeNamePutRequest.java
@@ -0,0 +1,65 @@
+/*
+ * 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.platform.client.binary;
+
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.binary.BinaryRawReader;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.processors.platform.client.ClientBooleanResponse;
+import org.apache.ignite.internal.processors.platform.client.ClientRequest;
+import org.apache.ignite.internal.processors.platform.client.ClientResponse;
+
+/**
+ * Gets binary type name by id.
+ */
+public class ClientBinaryTypeNamePutRequest extends ClientRequest {
+ /** Platform ID, see org.apache.ignite.internal.MarshallerPlatformIds. */
+ private final byte platformId;
+
+ /** Type id. */
+ private final int typeId;
+
+ /** Type name. */
+ private final String typeName;
+
+ /**
+ * Constructor.
+ *
+ * @param reader Reader.
+ */
+ public ClientBinaryTypeNamePutRequest(BinaryRawReader reader) {
+ super(reader);
+
+ platformId = reader.readByte();
+ typeId = reader.readInt();
+ typeName = reader.readString();
+ }
+
+ /** {@inheritDoc} */
+ @Override public ClientResponse process(GridKernalContext ctx) {
+ try {
+ boolean res = ctx.marshallerContext().registerClassName(platformId, typeId, typeName);
+
+ return new ClientBooleanResponse(requestId(), res);
+ }
+ catch (IgniteCheckedException e) {
+ throw new IgniteException(e);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/db88d6ba/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/binary/ClientBinaryTypePutRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/binary/ClientBinaryTypePutRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/binary/ClientBinaryTypePutRequest.java
new file mode 100644
index 0000000..aeb6e02
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/binary/ClientBinaryTypePutRequest.java
@@ -0,0 +1,56 @@
+/*
+ * 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.platform.client.binary;
+
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.binary.BinaryContext;
+import org.apache.ignite.internal.binary.BinaryMetadata;
+import org.apache.ignite.internal.binary.BinaryRawReaderEx;
+import org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl;
+import org.apache.ignite.internal.processors.platform.client.ClientRequest;
+import org.apache.ignite.internal.processors.platform.client.ClientResponse;
+import org.apache.ignite.internal.processors.platform.utils.PlatformUtils;
+
+/**
+ * Binary types update request.
+ */
+public class ClientBinaryTypePutRequest extends ClientRequest {
+ /** Meta. */
+ private final BinaryMetadata meta;
+
+ /**
+ * Constructor.
+ *
+ * @param reader Reader.
+ */
+ public ClientBinaryTypePutRequest(BinaryRawReaderEx reader) {
+ super(reader);
+
+ meta = PlatformUtils.readBinaryMetadata(reader);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override public ClientResponse process(GridKernalContext ctx) {
+ BinaryContext binCtx = ((CacheObjectBinaryProcessorImpl) ctx.cacheObjects()).binaryContext();
+
+ binCtx.updateMetadata(meta.typeId(), meta);
+
+ return super.process(ctx);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/db88d6ba/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformUtils.java
index 2f7e782..aa11dfa 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformUtils.java
@@ -17,39 +17,30 @@
package org.apache.ignite.internal.processors.platform.utils;
-import java.lang.reflect.Field;
-import java.math.BigDecimal;
-import java.security.Timestamp;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-import javax.cache.CacheException;
-import javax.cache.event.CacheEntryEvent;
-import javax.cache.event.CacheEntryListenerException;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.binary.BinaryObject;
+import org.apache.ignite.binary.BinaryRawWriter;
import org.apache.ignite.cache.CachePeekMode;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.MarshallerContextImpl;
import org.apache.ignite.internal.binary.BinaryContext;
+import org.apache.ignite.internal.binary.BinaryFieldMetadata;
import org.apache.ignite.internal.binary.BinaryMarshaller;
+import org.apache.ignite.internal.binary.BinaryMetadata;
import org.apache.ignite.internal.binary.BinaryNoopMetadataHandler;
import org.apache.ignite.internal.binary.BinaryRawReaderEx;
import org.apache.ignite.internal.binary.BinaryRawWriterEx;
+import org.apache.ignite.internal.binary.BinarySchema;
+import org.apache.ignite.internal.binary.BinarySchemaRegistry;
+import org.apache.ignite.internal.binary.BinaryTypeImpl;
import org.apache.ignite.internal.binary.BinaryUtils;
import org.apache.ignite.internal.binary.GridBinaryMarshaller;
+import org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl;
import org.apache.ignite.internal.processors.platform.PlatformContext;
import org.apache.ignite.internal.processors.platform.PlatformExtendedException;
import org.apache.ignite.internal.processors.platform.PlatformNativeException;
@@ -68,6 +59,23 @@ import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.logger.NullLogger;
import org.jetbrains.annotations.Nullable;
+import javax.cache.CacheException;
+import javax.cache.event.CacheEntryEvent;
+import javax.cache.event.CacheEntryListenerException;
+import java.lang.reflect.Field;
+import java.math.BigDecimal;
+import java.security.Timestamp;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PREFIX;
/**
@@ -1053,6 +1061,170 @@ public class PlatformUtils {
}
/**
+ * Gets the schema.
+ *
+ * @param cacheObjProc Cache object processor.
+ * @param typeId Type id.
+ * @param schemaId Schema id.
+ */
+ public static int[] getSchema(CacheObjectBinaryProcessorImpl cacheObjProc, int typeId, int schemaId) {
+ assert cacheObjProc != null;
+
+ BinarySchemaRegistry schemaReg = cacheObjProc.binaryContext().schemaRegistry(typeId);
+ BinarySchema schema = schemaReg.schema(schemaId);
+
+ if (schema == null) {
+ BinaryTypeImpl meta = (BinaryTypeImpl)cacheObjProc.metadata(typeId);
+
+ if (meta != null) {
+ for (BinarySchema typeSchema : meta.metadata().schemas()) {
+ if (schemaId == typeSchema.schemaId()) {
+ schema = typeSchema;
+ break;
+ }
+ }
+ }
+
+ if (schema != null) {
+ schemaReg.addSchema(schemaId, schema);
+ }
+ }
+
+ return schema == null ? null : schema.fieldIds();
+ }
+
+ /**
+ * Writes the binary metadata to a writer.
+ *
+ * @param writer Writer.
+ * @param meta Meta.
+ */
+ public static void writeBinaryMetadata(BinaryRawWriter writer, BinaryMetadata meta, boolean includeSchemas) {
+ assert meta != null;
+
+ Map<String, BinaryFieldMetadata> fields = meta.fieldsMap();
+
+ writer.writeInt(meta.typeId());
+ writer.writeString(meta.typeName());
+ writer.writeString(meta.affinityKeyFieldName());
+
+ writer.writeInt(fields.size());
+
+ for (Map.Entry<String, BinaryFieldMetadata> e : fields.entrySet()) {
+ writer.writeString(e.getKey());
+
+ writer.writeInt(e.getValue().typeId());
+ writer.writeInt(e.getValue().fieldId());
+ }
+
+ if (meta.isEnum()) {
+ writer.writeBoolean(true);
+
+ Map<String, Integer> enumMap = meta.enumMap();
+
+ writer.writeInt(enumMap.size());
+
+ for (Map.Entry<String, Integer> e: enumMap.entrySet()) {
+ writer.writeString(e.getKey());
+ writer.writeInt(e.getValue());
+ }
+ }
+ else {
+ writer.writeBoolean(false);
+ }
+
+ if (!includeSchemas) {
+ return;
+ }
+
+ // Schemas.
+ Collection<BinarySchema> schemas = meta.schemas();
+
+ writer.writeInt(schemas.size());
+
+ for (BinarySchema schema : schemas) {
+ writer.writeInt(schema.schemaId());
+ writer.writeIntArray(schema.fieldIds());
+ }
+ }
+
+ /**
+ * Reads the binary metadata.
+ *
+ * @param reader Reader.
+ * @return Collection of metas.
+ */
+ public static Collection<BinaryMetadata> readBinaryMetadataCollection(BinaryRawReaderEx reader) {
+ return readCollection(reader,
+ new PlatformReaderClosure<BinaryMetadata>() {
+ @Override public BinaryMetadata read(BinaryRawReaderEx reader) {
+ return readBinaryMetadata(reader);
+ }
+ }
+ );
+ }
+
+ /**
+ * Reads the binary metadata.
+ *
+ * @param reader Reader.
+ * @return Binary type metadata.
+ */
+ public static BinaryMetadata readBinaryMetadata(BinaryRawReaderEx reader) {
+ int typeId = reader.readInt();
+ String typeName = reader.readString();
+ String affKey = reader.readString();
+
+ Map<String, BinaryFieldMetadata> fields = readLinkedMap(reader,
+ new PlatformReaderBiClosure<String, BinaryFieldMetadata>() {
+ @Override
+ public IgniteBiTuple<String, BinaryFieldMetadata> read(BinaryRawReaderEx reader) {
+ String name = reader.readString();
+ int typeId = reader.readInt();
+ int fieldId = reader.readInt();
+
+ return new IgniteBiTuple<String, BinaryFieldMetadata>(name,
+ new BinaryFieldMetadata(typeId, fieldId));
+ }
+ });
+
+ Map<String, Integer> enumMap = null;
+
+ boolean isEnum = reader.readBoolean();
+
+ if (isEnum) {
+ int size = reader.readInt();
+
+ enumMap = new LinkedHashMap<>(size);
+
+ for (int idx = 0; idx < size; idx++)
+ enumMap.put(reader.readString(), reader.readInt());
+ }
+
+ // Read schemas
+ int schemaCnt = reader.readInt();
+
+ List<BinarySchema> schemas = null;
+
+ if (schemaCnt > 0) {
+ schemas = new ArrayList<>(schemaCnt);
+
+ for (int i = 0; i < schemaCnt; i++) {
+ int id = reader.readInt();
+ int fieldCnt = reader.readInt();
+ List<Integer> fieldIds = new ArrayList<>(fieldCnt);
+
+ for (int j = 0; j < fieldCnt; j++)
+ fieldIds.add(reader.readInt());
+
+ schemas.add(new BinarySchema(id, fieldIds));
+ }
+ }
+
+ return new BinaryMetadata(typeId, typeName, fields, affKey, schemas, isEnum, enumMap);
+ }
+
+ /**
* Private constructor.
*/
private PlatformUtils() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/db88d6ba/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
index 0a100f7..65b8372 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
@@ -101,6 +101,7 @@
<Compile Include="Configuration\Package-Info.cs" />
<Compile Include="Impl\Binary\BinaryTypeId.cs" />
<Compile Include="Impl\Cache\Query\PlatformQueryQursorBase.cs" />
+ <Compile Include="Impl\Binary\IBinaryProcessor.cs" />
<Compile Include="Impl\IIgniteInternal.cs" />
<Compile Include="Impl\IPlatformTargetInternal.cs" />
<Compile Include="Impl\PersistentStore\PersistentStoreMetrics.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/db88d6ba/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryProcessor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryProcessor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryProcessor.cs
index 26b3f15..318fd07 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryProcessor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryProcessor.cs
@@ -25,7 +25,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <summary>
/// Binary metadata processor, delegates to PlatformBinaryProcessor in Java.
/// </summary>
- internal class BinaryProcessor : PlatformTargetAdapter
+ internal class BinaryProcessor : PlatformTargetAdapter, IBinaryProcessor
{
/// <summary>
/// Op codes.
@@ -104,74 +104,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="types">Binary types.</param>
public void PutBinaryTypes(ICollection<BinaryType> types)
{
- DoOutOp((int) Op.PutMeta, w =>
- {
- w.WriteInt(types.Count);
-
- foreach (var meta in types)
- {
- w.WriteInt(meta.TypeId);
- w.WriteString(meta.TypeName);
- w.WriteString(meta.AffinityKeyFieldName);
-
- var fields = meta.GetFieldsMap();
-
- w.WriteInt(fields.Count);
-
- foreach (var field in fields)
- {
- w.WriteString(field.Key);
- w.WriteInt(field.Value.TypeId);
- w.WriteInt(field.Value.FieldId);
- }
-
- // Enum data
- w.WriteBoolean(meta.IsEnum);
-
- if (meta.IsEnum)
- {
- if (meta.EnumValuesMap != null)
- {
- w.WriteInt(meta.EnumValuesMap.Count);
-
- foreach (var pair in meta.EnumValuesMap)
- {
- w.WriteString(pair.Key);
- w.WriteInt(pair.Value);
- }
- }
- else
- {
- w.WriteInt(0);
- }
- }
-
- // Send schemas
- var desc = meta.Descriptor;
- Debug.Assert(desc != null);
-
- var count = 0;
- var countPos = w.Stream.Position;
- w.WriteInt(0); // Reserve for count
-
- foreach (var schema in desc.Schema.GetAll())
- {
- w.WriteInt(schema.Key);
-
- var ids = schema.Value;
- w.WriteInt(ids.Length);
-
- foreach (var id in ids)
- w.WriteInt(id);
-
- count++;
- }
-
- w.Stream.WriteInt(countPos, count);
- }
- });
-
- Marshaller.OnBinaryTypesSent(types);
+ DoOutOp((int) Op.PutMeta, w => WriteBinaryTypes(w, types));
}
/// <summary>
@@ -238,5 +171,89 @@ namespace Apache.Ignite.Core.Impl.Binary
{
return DoOutInOp((int) Op.GetType, w => w.WriteInt(id), r => Marshaller.StartUnmarshal(r).ReadString());
}
+
+ /// <summary>
+ /// Writes the binary types.
+ /// </summary>
+ public static void WriteBinaryTypes(BinaryWriter w, ICollection<BinaryType> types)
+ {
+ Debug.Assert(w != null);
+ Debug.Assert(types != null);
+
+ w.WriteInt(types.Count);
+
+ foreach (var meta in types)
+ {
+ WriteBinaryType(w, meta);
+ }
+ }
+
+ /// <summary>
+ /// Writes the binary type.
+ /// </summary>
+ public static void WriteBinaryType(BinaryWriter w, BinaryType meta)
+ {
+ Debug.Assert(w != null);
+ Debug.Assert(meta != null);
+
+ w.WriteInt(meta.TypeId);
+ w.WriteString(meta.TypeName);
+ w.WriteString(meta.AffinityKeyFieldName);
+
+ var fields = meta.GetFieldsMap();
+
+ w.WriteInt(fields.Count);
+
+ foreach (var field in fields)
+ {
+ w.WriteString(field.Key);
+ w.WriteInt(field.Value.TypeId);
+ w.WriteInt(field.Value.FieldId);
+ }
+
+ // Enum data
+ w.WriteBoolean(meta.IsEnum);
+
+ if (meta.IsEnum)
+ {
+ if (meta.EnumValuesMap != null)
+ {
+ w.WriteInt(meta.EnumValuesMap.Count);
+
+ foreach (var pair in meta.EnumValuesMap)
+ {
+ w.WriteString(pair.Key);
+ w.WriteInt(pair.Value);
+ }
+ }
+ else
+ {
+ w.WriteInt(0);
+ }
+ }
+
+ // Send schemas
+ var desc = meta.Descriptor;
+ Debug.Assert(desc != null);
+
+ var count = 0;
+ var countPos = w.Stream.Position;
+ w.WriteInt(0); // Reserve for count
+
+ foreach (var schema in desc.Schema.GetAll())
+ {
+ w.WriteInt(schema.Key);
+
+ var ids = schema.Value;
+ w.WriteInt(ids.Length);
+
+ foreach (var id in ids)
+ w.WriteInt(id);
+
+ count++;
+ }
+
+ w.Stream.WriteInt(countPos, count);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/db88d6ba/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryProcessor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryProcessor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryProcessor.cs
new file mode 100644
index 0000000..c626c76
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryProcessor.cs
@@ -0,0 +1,73 @@
+/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Core.Impl.Binary
+{
+ using System.Collections.Generic;
+ using Apache.Ignite.Core.Binary;
+ using Apache.Ignite.Core.Impl.Binary.Metadata;
+
+ /// <summary>
+ /// Binary processor.
+ /// </summary>
+ internal interface IBinaryProcessor
+ {
+ /// <summary>
+ /// Gets metadata for specified type.
+ /// </summary>
+ BinaryType GetBinaryType(int typeId);
+
+ /// <summary>
+ /// Gets metadata for all known types.
+ /// </summary>
+ List<IBinaryType> GetBinaryTypes();
+
+ /// <summary>
+ /// Gets the schema.
+ /// </summary>
+ int[] GetSchema(int typeId, int schemaId);
+
+ /// <summary>
+ /// Put binary types to Grid.
+ /// </summary>
+ /// <param name="types">Binary types.</param>
+ void PutBinaryTypes(ICollection<BinaryType> types);
+
+ /// <summary>
+ /// Registers the type.
+ /// </summary>
+ /// <param name="id">The identifier.</param>
+ /// <param name="typeName">The type name.</param>
+ /// <returns>True if registration succeeded; otherwise, false.</returns>
+ bool RegisterType(int id, string typeName);
+
+ /// <summary>
+ /// Registers the enum.
+ /// </summary>
+ /// <param name="typeName">Name of the type.</param>
+ /// <param name="values">The values.</param>
+ /// <returns>Resulting binary type.</returns>
+ BinaryType RegisterEnum(string typeName, IEnumerable<KeyValuePair<string, int>> values);
+
+ /// <summary>
+ /// Gets the type name by id.
+ /// </summary>
+ /// <param name="id">The identifier.</param>
+ /// <returns>Type or null.</returns>
+ string GetTypeName(int id);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/db88d6ba/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
index 1f11e9e..e68aa0b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
@@ -185,6 +185,7 @@ namespace Apache.Ignite.Core.Impl.Binary
if (ignite != null && metas != null && metas.Count > 0)
{
ignite.BinaryProcessor.PutBinaryTypes(metas);
+ OnBinaryTypesSent(metas);
}
}
@@ -300,8 +301,9 @@ namespace Apache.Ignite.Core.Impl.Binary
if (Ignite != null)
{
- ICollection<BinaryType> metas = new[] {new BinaryType(desc, this)};
+ var metas = new[] {new BinaryType(desc, this)};
Ignite.BinaryProcessor.PutBinaryTypes(metas);
+ OnBinaryTypesSent(metas);
}
}
@@ -349,7 +351,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// Callback invoked when metadata has been sent to the server and acknowledged by it.
/// </summary>
/// <param name="newMetas">Binary types.</param>
- public void OnBinaryTypesSent(IEnumerable<BinaryType> newMetas)
+ private void OnBinaryTypesSent(IEnumerable<BinaryType> newMetas)
{
foreach (var meta in newMetas)
{
http://git-wip-us.apache.org/repos/asf/ignite/blob/db88d6ba/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryType.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryType.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryType.cs
index 7306474..514f2e2 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryType.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryType.cs
@@ -70,6 +70,9 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
/** Marshaller. */
private readonly Marshaller _marshaller;
+ /** Schema. */
+ private readonly BinaryObjectSchema _schema = new BinaryObjectSchema();
+
/// <summary>
/// Initializes the <see cref="BinaryType"/> class.
/// </summary>
@@ -128,7 +131,8 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
/// Initializes a new instance of the <see cref="BinaryType" /> class.
/// </summary>
/// <param name="reader">The reader.</param>
- public BinaryType(BinaryReader reader)
+ /// <param name="readSchemas">Whether to read schemas.</param>
+ public BinaryType(BinaryReader reader, bool readSchemas = false)
{
_typeId = reader.ReadInt();
_typeName = reader.ReadString();
@@ -162,6 +166,16 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
_enumValueToName = _enumNameToValue.ToDictionary(x => x.Value, x => x.Key);
}
+ if (readSchemas)
+ {
+ var cnt = reader.ReadInt();
+
+ for (var i = 0; i < cnt; i++)
+ {
+ _schema.Add(reader.ReadInt(), reader.ReadIntArray());
+ }
+ }
+
_marshaller = reader.Marshaller;
}
@@ -319,6 +333,14 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
}
/// <summary>
+ /// Gets the schema.
+ /// </summary>
+ public BinaryObjectSchema Schema
+ {
+ get { return _schema; }
+ }
+
+ /// <summary>
/// Updates the fields.
/// </summary>
public void UpdateFields(IDictionary<string, BinaryField> fields)
http://git-wip-us.apache.org/repos/asf/ignite/blob/db88d6ba/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IIgniteInternal.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IIgniteInternal.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IIgniteInternal.cs
index 789633b..5fd6faa 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IIgniteInternal.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IIgniteInternal.cs
@@ -32,7 +32,7 @@ namespace Apache.Ignite.Core.Impl
/// <summary>
/// Gets the binary processor.
/// </summary>
- BinaryProcessor BinaryProcessor { get; }
+ IBinaryProcessor BinaryProcessor { get; }
/// <summary>
/// Configuration.
http://git-wip-us.apache.org/repos/asf/ignite/blob/db88d6ba/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 630aa85..59dfe2a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
@@ -804,7 +804,7 @@ namespace Apache.Ignite.Core.Impl
/// <summary>
/// Gets the binary processor.
/// </summary>
- public BinaryProcessor BinaryProcessor
+ public IBinaryProcessor BinaryProcessor
{
get { return _binaryProc; }
}
[16/25] ignite git commit: ignite-5549 : Clear MvccManager.pending
queue after AsyncOp.op(...). - Fixes #2626.
Posted by sb...@apache.org.
ignite-5549 : Clear MvccManager.pending queue after AsyncOp.op(...). - Fixes #2626.
Signed-off-by: Alexey Goncharuk <al...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9514d4a6
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9514d4a6
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9514d4a6
Branch: refs/heads/ignite-6149
Commit: 9514d4a6b80becde2cea69afdb570e789bf47949
Parents: 1d95e52
Author: Ilya Lantukh <il...@gridgain.com>
Authored: Wed Sep 13 19:13:46 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Wed Sep 13 19:13:46 2017 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheAdapter.java | 87 ++++++++++++--------
1 file changed, 51 insertions(+), 36 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/9514d4a6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 8e346ba..fb6d097 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -4200,29 +4200,36 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
return new GridFinishedFuture<>(
new IgniteCheckedException("Operation has been cancelled (node is stopping)."));
- return op.op(tx0, opCtx).chain(new CX1<IgniteInternalFuture<T>, T>() {
- @Override public T applyx(IgniteInternalFuture<T> tFut) throws IgniteCheckedException {
- try {
- return tFut.get();
- }
- catch (IgniteTxRollbackCheckedException e) {
- throw e;
- }
- catch (IgniteCheckedException e1) {
+ try {
+ return op.op(tx0, opCtx).chain(new CX1<IgniteInternalFuture<T>, T>() {
+ @Override
+ public T applyx(IgniteInternalFuture<T> tFut) throws IgniteCheckedException {
try {
- tx0.rollbackNearTxLocalAsync();
+ return tFut.get();
}
- catch (Throwable e2) {
- e1.addSuppressed(e2);
+ catch (IgniteTxRollbackCheckedException e) {
+ throw e;
}
+ catch (IgniteCheckedException e1) {
+ try {
+ tx0.rollbackNearTxLocalAsync();
+ }
+ catch (Throwable e2) {
+ e1.addSuppressed(e2);
+ }
- throw e1;
- }
- finally {
- ctx.shared().txContextReset();
+ throw e1;
+ }
+ finally {
+ ctx.shared().txContextReset();
+ }
}
- }
- });
+ });
+ }
+ finally {
+ // It is necessary to clear tx context in this thread as well.
+ ctx.shared().txContextReset();
+ }
}
});
@@ -4231,29 +4238,37 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
return f;
}
- final IgniteInternalFuture<T> f = op.op(tx, opCtx).chain(new CX1<IgniteInternalFuture<T>, T>() {
- @Override public T applyx(IgniteInternalFuture<T> tFut) throws IgniteCheckedException {
- try {
- return tFut.get();
- }
- catch (IgniteTxRollbackCheckedException e) {
- throw e;
- }
- catch (IgniteCheckedException e1) {
+ IgniteInternalFuture<T> f;
+
+ try {
+ f = op.op(tx, opCtx).chain(new CX1<IgniteInternalFuture<T>, T>() {
+ @Override public T applyx(IgniteInternalFuture<T> tFut) throws IgniteCheckedException {
try {
- tx0.rollbackNearTxLocalAsync();
+ return tFut.get();
}
- catch (Throwable e2) {
- e1.addSuppressed(e2);
+ catch (IgniteTxRollbackCheckedException e) {
+ throw e;
}
+ catch (IgniteCheckedException e1) {
+ try {
+ tx0.rollbackNearTxLocalAsync();
+ }
+ catch (Throwable e2) {
+ e1.addSuppressed(e2);
+ }
- throw e1;
- }
- finally {
- ctx.shared().txContextReset();
+ throw e1;
+ }
+ finally {
+ ctx.shared().txContextReset();
+ }
}
- }
- });
+ });
+ }
+ finally {
+ // It is necessary to clear tx context in this thread as well.
+ ctx.shared().txContextReset();
+ }
saveFuture(holder, f, retry);
[14/25] ignite git commit: IGNITE-6330: Implemented closing of ODBC
and JDBC cursors on disconnect
Posted by sb...@apache.org.
IGNITE-6330: Implemented closing of ODBC and JDBC cursors on disconnect
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/28b5c116
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/28b5c116
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/28b5c116
Branch: refs/heads/ignite-6149
Commit: 28b5c1162cac13dad8d190b66bdd87380e632c86
Parents: 60d7588
Author: Igor Sapego <is...@gridgain.com>
Authored: Wed Sep 13 16:21:56 2017 +0300
Committer: Igor Sapego <is...@gridgain.com>
Committed: Wed Sep 13 16:21:56 2017 +0300
----------------------------------------------------------------------
.../odbc/SqlListenerConnectionContext.java | 6 ++++++
.../processors/odbc/SqlListenerNioListener.java | 5 +++++
.../odbc/jdbc/JdbcConnectionContext.java | 5 +++++
.../odbc/jdbc/JdbcRequestHandler.java | 20 +++++++++++++++++++-
.../odbc/odbc/OdbcConnectionContext.java | 5 +++++
.../odbc/odbc/OdbcRequestHandler.java | 18 ++++++++++++++++++
6 files changed, 58 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/28b5c116/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerConnectionContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerConnectionContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerConnectionContext.java
index a459a1f..3438d5a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerConnectionContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerConnectionContext.java
@@ -53,4 +53,10 @@ public interface SqlListenerConnectionContext {
* @return Message parser for the connection.
*/
SqlListenerMessageParser parser();
+
+ /**
+ * Called whenever client is disconnected due to correct connection close
+ * or due to {@code IOException} during network operations.
+ */
+ void onDisconnected();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/28b5c116/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java
index 339c8c1..81539dc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java
@@ -88,6 +88,11 @@ public class SqlListenerNioListener extends GridNioServerListenerAdapter<byte[]>
/** {@inheritDoc} */
@Override public void onDisconnected(GridNioSession ses, @Nullable Exception e) {
+ SqlListenerConnectionContext connCtx = ses.meta(CONN_CTX_META_KEY);
+
+ if (connCtx != null)
+ connCtx.onDisconnected();
+
if (log.isDebugEnabled()) {
if (e == null)
log.debug("SQL client disconnected: " + ses.remoteAddress());
http://git-wip-us.apache.org/repos/asf/ignite/blob/28b5c116/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcConnectionContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcConnectionContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcConnectionContext.java
index 035cb77..1f13fcf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcConnectionContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcConnectionContext.java
@@ -115,4 +115,9 @@ public class JdbcConnectionContext implements SqlListenerConnectionContext {
@Override public SqlListenerMessageParser parser() {
return parser;
}
+
+ /** {@inheritDoc} */
+ @Override public void onDisconnected() {
+ handler.onDisconnect();
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/28b5c116/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcRequestHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcRequestHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcRequestHandler.java
index 3ccc195..378c6cb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcRequestHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcRequestHandler.java
@@ -138,7 +138,7 @@ public class JdbcRequestHandler implements SqlListenerRequestHandler {
JdbcRequest req = (JdbcRequest)req0;
if (!busyLock.enterBusy())
- return new JdbcResponse(SqlListenerResponse.STATUS_FAILED,
+ return new JdbcResponse(SqlListenerResponse.STATUS_FAILED,
"Failed to handle JDBC request because node is stopping.");
try {
@@ -204,6 +204,24 @@ public class JdbcRequestHandler implements SqlListenerRequestHandler {
}
/**
+ * Called whenever client is disconnected due to correct connection close
+ * or due to {@code IOException} during network operations.
+ */
+ public void onDisconnect() {
+ if (busyLock.enterBusy())
+ {
+ try
+ {
+ for (JdbcQueryCursor cursor : qryCursors.values())
+ cursor.close();
+ }
+ finally {
+ busyLock.leaveBusy();
+ }
+ }
+ }
+
+ /**
* {@link JdbcQueryExecuteRequest} command handler.
*
* @param req Execute query request.
http://git-wip-us.apache.org/repos/asf/ignite/blob/28b5c116/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcConnectionContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcConnectionContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcConnectionContext.java
index 5e8a514..9b7bcbd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcConnectionContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcConnectionContext.java
@@ -113,4 +113,9 @@ public class OdbcConnectionContext implements SqlListenerConnectionContext {
@Override public SqlListenerMessageParser parser() {
return parser;
}
+
+ /** {@inheritDoc} */
+ @Override public void onDisconnected() {
+ handler.onDisconnect();
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/28b5c116/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java
index 19fe796..31053c7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java
@@ -170,6 +170,24 @@ public class OdbcRequestHandler implements SqlListenerRequestHandler {
}
/**
+ * Called whenever client is disconnected due to correct connection close
+ * or due to {@code IOException} during network operations.
+ */
+ public void onDisconnect() {
+ if (busyLock.enterBusy())
+ {
+ try
+ {
+ for (IgniteBiTuple<QueryCursor, Iterator> tuple : qryCursors.values())
+ tuple.get1().close();
+ }
+ finally {
+ busyLock.leaveBusy();
+ }
+ }
+ }
+
+ /**
* Make query considering handler configuration.
* @param schema Schema.
* @param sql SQL request.
[09/25] ignite git commit: IGNITE-6366 Improve web agent version
check.
Posted by sb...@apache.org.
IGNITE-6366 Improve web agent version check.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/40a9cc19
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/40a9cc19
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/40a9cc19
Branch: refs/heads/ignite-6149
Commit: 40a9cc1972af7c85bf45609e874ea43524eec299
Parents: 2b5224f
Author: anovikov <an...@gridgain.com>
Authored: Wed Sep 13 18:01:58 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Wed Sep 13 18:01:58 2017 +0700
----------------------------------------------------------------------
modules/web-console/backend/app/agentsHandler.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/40a9cc19/modules/web-console/backend/app/agentsHandler.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/app/agentsHandler.js b/modules/web-console/backend/app/agentsHandler.js
index a4ae385..112793a 100644
--- a/modules/web-console/backend/app/agentsHandler.js
+++ b/modules/web-console/backend/app/agentsHandler.js
@@ -288,7 +288,7 @@ module.exports.factory = function(_, fs, path, JSZip, socketio, settings, mongo,
if (ver && bt && !_.isEmpty(supportedAgents)) {
const btDistr = _.get(supportedAgents, [ver, 'buildTime']);
- if (_.isEmpty(btDistr) || btDistr < bt)
+ if (_.isEmpty(btDistr) || btDistr !== bt)
return cb('You are using an older version of the agent. Please reload agent');
}
[04/25] ignite git commit: IGNITE-6223 Fixed NPE when data is null on
job fail.
Posted by sb...@apache.org.
IGNITE-6223 Fixed NPE when data is null on job fail.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/fdfd4736
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/fdfd4736
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/fdfd4736
Branch: refs/heads/ignite-6149
Commit: fdfd47367756816104620a1f324e0e38f6a68d8f
Parents: d753e90
Author: vsisko <vs...@gridgain.com>
Authored: Wed Aug 30 16:43:17 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Wed Sep 13 17:25:53 2017 +0700
----------------------------------------------------------------------
.../console/agent/handlers/AbstractListener.java | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/fdfd4736/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/AbstractListener.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/AbstractListener.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/AbstractListener.java
index faf864b..2eec89b 100644
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/AbstractListener.java
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/AbstractListener.java
@@ -76,15 +76,17 @@ abstract class AbstractListener implements Emitter.Listener {
if (res instanceof RestResult) {
RestResult restRes = (RestResult) res;
- ByteArrayOutputStream baos = new ByteArrayOutputStream(4096);
- Base64OutputStream b64os = new Base64OutputStream(baos);
- GZIPOutputStream gzip = new GZIPOutputStream(b64os);
+ if (restRes.getData() != null) {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(4096);
+ Base64OutputStream b64os = new Base64OutputStream(baos);
+ GZIPOutputStream gzip = new GZIPOutputStream(b64os);
- gzip.write(restRes.getData().getBytes());
+ gzip.write(restRes.getData().getBytes());
- gzip.close();
+ gzip.close();
- restRes.zipData(baos.toString());
+ restRes.zipData(baos.toString());
+ }
}
cb.call(null, toJSON(res));
[23/25] ignite git commit: IGNITE-6367 Restrict files search by
IGNITE_HOME.
Posted by sb...@apache.org.
IGNITE-6367 Restrict files search by IGNITE_HOME.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b2c61b64
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b2c61b64
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b2c61b64
Branch: refs/heads/ignite-6149
Commit: b2c61b64dd764ea1684f7aba7c3a8458c498cc9e
Parents: db88d6b
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Fri Sep 15 11:47:53 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Sep 15 11:47:53 2017 +0700
----------------------------------------------------------------------
.../visor/file/VisorLatestTextFilesTask.java | 13 +++---
.../internal/visor/log/VisorLogSearchTask.java | 25 ++++++------
.../internal/visor/util/VisorTaskUtils.java | 43 ++++++++++++++++++--
3 files changed, 57 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b2c61b64/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorLatestTextFilesTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorLatestTextFilesTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorLatestTextFilesTask.java
index 9ae0b26..3b8defe 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorLatestTextFilesTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/file/VisorLatestTextFilesTask.java
@@ -18,13 +18,11 @@
package org.apache.ignite.internal.visor.file;
import java.io.File;
-import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.apache.ignite.internal.processors.task.GridInternal;
import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.internal.visor.VisorJob;
import org.apache.ignite.internal.visor.VisorOneNodeTask;
import org.apache.ignite.internal.visor.log.VisorLogFile;
@@ -32,6 +30,7 @@ import org.jetbrains.annotations.Nullable;
import static org.apache.ignite.internal.visor.util.VisorTaskUtils.LOG_FILES_COUNT_LIMIT;
import static org.apache.ignite.internal.visor.util.VisorTaskUtils.matchedFiles;
+import static org.apache.ignite.internal.visor.util.VisorTaskUtils.resolveIgnitePath;
/**
* Get list files matching filter.
@@ -69,13 +68,11 @@ public class VisorLatestTextFilesTask extends VisorOneNodeTask<VisorLatestTextFi
assert path != null;
assert regexp != null;
- URL url = U.resolveIgniteUrl(path);
-
- if (url == null)
- return null;
-
try {
- File folder = new File(url.toURI());
+ File folder = resolveIgnitePath(path);
+
+ if (folder == null)
+ return null;
List<VisorLogFile> files = matchedFiles(folder, regexp);
http://git-wip-us.apache.org/repos/asf/ignite/blob/b2c61b64/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchTask.java
index 59d532e..e4d2882 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/log/VisorLogSearchTask.java
@@ -18,9 +18,7 @@
package org.apache.ignite.internal.visor.log;
import java.io.File;
-import java.io.FileNotFoundException;
import java.io.IOException;
-import java.net.URL;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Collection;
@@ -42,6 +40,8 @@ import org.jetbrains.annotations.Nullable;
import static org.apache.ignite.internal.visor.util.VisorTaskUtils.decode;
import static org.apache.ignite.internal.visor.util.VisorTaskUtils.matchedFiles;
+import static org.apache.ignite.internal.visor.util.VisorTaskUtils.resolveIgnitePath;
+import static org.apache.ignite.internal.visor.util.VisorTaskUtils.resolveSymbolicLink;
import static org.apache.ignite.internal.visor.util.VisorTaskUtils.textFile;
/**
@@ -173,21 +173,22 @@ public class VisorLogSearchTask extends VisorMultiNodeTask<VisorLogSearchTaskArg
/** {@inheritDoc} */
@Override protected Collection<VisorLogSearchResult> run(VisorLogSearchTaskArg arg) {
- URL url = U.resolveIgniteUrl(arg.getFolder());
+ try {
+ File folder = resolveIgnitePath(arg.getFolder());
- if (url == null)
- throw new IgniteException(new FileNotFoundException("Log folder not found: " + arg.getFolder()));
+ if (folder == null)
+ return null;
- UUID uuid = ignite.localNode().id();
- String nid = uuid.toString().toLowerCase();
+ folder = resolveSymbolicLink(folder);
- String filePtrn = arg.getFilePattern().replace("@nid8", nid.substring(0, 8)).replace("@nid", nid);
+ UUID uuid = ignite.localNode().id();
+ String nid = uuid.toString().toLowerCase();
- try {
- File fld = new File(url.toURI());
- int pathIdx = (fld.isDirectory() ? fld : fld.getParentFile()).getAbsolutePath().length() + 1;
+ String filePtrn = arg.getFilePattern().replace("@nid8", nid.substring(0, 8)).replace("@nid", nid);
+
+ int pathIdx = (folder.isDirectory() ? folder : folder.getParentFile()).getAbsolutePath().length() + 1;
- List<VisorLogFile> matchingFiles = matchedFiles(fld, filePtrn);
+ List<VisorLogFile> matchingFiles = matchedFiles(folder, filePtrn);
Collection<VisorLogSearchResult> results = new ArrayList<>(arg.getLimit());
http://git-wip-us.apache.org/repos/asf/ignite/blob/b2c61b64/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
index 30cb499..ace451c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
@@ -30,7 +30,10 @@ import java.nio.channels.FileChannel;
import java.nio.charset.CharacterCodingException;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
+import java.nio.file.Files;
+import java.nio.file.LinkOption;
import java.nio.file.Path;
+import java.nio.file.Paths;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
@@ -525,14 +528,45 @@ public class VisorTaskUtils {
}
/**
+ * @param path Path to resolve only relative to IGNITE_HOME.
+ * @return Resolved path as file, or {@code null} if path cannot be resolved.
+ * @throws IOException If failed to resolve path.
+ */
+ public static File resolveIgnitePath(String path) throws IOException {
+ File folder = U.resolveIgnitePath(path);
+
+ if (folder == null)
+ return null;
+
+ if (!folder.toPath().toRealPath(LinkOption.NOFOLLOW_LINKS).startsWith(Paths.get(U.getIgniteHome())))
+ return null;
+
+ return folder;
+ }
+
+ /**
+ * @param file File to resolve.
+ * @return Resolved file if it is a symbolic link or original file.
+ * @throws IOException If failed to resolve symlink.
+ */
+ public static File resolveSymbolicLink(File file) throws IOException {
+ Path path = file.toPath();
+
+ return Files.isSymbolicLink(path) ? Files.readSymbolicLink(path).toFile() : file;
+ }
+
+ /**
* Finds all files in folder and in it's sub-tree of specified depth.
*
* @param file Starting folder
* @param maxDepth Depth of the tree. If 1 - just look in the folder, no sub-folders.
* @param filter file filter.
* @return List of found files.
+ * @throws IOException If failed to list files.
*/
- public static List<VisorLogFile> fileTree(File file, int maxDepth, @Nullable FileFilter filter) {
+ public static List<VisorLogFile> fileTree(File file, int maxDepth, @Nullable FileFilter filter) throws IOException {
+ file = resolveSymbolicLink(file);
+
if (file.isDirectory()) {
File[] files = (filter == null) ? file.listFiles() : file.listFiles(filter);
@@ -556,12 +590,13 @@ public class VisorTaskUtils {
}
/**
- * @param fld Folder with files to match.
+ * @param file Folder with files to match.
* @param ptrn Pattern to match against file name.
* @return Collection of matched files.
+ * @throws IOException If failed to filter files.
*/
- public static List<VisorLogFile> matchedFiles(File fld, final String ptrn) {
- List<VisorLogFile> files = fileTree(fld, MAX_FOLDER_DEPTH,
+ public static List<VisorLogFile> matchedFiles(File file, final String ptrn) throws IOException {
+ List<VisorLogFile> files = fileTree(file, MAX_FOLDER_DEPTH,
new FileFilter() {
@Override public boolean accept(File f) {
return !f.isHidden() && (f.isDirectory() || f.isFile() && f.getName().matches(ptrn));