You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2016/11/22 11:39:50 UTC
[01/50] [abbrv] ignite git commit: Added license header.
Repository: ignite
Updated Branches:
refs/heads/master a884db53f -> 5ffb8a74d
Added license header.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5a3a1960
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5a3a1960
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5a3a1960
Branch: refs/heads/master
Commit: 5a3a1960fff1dcf32961c45c0ba5149d6748d2fc
Parents: 9726421
Author: Igor Sapego <is...@gridgain.com>
Authored: Tue Nov 8 17:36:35 2016 +0300
Committer: Igor Sapego <is...@gridgain.com>
Committed: Tue Nov 8 17:36:35 2016 +0300
----------------------------------------------------------------------
.../security/SecurityPermissionSetBuilderTest.java | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/5a3a1960/modules/core/src/test/java/org/apache/ignite/plugin/security/SecurityPermissionSetBuilderTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/plugin/security/SecurityPermissionSetBuilderTest.java b/modules/core/src/test/java/org/apache/ignite/plugin/security/SecurityPermissionSetBuilderTest.java
index 1d951cf..f63f9a7 100644
--- a/modules/core/src/test/java/org/apache/ignite/plugin/security/SecurityPermissionSetBuilderTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/plugin/security/SecurityPermissionSetBuilderTest.java
@@ -1,3 +1,20 @@
+/*
+ * 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.plugin.security;
import java.util.Map;
[27/50] [abbrv] ignite git commit: IGNITE-3191: Fields are now sorted
for binary objects which don't implement Binarylizable interface. This closes
#1197.
Posted by sb...@apache.org.
IGNITE-3191: Fields are now sorted for binary objects which don't implement Binarylizable interface. This closes #1197.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6e36a795
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6e36a795
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6e36a795
Branch: refs/heads/master
Commit: 6e36a7950db84913ddfd0d98f5a0b50923d2a29c
Parents: a2a3bed
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Tue Nov 15 12:42:29 2016 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Tue Nov 15 12:42:29 2016 +0300
----------------------------------------------------------------------
.../apache/ignite/IgniteSystemProperties.java | 9 +++++
.../internal/binary/BinaryClassDescriptor.java | 37 ++++++++++++++++----
.../ignite/internal/binary/BinaryContext.java | 11 ++----
.../ignite/internal/binary/BinaryUtils.java | 4 +++
.../binary/builder/BinaryObjectBuilderImpl.java | 6 +++-
5 files changed, 51 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6e36a795/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
index a75027b..22cb9a6 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
@@ -478,6 +478,15 @@ public final class IgniteSystemProperties {
public static final String IGNITE_BINARY_DONT_WRAP_TREE_STRUCTURES = "IGNITE_BINARY_DONT_WRAP_TREE_STRUCTURES";
/**
+ * When set to {@code true} fields are written by BinaryMarshaller in sorted order. Otherwise
+ * the natural order is used.
+ * <p>
+ * @deprecated Should be removed in Apache Ignite 2.0.
+ */
+ @Deprecated
+ public static final String IGNITE_BINARY_SORT_OBJECT_FIELDS = "IGNITE_BINARY_SORT_OBJECT_FIELDS";
+
+ /**
* Enforces singleton.
*/
private IgniteSystemProperties() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/6e36a795/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
index 4c824d4..d05ce71 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
@@ -25,14 +25,15 @@ import java.lang.reflect.Modifier;
import java.lang.reflect.Proxy;
import java.math.BigDecimal;
import java.sql.Timestamp;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
+import java.util.TreeMap;
import java.util.UUID;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.binary.BinaryObjectException;
@@ -120,6 +121,9 @@ public class BinaryClassDescriptor {
/** */
private final Class<?>[] intfs;
+ /** Whether stable schema was published. */
+ private volatile boolean stableSchemaPublished;
+
/**
* @param ctx Context.
* @param cls Class.
@@ -269,10 +273,14 @@ public class BinaryClassDescriptor {
case OBJECT:
// Must not use constructor to honor transient fields semantics.
ctor = null;
- ArrayList<BinaryFieldAccessor> fields0 = new ArrayList<>();
stableFieldsMeta = metaDataEnabled ? new HashMap<String, Integer>() : null;
- BinarySchema.Builder schemaBuilder = BinarySchema.Builder.newBuilder();
+ Map<Object, BinaryFieldAccessor> fields0;
+
+ if (BinaryUtils.FIELDS_SORTED_ORDER)
+ fields0 = new TreeMap<>();
+ else
+ fields0 = new LinkedHashMap<>();
Set<String> duplicates = duplicateFields(cls);
@@ -300,9 +308,7 @@ public class BinaryClassDescriptor {
BinaryFieldAccessor fieldInfo = BinaryFieldAccessor.create(f, fieldId);
- fields0.add(fieldInfo);
-
- schemaBuilder.addField(fieldId);
+ fields0.put(name, fieldInfo);
if (metaDataEnabled)
stableFieldsMeta.put(name, fieldInfo.mode().typeId());
@@ -310,7 +316,12 @@ public class BinaryClassDescriptor {
}
}
- fields = fields0.toArray(new BinaryFieldAccessor[fields0.size()]);
+ fields = fields0.values().toArray(new BinaryFieldAccessor[fields0.size()]);
+
+ BinarySchema.Builder schemaBuilder = BinarySchema.Builder.newBuilder();
+
+ for (BinaryFieldAccessor field : fields)
+ schemaBuilder.addField(field.id);
stableSchema = schemaBuilder.build();
@@ -747,6 +758,18 @@ public class BinaryClassDescriptor {
break;
case OBJECT:
+ if (userType && !stableSchemaPublished) {
+ // Update meta before write object with new schema
+ BinaryMetadata meta = new BinaryMetadata(typeId, typeName, stableFieldsMeta,
+ affKeyFieldName, Collections.singleton(stableSchema), false);
+
+ ctx.updateMetadata(typeId, meta);
+
+ schemaReg.addSchema(stableSchema.schemaId(), stableSchema);
+
+ stableSchemaPublished = true;
+ }
+
if (preWrite(writer, obj)) {
try {
for (BinaryFieldAccessor info : fields)
http://git-wip-us.apache.org/repos/asf/ignite/blob/6e36a795/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
index 2ac8b7f..a72e7ac 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
@@ -785,12 +785,9 @@ public class BinaryContext {
registered
);
- if (!deserialize) {
- Collection<BinarySchema> schemas = desc.schema() != null ? Collections.singleton(desc.schema()) : null;
-
+ if (!deserialize)
metaHnd.addMeta(typeId,
- new BinaryMetadata(typeId, typeName, desc.fieldsMeta(), affFieldName, schemas, desc.isEnum()).wrap(this));
- }
+ new BinaryMetadata(typeId, typeName, desc.fieldsMeta(), affFieldName, null, desc.isEnum()).wrap(this));
descByCls.put(cls, desc);
@@ -1123,7 +1120,6 @@ public class BinaryContext {
cls2Mappers.put(clsName, mapper);
Map<String, Integer> fieldsMeta = null;
- Collection<BinarySchema> schemas = null;
if (cls != null) {
if (serializer == null) {
@@ -1148,7 +1144,6 @@ public class BinaryContext {
);
fieldsMeta = desc.fieldsMeta();
- schemas = desc.schema() != null ? Collections.singleton(desc.schema()) : null;
descByCls.put(cls, desc);
@@ -1157,7 +1152,7 @@ public class BinaryContext {
predefinedTypes.put(id, desc);
}
- metaHnd.addMeta(id, new BinaryMetadata(id, typeName, fieldsMeta, affKeyFieldName, schemas, isEnum).wrap(this));
+ metaHnd.addMeta(id, new BinaryMetadata(id, typeName, fieldsMeta, affKeyFieldName, null, isEnum).wrap(this));
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/6e36a795/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
index 25d87ff..b304082 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
@@ -128,6 +128,10 @@ public class BinaryUtils {
public static final boolean WRAP_TREES =
!IgniteSystemProperties.getBoolean(IgniteSystemProperties.IGNITE_BINARY_DONT_WRAP_TREE_STRUCTURES);
+ /** Whether to sort field in binary objects (doesn't affect Binarylizable). */
+ public static final boolean FIELDS_SORTED_ORDER =
+ IgniteSystemProperties.getBoolean(IgniteSystemProperties.IGNITE_BINARY_SORT_OBJECT_FIELDS);
+
/** Field type names. */
private static final String[] FIELD_TYPE_NAMES;
http://git-wip-us.apache.org/repos/asf/ignite/blob/6e36a795/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
index 2c76192..f0bc874 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
@@ -42,6 +42,7 @@ import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
+import java.util.TreeMap;
/**
*
@@ -522,7 +523,10 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
Object val = val0 == null ? new BinaryValueWithType(BinaryUtils.typeByClass(Object.class), null) : val0;
if (assignedVals == null)
- assignedVals = new LinkedHashMap<>();
+ if (BinaryUtils.FIELDS_SORTED_ORDER)
+ assignedVals = new TreeMap<>();
+ else
+ assignedVals = new LinkedHashMap<>();
Object oldVal = assignedVals.put(name, val);
[15/50] [abbrv] ignite git commit: Fixed classnames.properties
generation for ignite-hadoop module.
Posted by sb...@apache.org.
Fixed classnames.properties generation for ignite-hadoop module.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5a4ebd5d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5a4ebd5d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5a4ebd5d
Branch: refs/heads/master
Commit: 5a4ebd5de8751dcf32a26c96bf4f39e43bcbb341
Parents: baa7526
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Fri Nov 11 09:49:41 2016 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Nov 11 09:49:41 2016 +0700
----------------------------------------------------------------------
modules/hadoop/pom.xml | 49 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/5a4ebd5d/modules/hadoop/pom.xml
----------------------------------------------------------------------
diff --git a/modules/hadoop/pom.xml b/modules/hadoop/pom.xml
index c02a574..15d6eee 100644
--- a/modules/hadoop/pom.xml
+++ b/modules/hadoop/pom.xml
@@ -127,6 +127,55 @@
<build>
<plugins>
<plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>1.3.2</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.ignite</groupId>
+ <artifactId>ignite-tools</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>java</goal>
+ </goals>
+ <configuration>
+ <includePluginDependencies>true</includePluginDependencies>
+ <mainClass>org.apache.ignite.tools.classgen.ClassesGenerator</mainClass>
+ <arguments>
+ <argument>${project.basedir}/target/classes</argument>
+ <argument>
+ <![CDATA[
+#
+# 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.
+#
+ ]]>
+ </argument>
+ <argument>org.apache.ignite</argument>
+ </arguments>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
[11/50] [abbrv] ignite git commit: IGNITE-4208: Hadoop: Fixed a bug
preventing normal secondary file system start. This closes #1228.
Posted by sb...@apache.org.
IGNITE-4208: Hadoop: Fixed a bug preventing normal secondary file system start. This closes #1228.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/baa75266
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/baa75266
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/baa75266
Branch: refs/heads/master
Commit: baa752660c6eddf27d15a812252b01b5872385de
Parents: 1093819
Author: iveselovskiy <iv...@gridgain.com>
Authored: Thu Nov 10 18:47:09 2016 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Thu Nov 10 18:47:09 2016 +0300
----------------------------------------------------------------------
.../org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java | 2 +-
.../org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java | 2 +-
.../internal/processors/hadoop/delegate/HadoopDelegateUtils.java | 4 ++--
.../impl/delegate/HadoopIgfsSecondaryFileSystemDelegateImpl.java | 3 +--
.../hadoop/impl/fs/KerberosHadoopFileSystemFactorySelfTest.java | 3 ++-
.../hadoop/impl/igfs/HadoopFIleSystemFactorySelfTest.java | 2 +-
.../impl/igfs/HadoopIgfsSecondaryFileSystemTestAdapter.java | 3 +--
.../impl/igfs/HadoopSecondaryFileSystemConfigurationTest.java | 4 ++--
8 files changed, 11 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/baa75266/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java
index 7133c08..866fc1a 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java
@@ -336,7 +336,7 @@ public class IgniteHadoopFileSystem extends FileSystem {
HadoopFileSystemFactory factory0 =
(HadoopFileSystemFactory)paths.getPayload(getClass().getClassLoader());
- factory = HadoopDelegateUtils.fileSystemFactoryDelegate(factory0);
+ factory = HadoopDelegateUtils.fileSystemFactoryDelegate(getClass().getClassLoader(), factory0);
}
catch (IgniteCheckedException e) {
throw new IOException("Failed to get secondary file system factory.", e);
http://git-wip-us.apache.org/repos/asf/ignite/blob/baa75266/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java
index 18b8bf9..82ad683 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java
@@ -345,7 +345,7 @@ public class IgniteHadoopFileSystem extends AbstractFileSystem implements Closea
HadoopFileSystemFactory factory0 =
(HadoopFileSystemFactory) paths.getPayload(getClass().getClassLoader());
- factory = HadoopDelegateUtils.fileSystemFactoryDelegate(factory0);
+ factory = HadoopDelegateUtils.fileSystemFactoryDelegate(getClass().getClassLoader(), factory0);
}
catch (IgniteCheckedException e) {
throw new IOException("Failed to get secondary file system factory.", e);
http://git-wip-us.apache.org/repos/asf/ignite/blob/baa75266/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/delegate/HadoopDelegateUtils.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/delegate/HadoopDelegateUtils.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/delegate/HadoopDelegateUtils.java
index 76d9bff..2059c8d 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/delegate/HadoopDelegateUtils.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/delegate/HadoopDelegateUtils.java
@@ -81,13 +81,13 @@ public class HadoopDelegateUtils {
* @return Delegate.
*/
@SuppressWarnings("unchecked")
- public static HadoopFileSystemFactoryDelegate fileSystemFactoryDelegate(Object proxy) {
+ public static HadoopFileSystemFactoryDelegate fileSystemFactoryDelegate(ClassLoader ldr, Object proxy) {
String clsName = FACTORY_CLS_MAP.get(proxy.getClass().getName());
if (clsName == null)
clsName = DFLT_FACTORY_CLS;
- return newInstance(clsName, null, proxy);
+ return newInstance(clsName, ldr, proxy);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/baa75266/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/delegate/HadoopIgfsSecondaryFileSystemDelegateImpl.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/delegate/HadoopIgfsSecondaryFileSystemDelegateImpl.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/delegate/HadoopIgfsSecondaryFileSystemDelegateImpl.java
index 203965c..e336fad 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/delegate/HadoopIgfsSecondaryFileSystemDelegateImpl.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/delegate/HadoopIgfsSecondaryFileSystemDelegateImpl.java
@@ -56,7 +56,6 @@ import java.io.OutputStream;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -86,7 +85,7 @@ public class HadoopIgfsSecondaryFileSystemDelegateImpl implements HadoopIgfsSeco
if (factory0 == null)
factory0 = new CachingHadoopFileSystemFactory();
- factory = HadoopDelegateUtils.fileSystemFactoryDelegate(factory0);
+ factory = HadoopDelegateUtils.fileSystemFactoryDelegate(getClass().getClassLoader(), factory0);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/baa75266/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/fs/KerberosHadoopFileSystemFactorySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/fs/KerberosHadoopFileSystemFactorySelfTest.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/fs/KerberosHadoopFileSystemFactorySelfTest.java
index 8c95a0e..f35d644 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/fs/KerberosHadoopFileSystemFactorySelfTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/fs/KerberosHadoopFileSystemFactorySelfTest.java
@@ -70,7 +70,8 @@ public class KerberosHadoopFileSystemFactorySelfTest extends GridCommonAbstractT
GridTestUtils.assertThrows(null, new Callable<Object>() {
@Override public Object call() throws Exception {
- HadoopFileSystemFactoryDelegate delegate = HadoopDelegateUtils.fileSystemFactoryDelegate(fac);
+ HadoopFileSystemFactoryDelegate delegate = HadoopDelegateUtils.fileSystemFactoryDelegate(
+ getClass().getClassLoader(), fac);
delegate.start();
http://git-wip-us.apache.org/repos/asf/ignite/blob/baa75266/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopFIleSystemFactorySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopFIleSystemFactorySelfTest.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopFIleSystemFactorySelfTest.java
index 7cf7f2d..5d955d4 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopFIleSystemFactorySelfTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopFIleSystemFactorySelfTest.java
@@ -330,7 +330,7 @@ public class HadoopFIleSystemFactorySelfTest extends IgfsCommonAbstractTest {
/** {@inheritDoc} */
@Override public void start() throws IgniteException {
- delegate = HadoopDelegateUtils.fileSystemFactoryDelegate(factory);
+ delegate = HadoopDelegateUtils.fileSystemFactoryDelegate(getClass().getClassLoader(), factory);
delegate.start();
http://git-wip-us.apache.org/repos/asf/ignite/blob/baa75266/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopIgfsSecondaryFileSystemTestAdapter.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopIgfsSecondaryFileSystemTestAdapter.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopIgfsSecondaryFileSystemTestAdapter.java
index adb1330..453d0c7 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopIgfsSecondaryFileSystemTestAdapter.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopIgfsSecondaryFileSystemTestAdapter.java
@@ -30,7 +30,6 @@ import org.apache.ignite.configuration.FileSystemConfiguration;
import org.apache.ignite.hadoop.fs.HadoopFileSystemFactory;
import org.apache.ignite.internal.processors.hadoop.delegate.HadoopDelegateUtils;
import org.apache.ignite.internal.processors.hadoop.delegate.HadoopFileSystemFactoryDelegate;
-import org.apache.ignite.internal.processors.hadoop.impl.igfs.HadoopIgfsUtils;
import org.apache.ignite.internal.processors.igfs.IgfsEx;
import org.apache.ignite.internal.processors.igfs.IgfsUtils;
import org.apache.ignite.internal.processors.igfs.IgfsSecondaryFileSystemTestAdapter;
@@ -50,7 +49,7 @@ public class HadoopIgfsSecondaryFileSystemTestAdapter implements IgfsSecondaryFi
public HadoopIgfsSecondaryFileSystemTestAdapter(HadoopFileSystemFactory factory) {
assert factory != null;
- this.factory = HadoopDelegateUtils.fileSystemFactoryDelegate(factory);
+ this.factory = HadoopDelegateUtils.fileSystemFactoryDelegate(getClass().getClassLoader(), factory);
this.factory.start();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/baa75266/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopSecondaryFileSystemConfigurationTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopSecondaryFileSystemConfigurationTest.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopSecondaryFileSystemConfigurationTest.java
index ae03f14..78f457b 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopSecondaryFileSystemConfigurationTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopSecondaryFileSystemConfigurationTest.java
@@ -37,7 +37,6 @@ import org.apache.ignite.igfs.IgfsIpcEndpointType;
import org.apache.ignite.igfs.IgfsMode;
import org.apache.ignite.internal.processors.hadoop.delegate.HadoopDelegateUtils;
import org.apache.ignite.internal.processors.hadoop.delegate.HadoopFileSystemFactoryDelegate;
-import org.apache.ignite.internal.processors.hadoop.impl.igfs.HadoopIgfsUtils;
import org.apache.ignite.internal.processors.igfs.IgfsCommonAbstractTest;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -185,7 +184,8 @@ public class HadoopSecondaryFileSystemConfigurationTest extends IgfsCommonAbstra
fac.setConfigPaths(primaryConfFullPath);
fac.setUri(primaryFsUriStr);
- HadoopFileSystemFactoryDelegate facDelegate = HadoopDelegateUtils.fileSystemFactoryDelegate(fac);
+ HadoopFileSystemFactoryDelegate facDelegate = HadoopDelegateUtils.fileSystemFactoryDelegate(
+ getClass().getClassLoader(), fac);
facDelegate.start();
[26/50] [abbrv] ignite git commit: IGNITE-4216 .NET: Fix
PlatformAffinityFunction to inject resource into baseFunc
Posted by sb...@apache.org.
IGNITE-4216 .NET: Fix PlatformAffinityFunction to inject resource into baseFunc
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/85a4b966
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/85a4b966
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/85a4b966
Branch: refs/heads/master
Commit: 85a4b966fdfb7018d1c91b73df1659082128f786
Parents: d69e26d
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Nov 14 13:38:33 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Nov 14 13:39:56 2016 +0300
----------------------------------------------------------------------
.../affinity/PlatformAffinityFunction.java | 7 ++++-
.../dotnet/PlatformDotNetAffinityFunction.java | 9 ++----
.../Cache/Affinity/AffinityFunctionTest.cs | 33 ++++++++++++++++++--
.../Apache.Ignite.Core.Tests/TestUtils.cs | 3 +-
4 files changed, 41 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/85a4b966/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinityFunction.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinityFunction.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinityFunction.java
index 1e844e7..8076a19 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinityFunction.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinityFunction.java
@@ -18,10 +18,12 @@
package org.apache.ignite.internal.processors.platform.cache.affinity;
import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.cache.affinity.AffinityFunction;
import org.apache.ignite.cache.affinity.AffinityFunctionContext;
import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.binary.BinaryRawWriterEx;
import org.apache.ignite.internal.processors.platform.PlatformContext;
import org.apache.ignite.internal.processors.platform.memory.PlatformMemory;
@@ -298,7 +300,10 @@ public class PlatformAffinityFunction implements AffinityFunction, Externalizabl
*/
@SuppressWarnings("unused")
@IgniteInstanceResource
- public void setIgnite(Ignite ignite) {
+ public void setIgnite(Ignite ignite) throws IgniteCheckedException {
this.ignite = ignite;
+
+ if (baseFunc != null && ignite != null)
+ ((IgniteEx)ignite).context().resource().injectGeneric(baseFunc);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/85a4b966/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetAffinityFunction.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetAffinityFunction.java b/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetAffinityFunction.java
index 483fd22..f9f457d 100644
--- a/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetAffinityFunction.java
+++ b/modules/core/src/main/java/org/apache/ignite/platform/dotnet/PlatformDotNetAffinityFunction.java
@@ -18,17 +18,12 @@
package org.apache.ignite.platform.dotnet;
import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
-import org.apache.ignite.binary.BinaryRawWriter;
import org.apache.ignite.cache.affinity.AffinityFunction;
import org.apache.ignite.cache.affinity.AffinityFunctionContext;
import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.internal.binary.BinaryRawWriterEx;
-import org.apache.ignite.internal.processors.platform.PlatformContext;
import org.apache.ignite.internal.processors.platform.cache.affinity.PlatformAffinityFunction;
-import org.apache.ignite.internal.processors.platform.memory.PlatformMemory;
-import org.apache.ignite.internal.processors.platform.memory.PlatformOutputStream;
-import org.apache.ignite.internal.processors.platform.utils.PlatformUtils;
import org.apache.ignite.lifecycle.LifecycleAware;
import org.apache.ignite.resources.IgniteInstanceResource;
@@ -178,7 +173,7 @@ public class PlatformDotNetAffinityFunction implements AffinityFunction, Externa
*/
@SuppressWarnings("unused")
@IgniteInstanceResource
- private void setIgnite(Ignite ignite) {
+ private void setIgnite(Ignite ignite) throws IgniteCheckedException {
assert func != null;
func.setIgnite(ignite);
http://git-wip-us.apache.org/repos/asf/ignite/blob/85a4b966/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFunctionTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFunctionTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFunctionTest.cs
index f38cb3e..d4b6680 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFunctionTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFunctionTest.cs
@@ -100,8 +100,8 @@ namespace Apache.Ignite.Core.Tests.Cache.Affinity
public void FixtureTearDown()
{
// Check that affinity handles are present
- TestUtils.AssertHandleRegistryHasItems(_ignite, _ignite.GetCacheNames().Count - 1, 0);
- TestUtils.AssertHandleRegistryHasItems(_ignite2, _ignite.GetCacheNames().Count - 1, 0);
+ TestUtils.AssertHandleRegistryHasItems(_ignite, _ignite.GetCacheNames().Count - 3, 0);
+ TestUtils.AssertHandleRegistryHasItems(_ignite2, _ignite.GetCacheNames().Count - 3, 0);
// Destroy all caches
_ignite.GetCacheNames().ToList().ForEach(_ignite.DestroyCache);
@@ -165,6 +165,34 @@ namespace Apache.Ignite.Core.Tests.Cache.Affinity
}
/// <summary>
+ /// Tests the dynamic cache with predefined functions.
+ /// </summary>
+ [Test]
+ public void TestDynamicCachePredefined()
+ {
+ var caches = new[]
+ {
+ new CacheConfiguration("rendezvousPredefined")
+ {
+ AffinityFunction = new RendezvousAffinityFunction {Partitions = 1234}
+ },
+ new CacheConfiguration("fairPredefined")
+ {
+ AffinityFunction = new FairAffinityFunction {Partitions = 1234}
+ },
+ }.Select(_ignite.CreateCache<int, int>);
+
+ foreach (var cache in caches)
+ {
+ Assert.AreEqual(1234, cache.GetConfiguration().AffinityFunction.Partitions);
+
+ cache[1] = 2;
+
+ Assert.AreEqual(2, cache[1]);
+ }
+ }
+
+ /// <summary>
/// Verifies the cache affinity.
/// </summary>
private static void VerifyCacheAffinity(ICache<int, int> cache)
@@ -231,6 +259,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Affinity
});
var ex = Assert.Throws<CacheException>(() => cache.Put(1, 2));
+ Assert.IsNotNull(ex.InnerException);
Assert.AreEqual("User error", ex.InnerException.Message);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/85a4b966/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
index 88a2b52..5073b1a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
@@ -284,7 +284,8 @@ namespace Apache.Ignite.Core.Tests
var items = handleRegistry.GetItems().Where(x => !(x.Value is LifecycleBeanHolder)).ToList();
if (items.Any())
- Assert.Fail("HandleRegistry is not empty in grid '{0}':\n '{1}'", grid.Name,
+ Assert.Fail("HandleRegistry is not empty in grid '{0}' (expected {1}, actual {2}):\n '{3}'",
+ grid.Name, expectedCount, handleRegistry.Count,
items.Select(x => x.ToString()).Aggregate((x, y) => x + "\n" + y));
}
[08/50] [abbrv] ignite git commit: Backport commit of the following:
Posted by sb...@apache.org.
Backport commit of the following:
commit 612eb3daffe608995aac28eed019b3e6ef9d66d3
Author: Aleksei Scherbakov <al...@gmail.com>
Date: Fri Aug 19 13:28:39 2016 +0300
ignite-2795 Support 'copyOnRead' for SQL queries
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8b59f4e7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8b59f4e7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8b59f4e7
Branch: refs/heads/master
Commit: 8b59f4e76138e08e80aa219c1a9cf0c3df6fdb4b
Parents: 26daa57
Author: Andrey V. Mashenkov <an...@gmail.com>
Authored: Thu Nov 10 14:43:00 2016 +0300
Committer: Andrey V. Mashenkov <an...@gmail.com>
Committed: Thu Nov 10 14:43:00 2016 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheContext.java | 8 +
.../query/h2/GridH2ResultSetIterator.java | 62 ++++-
.../processors/query/h2/IgniteH2Indexing.java | 4 +-
.../query/h2/opt/GridH2ValueCacheObject.java | 10 +-
.../query/h2/twostep/GridMapQueryExecutor.java | 34 ++-
.../h2/twostep/GridReduceQueryExecutor.java | 2 +-
.../cache/CacheSqlQueryValueCopySelfTest.java | 226 +++++++++++++++++++
.../IgniteCacheQuerySelfTestSuite2.java | 2 +
8 files changed, 338 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/8b59f4e7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
index dc9c766..30f1c4b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
@@ -1699,6 +1699,14 @@ public class GridCacheContext<K, V> implements Externalizable {
}
/**
+ * @return {@code True} if the value for the cache object has to be copied because
+ * of {@link CacheConfiguration#isCopyOnRead()}.
+ */
+ public boolean needValueCopy() {
+ return affNode && cacheCfg.isCopyOnRead() && cacheCfg.getMemoryMode() != OFFHEAP_VALUES;
+ }
+
+ /**
* Converts temporary offheap object to heap-based.
*
* @param obj Object.
http://git-wip-us.apache.org/repos/asf/ignite/blob/8b59f4e7/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/GridH2ResultSetIterator.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/GridH2ResultSetIterator.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/GridH2ResultSetIterator.java
index 3603bb5..e0680d3 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/GridH2ResultSetIterator.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/GridH2ResultSetIterator.java
@@ -17,24 +17,49 @@
package org.apache.ignite.internal.processors.query.h2;
+import java.lang.reflect.Field;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.NoSuchElementException;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.query.h2.opt.GridH2ValueCacheObject;
import org.apache.ignite.internal.util.GridCloseableIteratorAdapter;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
-
+import org.h2.jdbc.JdbcResultSet;
+import org.h2.result.ResultInterface;
+import org.h2.value.Value;
/**
* Iterator over result set.
*/
public abstract class GridH2ResultSetIterator<T> extends GridCloseableIteratorAdapter<T> {
/** */
+ private static final Field RESULT_FIELD;
+
+ /**
+ * Initialize.
+ */
+ static {
+ try {
+ RESULT_FIELD = JdbcResultSet.class.getDeclaredField("result");
+
+ RESULT_FIELD.setAccessible(true);
+ }
+ catch (NoSuchFieldException e) {
+ throw new IllegalStateException("Check H2 version in classpath.", e);
+ }
+ }
+
+ /** */
private static final long serialVersionUID = 0L;
/** */
+ private final ResultInterface res;
+
+ /** */
private final ResultSet data;
/** */
@@ -49,12 +74,20 @@ public abstract class GridH2ResultSetIterator<T> extends GridCloseableIteratorAd
/**
* @param data Data array.
* @param closeStmt If {@code true} closes result set statement when iterator is closed.
+ * @param needCpy {@code True} if need copy cache object's value.
* @throws IgniteCheckedException If failed.
*/
- protected GridH2ResultSetIterator(ResultSet data, boolean closeStmt) throws IgniteCheckedException {
+ protected GridH2ResultSetIterator(ResultSet data, boolean closeStmt, boolean needCpy) throws IgniteCheckedException {
this.data = data;
this.closeStmt = closeStmt;
+ try {
+ res = needCpy ? (ResultInterface)RESULT_FIELD.get(data) : null;
+ }
+ catch (IllegalAccessException e) {
+ throw new IllegalStateException(e); // Must not happen.
+ }
+
if (data != null) {
try {
row = new Object[data.getMetaData().getColumnCount()];
@@ -78,8 +111,27 @@ public abstract class GridH2ResultSetIterator<T> extends GridCloseableIteratorAd
if (!data.next())
return false;
- for (int c = 0; c < row.length; c++)
- row[c] = data.getObject(c + 1);
+ if (res != null) {
+ Value[] values = res.currentRow();
+
+ for (int c = 0; c < row.length; c++) {
+ Value val = values[c];
+
+ if (val instanceof GridH2ValueCacheObject) {
+ GridH2ValueCacheObject valCacheObj = (GridH2ValueCacheObject)values[c];
+
+ GridCacheContext cctx = valCacheObj.getCacheContext();
+
+ row[c] = valCacheObj.getObject(cctx != null && cctx.needValueCopy());
+ }
+ else
+ row[c] = val.getObject();
+ }
+ }
+ else {
+ for (int c = 0; c < row.length; c++)
+ row[c] = data.getObject(c + 1);
+ }
return true;
}
@@ -134,6 +186,6 @@ public abstract class GridH2ResultSetIterator<T> extends GridCloseableIteratorAd
/** {@inheritDoc} */
@Override public String toString() {
- return S.toString((Class<GridH2ResultSetIterator>)getClass(), this);
+ return S.toString(GridH2ResultSetIterator.class, this);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/8b59f4e7/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index ab332c1..5c2fab5 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -2230,7 +2230,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
* @throws IgniteCheckedException If failed.
*/
protected FieldsIterator(ResultSet data) throws IgniteCheckedException {
- super(data, false);
+ super(data, false, true);
}
/** {@inheritDoc} */
@@ -2255,7 +2255,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
* @throws IgniteCheckedException If failed.
*/
protected KeyValIterator(ResultSet data) throws IgniteCheckedException {
- super(data, false);
+ super(data, false, true);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/8b59f4e7/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2ValueCacheObject.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2ValueCacheObject.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2ValueCacheObject.java
index fd0e6ed..4d83295 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2ValueCacheObject.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2ValueCacheObject.java
@@ -120,7 +120,15 @@ public class GridH2ValueCacheObject extends Value {
/** {@inheritDoc} */
@Override public Object getObject() {
- return obj.isPlatformType() ? obj.value(objectContext(), false) : obj;
+ return getObject(false);
+ }
+
+ /**
+ * @param cpy Copy flag.
+ * @return Value.
+ */
+ public Object getObject(boolean cpy) {
+ return obj.isPlatformType() ? obj.value(objectContext(), cpy) : obj;
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/8b59f4e7/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
index 1f05bf7..7e4d5b6 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
@@ -52,6 +52,7 @@ import org.apache.ignite.internal.processors.cache.query.CacheQueryType;
import org.apache.ignite.internal.processors.cache.query.GridCacheSqlQuery;
import org.apache.ignite.internal.processors.query.GridQueryCancel;
import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
+import org.apache.ignite.internal.processors.query.h2.opt.GridH2ValueCacheObject;
import org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryCancelRequest;
import org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryFailResponse;
import org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryNextPageRequest;
@@ -759,6 +760,9 @@ public class GridMapQueryExecutor {
private final int rowCount;
/** */
+ private boolean cpNeeded;
+
+ /** */
private volatile boolean closed;
/**
@@ -767,11 +771,12 @@ public class GridMapQueryExecutor {
* @param qrySrcNodeId Query source node.
* @param qry Query.
*/
- private QueryResult(ResultSet rs, GridCacheContext<?,?> cctx, UUID qrySrcNodeId, GridCacheSqlQuery qry) {
+ private QueryResult(ResultSet rs, GridCacheContext<?, ?> cctx, UUID qrySrcNodeId, GridCacheSqlQuery qry) {
this.rs = rs;
this.cctx = cctx;
this.qry = qry;
this.qrySrcNodeId = qrySrcNodeId;
+ this.cpNeeded = cctx.isLocalNode(qrySrcNodeId);
try {
res = (ResultInterface)RESULT_FIELD.get(rs);
@@ -803,6 +808,33 @@ public class GridMapQueryExecutor {
Value[] row = res.currentRow();
+ if (cpNeeded) {
+ boolean copied = false;
+
+ for (int j = 0; j < row.length; j++) {
+ Value val = row[j];
+
+ if (val instanceof GridH2ValueCacheObject) {
+ GridH2ValueCacheObject valCacheObj = (GridH2ValueCacheObject)val;
+
+ GridCacheContext cctx = valCacheObj.getCacheContext();
+
+ if (cctx != null && cctx.needValueCopy()) {
+ row[j] = new GridH2ValueCacheObject(valCacheObj.getCacheContext(), valCacheObj.getCacheObject()) {
+ @Override public Object getObject() {
+ return getObject(true);
+ }
+ };
+
+ copied = true;
+ }
+ }
+ }
+
+ if (i == 0 && !copied)
+ cpNeeded = false; // No copy on read caches, skip next checks.
+ }
+
assert row != null;
if (readEvt) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/8b59f4e7/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
index 3fdbf42..29ad94a 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
@@ -1289,7 +1289,7 @@ public class GridReduceQueryExecutor {
* @throws IgniteCheckedException If failed.
*/
protected Iter(ResultSet data) throws IgniteCheckedException {
- super(data, true);
+ super(data, true, false);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/8b59f4e7/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheSqlQueryValueCopySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheSqlQueryValueCopySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheSqlQueryValueCopySelfTest.java
new file mode 100644
index 0000000..e47e893
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheSqlQueryValueCopySelfTest.java
@@ -0,0 +1,226 @@
+/*
+ * 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.List;
+import javax.cache.Cache;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.query.QueryCursor;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.cache.query.SqlQuery;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ * Tests modification of values returned by query iterators with enabled copy on read.
+ */
+public class CacheSqlQueryValueCopySelfTest extends GridCommonAbstractTest {
+ /** */
+ private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+ /** */
+ private static final int KEYS = 100;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ if ("client".equals(cfg.getGridName()))
+ cfg.setClientMode(true);
+
+ ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
+
+ CacheConfiguration<Integer, Value> cc = new CacheConfiguration<>();
+
+ cc.setCopyOnRead(true);
+ cc.setIndexedTypes(Integer.class, Value.class);
+
+ cfg.setCacheConfiguration(cc);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ super.beforeTestsStarted();
+
+ startGridsMultiThreaded(3);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ IgniteCache<Integer, Value> cache = grid(0).cache(null);
+
+ for (int i = 0; i < KEYS; i++)
+ cache.put(i, new Value("before"));
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ IgniteCache<Integer, Value> cache = grid(0).cache(null);
+
+ cache.removeAll();
+
+ super.afterTest();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ super.afterTestsStopped();
+
+ stopAllGrids();
+ }
+
+ /**
+ * Tests two step query from dedicated client.
+ *
+ * @throws Exception If failed.
+ */
+ public void testTwoStepSqlClientQuery() throws Exception {
+ try (Ignite client = startGrid("client")) {
+ IgniteCache<Integer, Value> cache = client.cache(null);
+
+ List<Cache.Entry<Integer, Value>> all = cache.query(
+ new SqlQuery<Integer, Value>(Value.class, "select * from Value")).getAll();
+
+ assertEquals(KEYS, all.size());
+
+ for (Cache.Entry<Integer, Value> entry : all)
+ entry.getValue().str = "after";
+
+ check(cache);
+
+ QueryCursor<List<?>> qry = cache.query(new SqlFieldsQuery("select _val from Value"));
+
+ List<List<?>> all0 = qry.getAll();
+
+ assertEquals(KEYS, all0.size());
+
+ for (List<?> entry : all0)
+ ((Value)entry.get(0)).str = "after";
+
+ check(cache);
+ }
+ }
+
+ /**
+ * Test two step query without local reduce phase.
+ */
+ public void testTwoStepSkipReduceSqlQuery() {
+ IgniteCache<Integer, Value> cache = grid(0).cache(null);
+
+ List<Cache.Entry<Integer, Value>> all = cache.query(
+ new SqlQuery<Integer, Value>(Value.class, "select * from Value").setPageSize(3)).getAll();
+
+ assertEquals(KEYS, all.size());
+
+ for (Cache.Entry<Integer, Value> entry : all)
+ entry.getValue().str = "after";
+
+ check(cache);
+ }
+
+ /**
+ * Test two step query value copy.
+ */
+ public void testTwoStepReduceSqlQuery() {
+ IgniteCache<Integer, Value> cache = grid(0).cache(null);
+
+ QueryCursor<List<?>> qry = cache.query(new SqlFieldsQuery("select _val from Value order by _key"));
+
+ List<List<?>> all = qry.getAll();
+
+ assertEquals(KEYS, all.size());
+
+ for (List<?> entry : all)
+ ((Value)entry.get(0)).str = "after";
+
+ check(cache);
+ }
+
+ /**
+ * Tests local sql query.
+ */
+ public void testLocalSqlQuery() {
+ IgniteCache<Integer, Value> cache = grid(0).cache(null);
+
+ SqlQuery<Integer, Value> qry = new SqlQuery<>(Value.class.getSimpleName(), "select * from Value");
+ qry.setLocal(true);
+
+ List<Cache.Entry<Integer, Value>> all = cache.query(qry).getAll();
+
+ assertFalse(all.isEmpty());
+
+ for (Cache.Entry<Integer, Value> entry : all)
+ entry.getValue().str = "after";
+
+ check(cache);
+ }
+
+ /**
+ * Tests local sql query.
+ */
+ public void testLocalSqlFieldsQuery() {
+ IgniteCache<Integer, Value> cache = grid(0).cache(null);
+
+ QueryCursor<List<?>> cur = cache.query(new SqlFieldsQuery("select _val from Value").setLocal(true));
+
+ List<List<?>> all = cur.getAll();
+
+ assertFalse(all.isEmpty());
+
+ for (List<?> entry : all)
+ ((Value)entry.get(0)).str = "after";
+
+ check(cache);
+ }
+
+ /** */
+ private static class Value {
+ /** */
+ private String str;
+
+ /**
+ * @param str String.
+ */
+ public Value(String str) {
+ this.str = str;
+ }
+ }
+
+ /**
+ * @param cache Cache.
+ */
+ private void check(IgniteCache<Integer, Value> cache) {
+ int cnt = 0;
+
+ // Value should be not modified by previous assignment.
+ for (Cache.Entry<Integer, Value> entry : cache) {
+ cnt++;
+
+ assertEquals("before", entry.getValue().str);
+ }
+
+ assertEquals(KEYS, cnt);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/8b59f4e7/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite2.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite2.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite2.java
index 9128f76..4b4a576 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite2.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite2.java
@@ -27,6 +27,7 @@ import org.apache.ignite.internal.processors.cache.CacheQueryOffheapEvictDataLos
import org.apache.ignite.internal.processors.cache.CacheReplicatedQueryMetricsDistributedSelfTest;
import org.apache.ignite.internal.processors.cache.CacheReplicatedQueryMetricsLocalSelfTest;
import org.apache.ignite.internal.processors.cache.CacheScanPartitionQueryFallbackSelfTest;
+import org.apache.ignite.internal.processors.cache.CacheSqlQueryValueCopySelfTest;
import org.apache.ignite.internal.processors.cache.GridCacheQueryIndexingDisabledSelfTest;
import org.apache.ignite.internal.processors.cache.IgniteCacheFieldsQueryNoDataSelfTest;
import org.apache.ignite.internal.processors.cache.IgniteCacheNoClassQuerySelfTest;
@@ -114,6 +115,7 @@ public class IgniteCacheQuerySelfTestSuite2 extends TestSuite {
// Other.
suite.addTestSuite(CacheQueryNewClientSelfTest.class);
suite.addTestSuite(CacheOffheapBatchIndexingSingleTypeTest.class);
+ suite.addTestSuite(CacheSqlQueryValueCopySelfTest.class);
return suite;
}
[33/50] [abbrv] ignite git commit: IGNITE-2523 "single put" NEAR
update request
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
new file mode 100644
index 0000000..e2314f8
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
@@ -0,0 +1,1031 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import java.io.Externalizable;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.UUID;
+import javax.cache.expiry.ExpiryPolicy;
+import javax.cache.processor.EntryProcessor;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.internal.GridDirectCollection;
+import org.apache.ignite.internal.GridDirectTransient;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
+import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheOperation;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.distributed.IgniteExternalizableExpiryPolicy;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.GridLongList;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
+import org.apache.ignite.plugin.extensions.communication.MessageReader;
+import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import static org.apache.ignite.internal.processors.cache.GridCacheOperation.DELETE;
+import static org.apache.ignite.internal.processors.cache.GridCacheOperation.TRANSFORM;
+import static org.apache.ignite.internal.processors.cache.GridCacheOperation.UPDATE;
+
+/**
+ * Lite DHT cache update request sent from near node to primary node.
+ */
+public class GridNearAtomicFullUpdateRequest extends GridNearAtomicAbstractUpdateRequest {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Target node ID. */
+ @GridDirectTransient
+ private UUID nodeId;
+
+ /** Future version. */
+ private GridCacheVersion futVer;
+
+ /** Fast map flag. */
+ private boolean fastMap;
+
+ /** Update version. Set to non-null if fastMap is {@code true}. */
+ private GridCacheVersion updateVer;
+
+ /** Topology version. */
+ private AffinityTopologyVersion topVer;
+
+ /** Topology locked flag. Set if atomic update is performed inside TX or explicit lock. */
+ private boolean topLocked;
+
+ /** Write synchronization mode. */
+ private CacheWriteSynchronizationMode syncMode;
+
+ /** Update operation. */
+ private GridCacheOperation op;
+
+ /** Keys to update. */
+ @GridToStringInclude
+ @GridDirectCollection(KeyCacheObject.class)
+ private List<KeyCacheObject> keys;
+
+ /** Values to update. */
+ @GridDirectCollection(CacheObject.class)
+ private List<CacheObject> vals;
+
+ /** Partitions of keys. */
+ @GridDirectCollection(int.class)
+ private List<Integer> partIds;
+
+ /** Entry processors. */
+ @GridDirectTransient
+ private List<EntryProcessor<Object, Object, Object>> entryProcessors;
+
+ /** Entry processors bytes. */
+ @GridDirectCollection(byte[].class)
+ private List<byte[]> entryProcessorsBytes;
+
+ /** Optional arguments for entry processor. */
+ @GridDirectTransient
+ private Object[] invokeArgs;
+
+ /** Entry processor arguments bytes. */
+ private byte[][] invokeArgsBytes;
+
+ /** Conflict versions. */
+ @GridDirectCollection(GridCacheVersion.class)
+ private List<GridCacheVersion> conflictVers;
+
+ /** Conflict TTLs. */
+ private GridLongList conflictTtls;
+
+ /** Conflict expire times. */
+ private GridLongList conflictExpireTimes;
+
+ /** Return value flag. */
+ private boolean retval;
+
+ /** Expiry policy. */
+ @GridDirectTransient
+ private ExpiryPolicy expiryPlc;
+
+ /** Expiry policy bytes. */
+ private byte[] expiryPlcBytes;
+
+ /** Filter. */
+ private CacheEntryPredicate[] filter;
+
+ /** Flag indicating whether request contains primary keys. */
+ private boolean hasPrimary;
+
+ /** Subject ID. */
+ private UUID subjId;
+
+ /** Task name hash. */
+ private int taskNameHash;
+
+ /** Skip write-through to a persistent storage. */
+ private boolean skipStore;
+
+ /** */
+ private boolean clientReq;
+
+ /** Keep binary flag. */
+ private boolean keepBinary;
+
+ /** */
+ @GridDirectTransient
+ private GridNearAtomicUpdateResponse res;
+
+ /** Maximum possible size of inner collections. */
+ @GridDirectTransient
+ private int initSize;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ public GridNearAtomicFullUpdateRequest() {
+ // No-op.
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param cacheId Cache ID.
+ * @param nodeId Node ID.
+ * @param futVer Future version.
+ * @param fastMap Fast map scheme flag.
+ * @param updateVer Update version set if fast map is performed.
+ * @param topVer Topology version.
+ * @param topLocked Topology locked flag.
+ * @param syncMode Synchronization mode.
+ * @param op Cache update operation.
+ * @param retval Return value required flag.
+ * @param expiryPlc Expiry policy.
+ * @param invokeArgs Optional arguments for entry processor.
+ * @param filter Optional filter for atomic check.
+ * @param subjId Subject ID.
+ * @param taskNameHash Task name hash code.
+ * @param skipStore Skip write-through to a persistent storage.
+ * @param keepBinary Keep binary flag.
+ * @param clientReq Client node request flag.
+ * @param addDepInfo Deployment info flag.
+ * @param maxEntryCnt Maximum entries count.
+ */
+ GridNearAtomicFullUpdateRequest(
+ int cacheId,
+ UUID nodeId,
+ GridCacheVersion futVer,
+ boolean fastMap,
+ @Nullable GridCacheVersion updateVer,
+ @NotNull AffinityTopologyVersion topVer,
+ boolean topLocked,
+ CacheWriteSynchronizationMode syncMode,
+ GridCacheOperation op,
+ boolean retval,
+ @Nullable ExpiryPolicy expiryPlc,
+ @Nullable Object[] invokeArgs,
+ @Nullable CacheEntryPredicate[] filter,
+ @Nullable UUID subjId,
+ int taskNameHash,
+ boolean skipStore,
+ boolean keepBinary,
+ boolean clientReq,
+ boolean addDepInfo,
+ int maxEntryCnt
+ ) {
+ assert futVer != null;
+
+ this.cacheId = cacheId;
+ this.nodeId = nodeId;
+ this.futVer = futVer;
+ this.fastMap = fastMap;
+ this.updateVer = updateVer;
+
+ this.topVer = topVer;
+ this.topLocked = topLocked;
+ this.syncMode = syncMode;
+ this.op = op;
+ this.retval = retval;
+ this.expiryPlc = expiryPlc;
+ this.invokeArgs = invokeArgs;
+ this.filter = filter;
+ this.subjId = subjId;
+ this.taskNameHash = taskNameHash;
+ this.skipStore = skipStore;
+ this.keepBinary = keepBinary;
+ this.clientReq = clientReq;
+ this.addDepInfo = addDepInfo;
+
+ // By default ArrayList expands to array of 10 elements on first add. We cannot guess how many entries
+ // will be added to request because of unknown affinity distribution. However, we DO KNOW how many keys
+ // participate in request. As such, we know upper bound of all collections in request. If this bound is lower
+ // than 10, we use it.
+ initSize = Math.min(maxEntryCnt, 10);
+
+ keys = new ArrayList<>(initSize);
+
+ partIds = new ArrayList<>(initSize);
+ }
+
+ /** {@inheritDoc} */
+ @Override public int lookupIndex() {
+ return CACHE_MSG_IDX;
+ }
+
+ /** {@inheritDoc} */
+ @Override public UUID nodeId() {
+ return nodeId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void nodeId(UUID nodeId) {
+ this.nodeId = nodeId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public UUID subjectId() {
+ return subjId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int taskNameHash() {
+ return taskNameHash;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridCacheVersion futureVersion() {
+ return futVer;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridCacheVersion updateVersion() {
+ return updateVer;
+ }
+
+ /** {@inheritDoc} */
+ @Override public AffinityTopologyVersion topologyVersion() {
+ return topVer;
+ }
+
+ /** {@inheritDoc} */
+ @Override public CacheWriteSynchronizationMode writeSynchronizationMode() {
+ return syncMode;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridCacheOperation operation() {
+ return op;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean onResponse(GridNearAtomicUpdateResponse res) {
+ if (this.res == null) {
+ this.res = res;
+
+ return true;
+ }
+
+ return false;
+ }
+
+ /** {@inheritDoc} */
+ @Override @Nullable public GridNearAtomicUpdateResponse response() {
+ return res;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean addDeploymentInfo() {
+ return addDepInfo;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteLogger messageLogger(GridCacheSharedContext ctx) {
+ return ctx.atomicMessageLogger();
+ }
+
+ /** {@inheritDoc} */
+ @Override public void addUpdateEntry(KeyCacheObject key,
+ @Nullable Object val,
+ long conflictTtl,
+ long conflictExpireTime,
+ @Nullable GridCacheVersion conflictVer,
+ boolean primary) {
+ EntryProcessor<Object, Object, Object> entryProcessor = null;
+
+ if (op == TRANSFORM) {
+ assert val instanceof EntryProcessor : val;
+
+ entryProcessor = (EntryProcessor<Object, Object, Object>)val;
+ }
+
+ assert val != null || op == DELETE;
+
+ keys.add(key);
+ partIds.add(key.partition());
+
+ if (entryProcessor != null) {
+ if (entryProcessors == null)
+ entryProcessors = new ArrayList<>(initSize);
+
+ entryProcessors.add(entryProcessor);
+ }
+ else if (val != null) {
+ assert val instanceof CacheObject : val;
+
+ if (vals == null)
+ vals = new ArrayList<>(initSize);
+
+ vals.add((CacheObject)val);
+ }
+
+ hasPrimary |= primary;
+
+ // In case there is no conflict, do not create the list.
+ if (conflictVer != null) {
+ if (conflictVers == null) {
+ conflictVers = new ArrayList<>(initSize);
+
+ for (int i = 0; i < keys.size() - 1; i++)
+ conflictVers.add(null);
+ }
+
+ conflictVers.add(conflictVer);
+ }
+ else if (conflictVers != null)
+ conflictVers.add(null);
+
+ if (conflictTtl >= 0) {
+ if (conflictTtls == null) {
+ conflictTtls = new GridLongList(keys.size());
+
+ for (int i = 0; i < keys.size() - 1; i++)
+ conflictTtls.add(CU.TTL_NOT_CHANGED);
+ }
+
+ conflictTtls.add(conflictTtl);
+ }
+
+ if (conflictExpireTime >= 0) {
+ if (conflictExpireTimes == null) {
+ conflictExpireTimes = new GridLongList(keys.size());
+
+ for (int i = 0; i < keys.size() - 1; i++)
+ conflictExpireTimes.add(CU.EXPIRE_TIME_CALCULATE);
+ }
+
+ conflictExpireTimes.add(conflictExpireTime);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public List<KeyCacheObject> keys() {
+ return keys;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int size() {
+ return keys != null ? keys.size() : 0;
+ }
+
+ /** {@inheritDoc} */
+ @Override public KeyCacheObject key(int idx) {
+ return keys.get(idx);
+ }
+
+ /** {@inheritDoc} */
+ @Override public List<?> values() {
+ return op == TRANSFORM ? entryProcessors : vals;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override public CacheObject value(int idx) {
+ assert op == UPDATE : op;
+
+ return vals.get(idx);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override public EntryProcessor<Object, Object, Object> entryProcessor(int idx) {
+ assert op == TRANSFORM : op;
+
+ return entryProcessors.get(idx);
+ }
+
+ /** {@inheritDoc} */
+ @Override public CacheObject writeValue(int idx) {
+ if (vals != null)
+ return vals.get(idx);
+
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override @Nullable public List<GridCacheVersion> conflictVersions() {
+ return conflictVers;
+ }
+
+ /** {@inheritDoc} */
+ @Override @Nullable public GridCacheVersion conflictVersion(int idx) {
+ if (conflictVers != null) {
+ assert idx >= 0 && idx < conflictVers.size();
+
+ return conflictVers.get(idx);
+ }
+
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long conflictTtl(int idx) {
+ if (conflictTtls != null) {
+ assert idx >= 0 && idx < conflictTtls.size();
+
+ return conflictTtls.get(idx);
+ }
+
+ return CU.TTL_NOT_CHANGED;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long conflictExpireTime(int idx) {
+ if (conflictExpireTimes != null) {
+ assert idx >= 0 && idx < conflictExpireTimes.size();
+
+ return conflictExpireTimes.get(idx);
+ }
+
+ return CU.EXPIRE_TIME_CALCULATE;
+ }
+
+ /** {@inheritDoc} */
+ @Override @Nullable public Object[] invokeArguments() {
+ return invokeArgs;
+ }
+
+ /**
+ * @return Flag indicating whether this is fast-map udpate.
+ */
+ @Override public boolean fastMap() {
+ return fastMap;
+ }
+
+ /**
+ * @return Topology locked flag.
+ */
+ @Override public boolean topologyLocked() {
+ return topLocked;
+ }
+
+ /**
+ * @return {@code True} if request sent from client node.
+ */
+ @Override public boolean clientRequest() {
+ return clientReq;
+ }
+
+ /**
+ * @return Return value flag.
+ */
+ @Override public boolean returnValue() {
+ return retval;
+ }
+
+ /**
+ * @return Skip write-through to a persistent storage.
+ */
+ @Override public boolean skipStore() {
+ return skipStore;
+ }
+
+ /**
+ * @return Keep binary flag.
+ */
+ @Override public boolean keepBinary() {
+ return keepBinary;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean hasPrimary() {
+ return hasPrimary;
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public CacheEntryPredicate[] filter() {
+ return filter;
+ }
+
+ /** {@inheritDoc} */
+ @Override public ExpiryPolicy expiry() {
+ return expiryPlc;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+ prepareMarshalCacheObjects(keys, cctx);
+
+ if (filter != null) {
+ boolean hasFilter = false;
+
+ for (CacheEntryPredicate p : filter) {
+ if (p != null) {
+ hasFilter = true;
+
+ p.prepareMarshal(cctx);
+ }
+ }
+
+ if (!hasFilter)
+ filter = null;
+ }
+
+ if (expiryPlc != null && expiryPlcBytes == null)
+ expiryPlcBytes = CU.marshal(cctx, new IgniteExternalizableExpiryPolicy(expiryPlc));
+
+ if (op == TRANSFORM) {
+ // force addition of deployment info for entry processors if P2P is enabled globally.
+ if (!addDepInfo && ctx.deploymentEnabled())
+ addDepInfo = true;
+
+ if (entryProcessorsBytes == null)
+ entryProcessorsBytes = marshalCollection(entryProcessors, cctx);
+
+ if (invokeArgsBytes == null)
+ invokeArgsBytes = marshalInvokeArguments(invokeArgs, cctx);
+ }
+ else
+ prepareMarshalCacheObjects(vals, cctx);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+ finishUnmarshalCacheObjects(keys, cctx, ldr);
+
+ if (op == TRANSFORM) {
+ if (entryProcessors == null)
+ entryProcessors = unmarshalCollection(entryProcessorsBytes, ctx, ldr);
+
+ if (invokeArgs == null)
+ invokeArgs = unmarshalInvokeArguments(invokeArgsBytes, ctx, ldr);
+ }
+ else
+ finishUnmarshalCacheObjects(vals, cctx, ldr);
+
+ if (filter != null) {
+ for (CacheEntryPredicate p : filter) {
+ if (p != null)
+ p.finishUnmarshal(cctx, ldr);
+ }
+ }
+
+ if (expiryPlcBytes != null && expiryPlc == null)
+ expiryPlc = U.unmarshal(ctx, expiryPlcBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
+
+ if (partIds != null && !partIds.isEmpty()) {
+ assert partIds.size() == keys.size();
+
+ for (int i = 0; i < keys.size(); i++)
+ keys.get(i).partition(partIds.get(i));
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+ writer.setBuffer(buf);
+
+ if (!super.writeTo(buf, writer))
+ return false;
+
+ if (!writer.isHeaderWritten()) {
+ if (!writer.writeHeader(directType(), fieldsCount()))
+ return false;
+
+ writer.onHeaderWritten();
+ }
+
+ switch (writer.state()) {
+ case 3:
+ if (!writer.writeBoolean("clientReq", clientReq))
+ return false;
+
+ writer.incrementState();
+
+ case 4:
+ if (!writer.writeMessage("conflictExpireTimes", conflictExpireTimes))
+ return false;
+
+ writer.incrementState();
+
+ case 5:
+ if (!writer.writeMessage("conflictTtls", conflictTtls))
+ return false;
+
+ writer.incrementState();
+
+ case 6:
+ if (!writer.writeCollection("conflictVers", conflictVers, MessageCollectionItemType.MSG))
+ return false;
+
+ writer.incrementState();
+
+ case 7:
+ if (!writer.writeCollection("entryProcessorsBytes", entryProcessorsBytes, MessageCollectionItemType.BYTE_ARR))
+ return false;
+
+ writer.incrementState();
+
+ case 8:
+ if (!writer.writeByteArray("expiryPlcBytes", expiryPlcBytes))
+ return false;
+
+ writer.incrementState();
+
+ case 9:
+ if (!writer.writeBoolean("fastMap", fastMap))
+ return false;
+
+ writer.incrementState();
+
+ case 10:
+ if (!writer.writeObjectArray("filter", filter, MessageCollectionItemType.MSG))
+ return false;
+
+ writer.incrementState();
+
+ case 11:
+ if (!writer.writeMessage("futVer", futVer))
+ return false;
+
+ writer.incrementState();
+
+ case 12:
+ if (!writer.writeBoolean("hasPrimary", hasPrimary))
+ return false;
+
+ writer.incrementState();
+
+ case 13:
+ if (!writer.writeObjectArray("invokeArgsBytes", invokeArgsBytes, MessageCollectionItemType.BYTE_ARR))
+ return false;
+
+ writer.incrementState();
+
+ case 14:
+ if (!writer.writeBoolean("keepBinary", keepBinary))
+ return false;
+
+ writer.incrementState();
+
+ case 15:
+ if (!writer.writeCollection("keys", keys, MessageCollectionItemType.MSG))
+ return false;
+
+ writer.incrementState();
+
+ case 16:
+ if (!writer.writeByte("op", op != null ? (byte)op.ordinal() : -1))
+ return false;
+
+ writer.incrementState();
+
+ case 17:
+ if (!writer.writeCollection("partIds", partIds, MessageCollectionItemType.INT))
+ return false;
+
+ writer.incrementState();
+
+ case 18:
+ if (!writer.writeBoolean("retval", retval))
+ return false;
+
+ writer.incrementState();
+
+ case 19:
+ if (!writer.writeBoolean("skipStore", skipStore))
+ return false;
+
+ writer.incrementState();
+
+ case 20:
+ if (!writer.writeUuid("subjId", subjId))
+ return false;
+
+ writer.incrementState();
+
+ case 21:
+ if (!writer.writeByte("syncMode", syncMode != null ? (byte)syncMode.ordinal() : -1))
+ return false;
+
+ writer.incrementState();
+
+ case 22:
+ if (!writer.writeInt("taskNameHash", taskNameHash))
+ return false;
+
+ writer.incrementState();
+
+ case 23:
+ if (!writer.writeBoolean("topLocked", topLocked))
+ return false;
+
+ writer.incrementState();
+
+ case 24:
+ if (!writer.writeMessage("topVer", topVer))
+ return false;
+
+ writer.incrementState();
+
+ case 25:
+ if (!writer.writeMessage("updateVer", updateVer))
+ return false;
+
+ writer.incrementState();
+
+ case 26:
+ if (!writer.writeCollection("vals", vals, MessageCollectionItemType.MSG))
+ return false;
+
+ writer.incrementState();
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+ reader.setBuffer(buf);
+
+ if (!reader.beforeMessageRead())
+ return false;
+
+ if (!super.readFrom(buf, reader))
+ return false;
+
+ switch (reader.state()) {
+ case 3:
+ clientReq = reader.readBoolean("clientReq");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 4:
+ conflictExpireTimes = reader.readMessage("conflictExpireTimes");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 5:
+ conflictTtls = reader.readMessage("conflictTtls");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 6:
+ conflictVers = reader.readCollection("conflictVers", MessageCollectionItemType.MSG);
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 7:
+ entryProcessorsBytes = reader.readCollection("entryProcessorsBytes", MessageCollectionItemType.BYTE_ARR);
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 8:
+ expiryPlcBytes = reader.readByteArray("expiryPlcBytes");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 9:
+ fastMap = reader.readBoolean("fastMap");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 10:
+ filter = reader.readObjectArray("filter", MessageCollectionItemType.MSG, CacheEntryPredicate.class);
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 11:
+ futVer = reader.readMessage("futVer");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 12:
+ hasPrimary = reader.readBoolean("hasPrimary");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 13:
+ invokeArgsBytes = reader.readObjectArray("invokeArgsBytes", MessageCollectionItemType.BYTE_ARR, byte[].class);
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 14:
+ keepBinary = reader.readBoolean("keepBinary");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 15:
+ keys = reader.readCollection("keys", MessageCollectionItemType.MSG);
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 16:
+ byte opOrd;
+
+ opOrd = reader.readByte("op");
+
+ if (!reader.isLastRead())
+ return false;
+
+ op = GridCacheOperation.fromOrdinal(opOrd);
+
+ reader.incrementState();
+
+ case 17:
+ partIds = reader.readCollection("partIds", MessageCollectionItemType.INT);
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 18:
+ retval = reader.readBoolean("retval");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 19:
+ skipStore = reader.readBoolean("skipStore");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 20:
+ subjId = reader.readUuid("subjId");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 21:
+ byte syncModeOrd;
+
+ syncModeOrd = reader.readByte("syncMode");
+
+ if (!reader.isLastRead())
+ return false;
+
+ syncMode = CacheWriteSynchronizationMode.fromOrdinal(syncModeOrd);
+
+ reader.incrementState();
+
+ case 22:
+ taskNameHash = reader.readInt("taskNameHash");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 23:
+ topLocked = reader.readBoolean("topLocked");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 24:
+ topVer = reader.readMessage("topVer");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 25:
+ updateVer = reader.readMessage("updateVer");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 26:
+ vals = reader.readCollection("vals", MessageCollectionItemType.MSG);
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ }
+
+ return reader.afterMessageRead(GridNearAtomicFullUpdateRequest.class);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void cleanup(boolean clearKeys) {
+ vals = null;
+ entryProcessors = null;
+ entryProcessorsBytes = null;
+ invokeArgs = null;
+ invokeArgsBytes = null;
+
+ if (clearKeys)
+ keys = null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 40;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte fieldsCount() {
+ return 27;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridNearAtomicFullUpdateRequest.class, this, "filter", Arrays.toString(filter),
+ "parent", super.toString());
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFilterRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFilterRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFilterRequest.java
new file mode 100644
index 0000000..e0c24b2
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFilterRequest.java
@@ -0,0 +1,226 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import java.io.Externalizable;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import java.util.UUID;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheOperation;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
+import org.apache.ignite.plugin.extensions.communication.MessageReader;
+import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ *
+ */
+public class GridNearAtomicSingleUpdateFilterRequest extends GridNearAtomicSingleUpdateRequest {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Filter. */
+ private CacheEntryPredicate[] filter;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ public GridNearAtomicSingleUpdateFilterRequest() {
+ // No-op.
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param cacheId Cache ID.
+ * @param nodeId Node ID.
+ * @param futVer Future version.
+ * @param fastMap Fast map scheme flag.
+ * @param updateVer Update version set if fast map is performed.
+ * @param topVer Topology version.
+ * @param topLocked Topology locked flag.
+ * @param syncMode Synchronization mode.
+ * @param op Cache update operation.
+ * @param retval Return value required flag.
+ * @param filter Optional filter for atomic check.
+ * @param subjId Subject ID.
+ * @param taskNameHash Task name hash code.
+ * @param skipStore Skip write-through to a persistent storage.
+ * @param keepBinary Keep binary flag.
+ * @param clientReq Client node request flag.
+ * @param addDepInfo Deployment info flag.
+ */
+ GridNearAtomicSingleUpdateFilterRequest(
+ int cacheId,
+ UUID nodeId,
+ GridCacheVersion futVer,
+ boolean fastMap,
+ @Nullable GridCacheVersion updateVer,
+ @NotNull AffinityTopologyVersion topVer,
+ boolean topLocked,
+ CacheWriteSynchronizationMode syncMode,
+ GridCacheOperation op,
+ boolean retval,
+ @Nullable CacheEntryPredicate[] filter,
+ @Nullable UUID subjId,
+ int taskNameHash,
+ boolean skipStore,
+ boolean keepBinary,
+ boolean clientReq,
+ boolean addDepInfo
+ ) {
+ super(
+ cacheId,
+ nodeId,
+ futVer,
+ fastMap,
+ updateVer,
+ topVer,
+ topLocked,
+ syncMode,
+ op,
+ retval,
+ subjId,
+ taskNameHash,
+ skipStore,
+ keepBinary,
+ clientReq,
+ addDepInfo
+ );
+
+ assert filter != null && filter.length > 0;
+
+ this.filter = filter;
+ }
+
+ /** {@inheritDoc} */
+ @Override @Nullable public CacheEntryPredicate[] filter() {
+ return filter;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+ if (filter != null) {
+ boolean hasFilter = false;
+
+ for (CacheEntryPredicate p : filter) {
+ if (p != null) {
+ hasFilter = true;
+
+ p.prepareMarshal(cctx);
+ }
+ }
+
+ if (!hasFilter)
+ filter = null;
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ if (filter != null) {
+ GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+ for (CacheEntryPredicate p : filter) {
+ if (p != null)
+ p.finishUnmarshal(cctx, ldr);
+ }
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+ writer.setBuffer(buf);
+
+ if (!super.writeTo(buf, writer))
+ return false;
+
+ if (!writer.isHeaderWritten()) {
+ if (!writer.writeHeader(directType(), fieldsCount()))
+ return false;
+
+ writer.onHeaderWritten();
+ }
+
+ switch (writer.state()) {
+ case 14:
+ if (!writer.writeObjectArray("filter", filter, MessageCollectionItemType.MSG))
+ return false;
+
+ writer.incrementState();
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+ reader.setBuffer(buf);
+
+ if (!reader.beforeMessageRead())
+ return false;
+
+ if (!super.readFrom(buf, reader))
+ return false;
+
+ switch (reader.state()) {
+ case 14:
+ filter = reader.readObjectArray("filter", MessageCollectionItemType.MSG, CacheEntryPredicate.class);
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ }
+
+ return reader.afterMessageRead(GridNearAtomicSingleUpdateFilterRequest.class);
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 127;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte fieldsCount() {
+ return 15;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridNearAtomicSingleUpdateFilterRequest.class, this, "filter", Arrays.toString(filter),
+ "parent", super.toString());
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java
index 256c7ac..eaf2f2c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java
@@ -49,6 +49,7 @@ import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.lang.IgniteProductVersion;
import org.jetbrains.annotations.Nullable;
import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
@@ -58,6 +59,9 @@ import static org.apache.ignite.internal.processors.cache.GridCacheOperation.TRA
* DHT atomic cache near update future.
*/
public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpdateFuture {
+ /** */
+ private static final IgniteProductVersion SINGLE_UPDATE_REQUEST = IgniteProductVersion.fromString("1.7.4");
+
/** Keys */
private Object key;
@@ -66,7 +70,7 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
private Object val;
/** Not null is operation is mapped to single node. */
- private GridNearAtomicUpdateRequest req;
+ private GridNearAtomicAbstractUpdateRequest req;
/**
* @param cctx Cache context.
@@ -126,7 +130,7 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
@Override public boolean onNodeLeft(UUID nodeId) {
GridNearAtomicUpdateResponse res = null;
- GridNearAtomicUpdateRequest req;
+ GridNearAtomicAbstractUpdateRequest req;
synchronized (mux) {
req = this.req != null && this.req.nodeId().equals(nodeId) ? this.req : null;
@@ -192,8 +196,8 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
/** {@inheritDoc} */
@SuppressWarnings({"unchecked", "ThrowableResultOfMethodCallIgnored"})
- @Override public void onResult(UUID nodeId, GridNearAtomicUpdateResponse res, boolean nodeErr) {
- GridNearAtomicUpdateRequest req;
+ @Override public void onResult(UUID nodeId, GridNearAtomicUpdateResponse res, boolean nodeErr) {
+ GridNearAtomicAbstractUpdateRequest req;
AffinityTopologyVersion remapTopVer = null;
@@ -369,7 +373,7 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
* @param req Update request.
* @param res Update response.
*/
- private void updateNear(GridNearAtomicUpdateRequest req, GridNearAtomicUpdateResponse res) {
+ private void updateNear(GridNearAtomicAbstractUpdateRequest req, GridNearAtomicUpdateResponse res) {
assert nearEnabled;
if (res.remapKeys() != null || !req.hasPrimary())
@@ -446,7 +450,7 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
}
Exception err = null;
- GridNearAtomicUpdateRequest singleReq0 = null;
+ GridNearAtomicAbstractUpdateRequest singleReq0 = null;
GridCacheVersion futVer = cctx.versions().next(topVer);
@@ -535,7 +539,7 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
* @return Request.
* @throws Exception If failed.
*/
- private GridNearAtomicUpdateRequest mapSingleUpdate(AffinityTopologyVersion topVer,
+ private GridNearAtomicAbstractUpdateRequest mapSingleUpdate(AffinityTopologyVersion topVer,
GridCacheVersion futVer,
@Nullable GridCacheVersion updVer) throws Exception {
if (key == null)
@@ -559,27 +563,94 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
throw new ClusterTopologyServerNotFoundException("Failed to map keys for cache (all partition nodes " +
"left the grid).");
- GridNearAtomicUpdateRequest req = new GridNearAtomicUpdateRequest(
- cctx.cacheId(),
- primary.id(),
- futVer,
- false,
- updVer,
- topVer,
- topLocked,
- syncMode,
- op,
- retval,
- expiryPlc,
- invokeArgs,
- filter,
- subjId,
- taskNameHash,
- skipStore,
- keepBinary,
- cctx.kernalContext().clientNode(),
- cctx.deploymentEnabled(),
- 1);
+ GridNearAtomicAbstractUpdateRequest req;
+
+ if (canUseSingleRequest(primary)) {
+ if (op == TRANSFORM) {
+ req = new GridNearAtomicSingleUpdateInvokeRequest(
+ cctx.cacheId(),
+ primary.id(),
+ futVer,
+ false,
+ updVer,
+ topVer,
+ topLocked,
+ syncMode,
+ op,
+ retval,
+ invokeArgs,
+ subjId,
+ taskNameHash,
+ skipStore,
+ keepBinary,
+ cctx.kernalContext().clientNode(),
+ cctx.deploymentEnabled());
+ }
+ else {
+ if (filter == null || filter.length == 0) {
+ req = new GridNearAtomicSingleUpdateRequest(
+ cctx.cacheId(),
+ primary.id(),
+ futVer,
+ false,
+ updVer,
+ topVer,
+ topLocked,
+ syncMode,
+ op,
+ retval,
+ subjId,
+ taskNameHash,
+ skipStore,
+ keepBinary,
+ cctx.kernalContext().clientNode(),
+ cctx.deploymentEnabled());
+ }
+ else {
+ req = new GridNearAtomicSingleUpdateFilterRequest(
+ cctx.cacheId(),
+ primary.id(),
+ futVer,
+ false,
+ updVer,
+ topVer,
+ topLocked,
+ syncMode,
+ op,
+ retval,
+ filter,
+ subjId,
+ taskNameHash,
+ skipStore,
+ keepBinary,
+ cctx.kernalContext().clientNode(),
+ cctx.deploymentEnabled());
+ }
+ }
+ }
+ else {
+ req = new GridNearAtomicFullUpdateRequest(
+ cctx.cacheId(),
+ primary.id(),
+ futVer,
+ false,
+ updVer,
+ topVer,
+ topLocked,
+ syncMode,
+ op,
+ retval,
+ expiryPlc,
+ invokeArgs,
+ filter,
+ subjId,
+ taskNameHash,
+ skipStore,
+ keepBinary,
+ cctx.kernalContext().clientNode(),
+ cctx.deploymentEnabled(),
+ 1);
+ }
req.addUpdateEntry(cacheKey,
val,
@@ -591,6 +662,16 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
return req;
}
+ /**
+ * @param node Target node
+ * @return {@code True} can use 'single' update requests.
+ */
+ private boolean canUseSingleRequest(ClusterNode node) {
+ assert node != null;
+
+ return expiryPlc == null && node.version().compareToIgnoreTimestamp(SINGLE_UPDATE_REQUEST) >= 0;
+ }
+
/** {@inheritDoc} */
public String toString() {
synchronized (mux) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateInvokeRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateInvokeRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateInvokeRequest.java
new file mode 100644
index 0000000..42b51d6
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateInvokeRequest.java
@@ -0,0 +1,303 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import java.io.Externalizable;
+import java.nio.ByteBuffer;
+import java.util.Collections;
+import java.util.List;
+import java.util.UUID;
+import javax.cache.processor.EntryProcessor;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.internal.GridDirectTransient;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheOperation;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
+import org.apache.ignite.plugin.extensions.communication.MessageReader;
+import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import static org.apache.ignite.internal.processors.cache.GridCacheOperation.TRANSFORM;
+
+/**
+ *
+ */
+public class GridNearAtomicSingleUpdateInvokeRequest extends GridNearAtomicSingleUpdateRequest {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Optional arguments for entry processor. */
+ @GridDirectTransient
+ private Object[] invokeArgs;
+
+ /** Entry processor arguments bytes. */
+ private byte[][] invokeArgsBytes;
+
+ /** Entry processors. */
+ @GridDirectTransient
+ private EntryProcessor<Object, Object, Object> entryProcessor;
+
+ /** Entry processors bytes. */
+ private byte[] entryProcessorBytes;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ public GridNearAtomicSingleUpdateInvokeRequest() {
+ // No-op.
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param cacheId Cache ID.
+ * @param nodeId Node ID.
+ * @param futVer Future version.
+ * @param fastMap Fast map scheme flag.
+ * @param updateVer Update version set if fast map is performed.
+ * @param topVer Topology version.
+ * @param topLocked Topology locked flag.
+ * @param syncMode Synchronization mode.
+ * @param op Cache update operation.
+ * @param retval Return value required flag.
+ * @param invokeArgs Optional arguments for entry processor.
+ * @param subjId Subject ID.
+ * @param taskNameHash Task name hash code.
+ * @param skipStore Skip write-through to a persistent storage.
+ * @param keepBinary Keep binary flag.
+ * @param clientReq Client node request flag.
+ * @param addDepInfo Deployment info flag.
+ */
+ GridNearAtomicSingleUpdateInvokeRequest(
+ int cacheId,
+ UUID nodeId,
+ GridCacheVersion futVer,
+ boolean fastMap,
+ @Nullable GridCacheVersion updateVer,
+ @NotNull AffinityTopologyVersion topVer,
+ boolean topLocked,
+ CacheWriteSynchronizationMode syncMode,
+ GridCacheOperation op,
+ boolean retval,
+ @Nullable Object[] invokeArgs,
+ @Nullable UUID subjId,
+ int taskNameHash,
+ boolean skipStore,
+ boolean keepBinary,
+ boolean clientReq,
+ boolean addDepInfo
+ ) {
+ super(
+ cacheId,
+ nodeId,
+ futVer,
+ fastMap,
+ updateVer,
+ topVer,
+ topLocked,
+ syncMode,
+ op,
+ retval,
+ subjId,
+ taskNameHash,
+ skipStore,
+ keepBinary,
+ clientReq,
+ addDepInfo
+ );
+ this.invokeArgs = invokeArgs;
+
+ assert op == TRANSFORM : op;
+ }
+
+ /**
+ * @param key Key to add.
+ * @param val Optional update value.
+ * @param conflictTtl Conflict TTL (optional).
+ * @param conflictExpireTime Conflict expire time (optional).
+ * @param conflictVer Conflict version (optional).
+ * @param primary If given key is primary on this mapping.
+ */
+ @Override public void addUpdateEntry(KeyCacheObject key,
+ @Nullable Object val,
+ long conflictTtl,
+ long conflictExpireTime,
+ @Nullable GridCacheVersion conflictVer,
+ boolean primary) {
+ assert conflictTtl < 0 : conflictTtl;
+ assert conflictExpireTime < 0 : conflictExpireTime;
+ assert conflictVer == null : conflictVer;
+ assert val instanceof EntryProcessor : val;
+
+ entryProcessor = (EntryProcessor<Object, Object, Object>)val;
+
+ this.key = key;
+ partId = key.partition();
+
+ hasPrimary(hasPrimary() | primary);
+ }
+
+ /** {@inheritDoc} */
+ @Override public List<?> values() {
+ return Collections.singletonList(entryProcessor);
+ }
+
+ /** {@inheritDoc} */
+ @Override public CacheObject value(int idx) {
+ assert idx == 0 : idx;
+
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public EntryProcessor<Object, Object, Object> entryProcessor(int idx) {
+ assert idx == 0 : idx;
+
+ return entryProcessor;
+ }
+
+ /** {@inheritDoc} */
+ @Override public CacheObject writeValue(int idx) {
+ assert idx == 0 : idx;
+
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public Object[] invokeArguments() {
+ return invokeArgs;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+ // force addition of deployment info for entry processors if P2P is enabled globally.
+ if (!addDepInfo && ctx.deploymentEnabled())
+ addDepInfo = true;
+
+ if (entryProcessor != null && entryProcessorBytes == null)
+ entryProcessorBytes = CU.marshal(cctx, entryProcessor);
+
+ if (invokeArgsBytes == null)
+ invokeArgsBytes = marshalInvokeArguments(invokeArgs, cctx);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ if (entryProcessorBytes != null && entryProcessor == null)
+ entryProcessor = U.unmarshal(ctx, entryProcessorBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
+
+ if (invokeArgs == null)
+ invokeArgs = unmarshalInvokeArguments(invokeArgsBytes, ctx, ldr);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void cleanup(boolean clearKey) {
+ super.cleanup(clearKey);
+
+ entryProcessor = null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+ writer.setBuffer(buf);
+
+ if (!super.writeTo(buf, writer))
+ return false;
+
+ if (!writer.isHeaderWritten()) {
+ if (!writer.writeHeader(directType(), fieldsCount()))
+ return false;
+
+ writer.onHeaderWritten();
+ }
+
+ switch (writer.state()) {
+ case 14:
+ if (!writer.writeByteArray("entryProcessorBytes", entryProcessorBytes))
+ return false;
+
+ writer.incrementState();
+
+ case 15:
+ if (!writer.writeObjectArray("invokeArgsBytes", invokeArgsBytes, MessageCollectionItemType.BYTE_ARR))
+ return false;
+
+ writer.incrementState();
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+ reader.setBuffer(buf);
+
+ if (!reader.beforeMessageRead())
+ return false;
+
+ if (!super.readFrom(buf, reader))
+ return false;
+
+ switch (reader.state()) {
+ case 14:
+ entryProcessorBytes = reader.readByteArray("entryProcessorBytes");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 15:
+ invokeArgsBytes = reader.readObjectArray("invokeArgsBytes", MessageCollectionItemType.BYTE_ARR, byte[].class);
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ }
+
+ return reader.afterMessageRead(GridNearAtomicSingleUpdateInvokeRequest.class);
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte fieldsCount() {
+ return 16;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 126;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java
new file mode 100644
index 0000000..211b472
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java
@@ -0,0 +1,359 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import java.io.Externalizable;
+import java.nio.ByteBuffer;
+import java.util.Collections;
+import java.util.List;
+import java.util.UUID;
+import javax.cache.processor.EntryProcessor;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheOperation;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.plugin.extensions.communication.MessageReader;
+import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import static org.apache.ignite.internal.processors.cache.GridCacheOperation.DELETE;
+import static org.apache.ignite.internal.processors.cache.GridCacheOperation.TRANSFORM;
+
+/**
+ *
+ */
+public class GridNearAtomicSingleUpdateRequest extends GridNearAtomicAbstractSingleUpdateRequest {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Key to update. */
+ @GridToStringInclude
+ protected KeyCacheObject key;
+
+ /** Value to update. */
+ protected CacheObject val;
+
+ /** Partition of key. */
+ protected int partId;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ public GridNearAtomicSingleUpdateRequest() {
+ // No-op.
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param cacheId Cache ID.
+ * @param nodeId Node ID.
+ * @param futVer Future version.
+ * @param fastMap Fast map scheme flag.
+ * @param updateVer Update version set if fast map is performed.
+ * @param topVer Topology version.
+ * @param topLocked Topology locked flag.
+ * @param syncMode Synchronization mode.
+ * @param op Cache update operation.
+ * @param retval Return value required flag.
+ * @param subjId Subject ID.
+ * @param taskNameHash Task name hash code.
+ * @param skipStore Skip write-through to a persistent storage.
+ * @param keepBinary Keep binary flag.
+ * @param clientReq Client node request flag.
+ * @param addDepInfo Deployment info flag.
+ */
+ GridNearAtomicSingleUpdateRequest(
+ int cacheId,
+ UUID nodeId,
+ GridCacheVersion futVer,
+ boolean fastMap,
+ @Nullable GridCacheVersion updateVer,
+ @NotNull AffinityTopologyVersion topVer,
+ boolean topLocked,
+ CacheWriteSynchronizationMode syncMode,
+ GridCacheOperation op,
+ boolean retval,
+ @Nullable UUID subjId,
+ int taskNameHash,
+ boolean skipStore,
+ boolean keepBinary,
+ boolean clientReq,
+ boolean addDepInfo
+ ) {
+ super(
+ cacheId,
+ nodeId,
+ futVer,
+ fastMap,
+ updateVer,
+ topVer,
+ topLocked,
+ syncMode,
+ op,
+ retval,
+ subjId,
+ taskNameHash,
+ skipStore,
+ keepBinary,
+ clientReq,
+ addDepInfo
+ );
+ }
+
+ /**
+ * @param key Key to add.
+ * @param val Optional update value.
+ * @param conflictTtl Conflict TTL (optional).
+ * @param conflictExpireTime Conflict expire time (optional).
+ * @param conflictVer Conflict version (optional).
+ * @param primary If given key is primary on this mapping.
+ */
+ @Override public void addUpdateEntry(KeyCacheObject key,
+ @Nullable Object val,
+ long conflictTtl,
+ long conflictExpireTime,
+ @Nullable GridCacheVersion conflictVer,
+ boolean primary) {
+ assert op != TRANSFORM;
+ assert val != null || op == DELETE;
+ assert conflictTtl < 0 : conflictTtl;
+ assert conflictExpireTime < 0 : conflictExpireTime;
+ assert conflictVer == null : conflictVer;
+
+ this.key = key;
+ partId = key.partition();
+
+ if (val != null) {
+ assert val instanceof CacheObject : val;
+
+ this.val = (CacheObject)val;
+ }
+
+ hasPrimary(hasPrimary() | primary);
+ }
+
+ /** {@inheritDoc} */
+ @Override public int size() {
+ return key == null ? 0 : 1;
+ }
+
+ /** {@inheritDoc} */
+ @Override public List<KeyCacheObject> keys() {
+ return Collections.singletonList(key);
+ }
+
+ /** {@inheritDoc} */
+ @Override public KeyCacheObject key(int idx) {
+ assert idx == 0 : idx;
+
+ return key;
+ }
+
+ /** {@inheritDoc} */
+ @Override public List<?> values() {
+ return Collections.singletonList(val);
+ }
+
+ /** {@inheritDoc} */
+ @Override public CacheObject value(int idx) {
+ assert idx == 0 : idx;
+
+ return val;
+ }
+
+ /** {@inheritDoc} */
+ @Override public EntryProcessor<Object, Object, Object> entryProcessor(int idx) {
+ assert idx == 0 : idx;
+
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public CacheObject writeValue(int idx) {
+ assert idx == 0 : idx;
+
+ return val;
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public List<GridCacheVersion> conflictVersions() {
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public GridCacheVersion conflictVersion(int idx) {
+ assert idx == 0 : idx;
+
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long conflictTtl(int idx) {
+ assert idx == 0 : idx;
+
+ return CU.TTL_NOT_CHANGED;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long conflictExpireTime(int idx) {
+ assert idx == 0 : idx;
+
+ return CU.EXPIRE_TIME_CALCULATE;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @param ctx
+ */
+ @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+ prepareMarshalCacheObject(key, cctx);
+
+ if (val != null)
+ prepareMarshalCacheObject(val, cctx);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+ key.finishUnmarshal(cctx.cacheObjectContext(), ldr);
+
+ if (val != null)
+ val.finishUnmarshal(cctx.cacheObjectContext(), ldr);
+
+ key.partition(partId);
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+ writer.setBuffer(buf);
+
+ if (!super.writeTo(buf, writer))
+ return false;
+
+ if (!writer.isHeaderWritten()) {
+ if (!writer.writeHeader(directType(), fieldsCount()))
+ return false;
+
+ writer.onHeaderWritten();
+ }
+
+ switch (writer.state()) {
+ case 11:
+ if (!writer.writeMessage("key", key))
+ return false;
+
+ writer.incrementState();
+
+ case 12:
+ if (!writer.writeInt("partId", partId))
+ return false;
+
+ writer.incrementState();
+
+ case 13:
+ if (!writer.writeMessage("val", val))
+ return false;
+
+ writer.incrementState();
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+ reader.setBuffer(buf);
+
+ if (!reader.beforeMessageRead())
+ return false;
+
+ if (!super.readFrom(buf, reader))
+ return false;
+
+ switch (reader.state()) {
+ case 11:
+ key = reader.readMessage("key");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 12:
+ partId = reader.readInt("partId");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 13:
+ val = reader.readMessage("val");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ }
+
+ return reader.afterMessageRead(GridNearAtomicSingleUpdateRequest.class);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void cleanup(boolean clearKey) {
+ val = null;
+
+ if (clearKey)
+ key = null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return 125;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte fieldsCount() {
+ return 14;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridNearAtomicSingleUpdateRequest.class, this, "parent", super.toString());
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
index 30a0c3d..cd64117 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
@@ -87,13 +87,13 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
/** Mappings if operations is mapped to more than one node. */
@GridToStringInclude
- private Map<UUID, GridNearAtomicUpdateRequest> mappings;
+ private Map<UUID, GridNearAtomicFullUpdateRequest> mappings;
/** Keys to remap. */
private Collection<KeyCacheObject> remapKeys;
/** Not null is operation is mapped to single node. */
- private GridNearAtomicUpdateRequest singleReq;
+ private GridNearAtomicFullUpdateRequest singleReq;
/**
* @param cctx Cache context.
@@ -164,7 +164,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
@Override public boolean onNodeLeft(UUID nodeId) {
GridNearAtomicUpdateResponse res = null;
- GridNearAtomicUpdateRequest req;
+ GridNearAtomicFullUpdateRequest req;
synchronized (mux) {
if (singleReq != null)
@@ -258,7 +258,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
/** {@inheritDoc} */
@SuppressWarnings({"unchecked", "ThrowableResultOfMethodCallIgnored"})
@Override public void onResult(UUID nodeId, GridNearAtomicUpdateResponse res, boolean nodeErr) {
- GridNearAtomicUpdateRequest req;
+ GridNearAtomicFullUpdateRequest req;
AffinityTopologyVersion remapTopVer = null;
@@ -406,7 +406,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
if (rcvAll && nearEnabled) {
if (mappings != null) {
- for (GridNearAtomicUpdateRequest req0 : mappings.values()) {
+ for (GridNearAtomicFullUpdateRequest req0 : mappings.values()) {
GridNearAtomicUpdateResponse res0 = req0.response();
assert res0 != null : req0;
@@ -482,7 +482,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
* @param req Update request.
* @param res Update response.
*/
- private void updateNear(GridNearAtomicUpdateRequest req, GridNearAtomicUpdateResponse res) {
+ private void updateNear(GridNearAtomicFullUpdateRequest req, GridNearAtomicUpdateResponse res) {
assert nearEnabled;
if (res.remapKeys() != null || !req.hasPrimary())
@@ -552,13 +552,13 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
*
* @param mappings Mappings to send.
*/
- private void doUpdate(Map<UUID, GridNearAtomicUpdateRequest> mappings) {
+ private void doUpdate(Map<UUID, GridNearAtomicFullUpdateRequest> mappings) {
UUID locNodeId = cctx.localNodeId();
- GridNearAtomicUpdateRequest locUpdate = null;
+ GridNearAtomicFullUpdateRequest locUpdate = null;
// Send messages to remote nodes first, then run local update.
- for (GridNearAtomicUpdateRequest req : mappings.values()) {
+ for (GridNearAtomicFullUpdateRequest req : mappings.values()) {
if (locNodeId.equals(req.nodeId())) {
assert locUpdate == null : "Cannot have more than one local mapping [locUpdate=" + locUpdate +
", req=" + req + ']';
@@ -590,8 +590,8 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
if (locUpdate != null) {
cache.updateAllAsyncInternal(cctx.localNodeId(), locUpdate,
- new CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse>() {
- @Override public void apply(GridNearAtomicUpdateRequest req, GridNearAtomicUpdateResponse res) {
+ new CI2<GridNearAtomicFullUpdateRequest, GridNearAtomicUpdateResponse>() {
+ @Override public void apply(GridNearAtomicFullUpdateRequest req, GridNearAtomicUpdateResponse res) {
onResult(res.nodeId(), res, false);
}
});
@@ -621,8 +621,8 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
}
Exception err = null;
- GridNearAtomicUpdateRequest singleReq0 = null;
- Map<UUID, GridNearAtomicUpdateRequest> mappings0 = null;
+ GridNearAtomicFullUpdateRequest singleReq0 = null;
+ Map<UUID, GridNearAtomicFullUpdateRequest> mappings0 = null;
int size = keys.size();
@@ -651,7 +651,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
singleReq0 = mapSingleUpdate(topVer, futVer, updVer);
}
else {
- Map<UUID, GridNearAtomicUpdateRequest> pendingMappings = mapUpdate(topNodes,
+ Map<UUID, GridNearAtomicFullUpdateRequest> pendingMappings = mapUpdate(topNodes,
topVer,
futVer,
updVer,
@@ -663,7 +663,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
if (syncMode == PRIMARY_SYNC) {
mappings0 = U.newHashMap(pendingMappings.size());
- for (GridNearAtomicUpdateRequest req : pendingMappings.values()) {
+ for (GridNearAtomicFullUpdateRequest req : pendingMappings.values()) {
if (req.hasPrimary())
mappings0.put(req.nodeId(), req);
}
@@ -756,7 +756,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
* @throws Exception If failed.
*/
@SuppressWarnings("ForLoopReplaceableByForEach")
- private Map<UUID, GridNearAtomicUpdateRequest> mapUpdate(Collection<ClusterNode> topNodes,
+ private Map<UUID, GridNearAtomicFullUpdateRequest> mapUpdate(Collection<ClusterNode> topNodes,
AffinityTopologyVersion topVer,
GridCacheVersion futVer,
@Nullable GridCacheVersion updVer,
@@ -776,7 +776,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
if (conflictRmvVals != null)
conflictRmvValsIt = conflictRmvVals.iterator();
- Map<UUID, GridNearAtomicUpdateRequest> pendingMappings = U.newHashMap(topNodes.size());
+ Map<UUID, GridNearAtomicFullUpdateRequest> pendingMappings = U.newHashMap(topNodes.size());
// Create mappings first, then send messages.
for (Object key : keys) {
@@ -848,10 +848,10 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
UUID nodeId = affNode.id();
- GridNearAtomicUpdateRequest mapped = pendingMappings.get(nodeId);
+ GridNearAtomicFullUpdateRequest mapped = pendingMappings.get(nodeId);
if (mapped == null) {
- mapped = new GridNearAtomicUpdateRequest(
+ mapped = new GridNearAtomicFullUpdateRequest(
cctx.cacheId(),
nodeId,
futVer,
@@ -892,7 +892,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
* @return Request.
* @throws Exception If failed.
*/
- private GridNearAtomicUpdateRequest mapSingleUpdate(AffinityTopologyVersion topVer,
+ private GridNearAtomicFullUpdateRequest mapSingleUpdate(AffinityTopologyVersion topVer,
GridCacheVersion futVer,
@Nullable GridCacheVersion updVer) throws Exception {
Object key = F.first(keys);
@@ -953,7 +953,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
throw new ClusterTopologyServerNotFoundException("Failed to map keys for cache (all partition nodes " +
"left the grid).");
- GridNearAtomicUpdateRequest req = new GridNearAtomicUpdateRequest(
+ GridNearAtomicFullUpdateRequest req = new GridNearAtomicFullUpdateRequest(
cctx.cacheId(),
primary.id(),
futVer,
[36/50] [abbrv] ignite git commit: IGNITE-3075 Implement single
key-value pair DHT request/response for ATOMIC cache.
Posted by sb...@apache.org.
IGNITE-3075 Implement single key-value pair DHT request/response for ATOMIC cache.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/51ca24f2
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/51ca24f2
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/51ca24f2
Branch: refs/heads/master
Commit: 51ca24f2db32dff9c0034603ea3abfe5ef5cd846
Parents: 88f38ac
Author: Konstantin Dudkov <kd...@ya.ru>
Authored: Mon Nov 21 16:48:44 2016 +0300
Committer: Konstantin Dudkov <kd...@ya.ru>
Committed: Mon Nov 21 16:48:44 2016 +0300
----------------------------------------------------------------------
.../communication/GridIoMessageFactory.java | 10 +-
.../processors/cache/GridCacheIoManager.java | 25 +-
.../GridDhtAtomicAbstractUpdateFuture.java | 57 +-
.../GridDhtAtomicAbstractUpdateRequest.java | 287 ++++++++
.../dht/atomic/GridDhtAtomicCache.java | 17 +-
.../atomic/GridDhtAtomicSingleUpdateFuture.java | 61 ++
.../GridDhtAtomicSingleUpdateRequest.java | 678 +++++++++++++++++++
.../dht/atomic/GridDhtAtomicUpdateFuture.java | 26 +
.../dht/atomic/GridDhtAtomicUpdateRequest.java | 312 +++------
.../GridNearAtomicAbstractUpdateRequest.java | 5 +
.../atomic/GridNearAtomicFullUpdateRequest.java | 108 +--
.../GridNearAtomicSingleUpdateRequest.java | 5 +
.../distributed/near/GridNearAtomicCache.java | 8 +-
.../GridCacheAtomicMessageCountSelfTest.java | 6 +-
...eAtomicInvalidPartitionHandlingSelfTest.java | 2 +-
15 files changed, 1292 insertions(+), 315 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/51ca24f2/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
index b20de68..f36191c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
@@ -67,12 +67,13 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrep
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareResponse;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtUnlockRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicDeferredUpdateResponse;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicSingleUpdateRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponse;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicFullUpdateRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateFilterRequest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateInvokeRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysResponse;
@@ -774,7 +775,12 @@ public class GridIoMessageFactory implements MessageFactory {
break;
- // [-3..119] [124..127] - this
+ case -36:
+ msg = new GridDhtAtomicSingleUpdateRequest();
+
+ break;
+
+ // [-3..119] [124..127] [-36]- this
// [120..123] - DR
// [-4..-22, -30..-35] - SQL
default:
http://git-wip-us.apache.org/repos/asf/ignite/blob/51ca24f2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
index c5c1c60..924ce79 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
@@ -45,6 +45,8 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxFini
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareResponse;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedSingleGetFuture;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicAbstractUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicSingleUpdateRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponse;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicAbstractUpdateRequest;
@@ -470,8 +472,8 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
return ((GridNearAtomicAbstractUpdateRequest)cacheMsg).futureVersion();
else if (cacheMsg instanceof GridNearAtomicUpdateResponse)
return ((GridNearAtomicUpdateResponse) cacheMsg).futureVersion();
- else if (cacheMsg instanceof GridDhtAtomicUpdateRequest)
- return ((GridDhtAtomicUpdateRequest)cacheMsg).futureVersion();
+ else if (cacheMsg instanceof GridDhtAtomicAbstractUpdateRequest)
+ return ((GridDhtAtomicAbstractUpdateRequest)cacheMsg).futureVersion();
else if (cacheMsg instanceof GridDhtAtomicUpdateResponse)
return ((GridDhtAtomicUpdateResponse) cacheMsg).futureVersion();
@@ -486,8 +488,8 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
@Nullable private GridCacheVersion atomicWriteVersion(GridCacheMessage cacheMsg) {
if (cacheMsg instanceof GridNearAtomicAbstractUpdateRequest)
return ((GridNearAtomicAbstractUpdateRequest)cacheMsg).updateVersion();
- else if (cacheMsg instanceof GridDhtAtomicUpdateRequest)
- return ((GridDhtAtomicUpdateRequest)cacheMsg).writeVersion();
+ else if (cacheMsg instanceof GridDhtAtomicAbstractUpdateRequest)
+ return ((GridDhtAtomicAbstractUpdateRequest)cacheMsg).writeVersion();
return null;
}
@@ -791,6 +793,21 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
break;
+ case -36: {
+ GridDhtAtomicSingleUpdateRequest req = (GridDhtAtomicSingleUpdateRequest)msg;
+
+ GridDhtAtomicUpdateResponse res = new GridDhtAtomicUpdateResponse(
+ ctx.cacheId(),
+ req.futureVersion(),
+ ctx.deploymentEnabled());
+
+ res.onError(req.classError());
+
+ sendResponseOnFailedMessage(nodeId, res, cctx, ctx.ioPolicy());
+ }
+
+ break;
+
default:
throw new IgniteCheckedException("Failed to send response to node. Unsupported direct type [message="
+ msg + "]", msg.classError());
http://git-wip-us.apache.org/repos/asf/ignite/blob/51ca24f2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateFuture.java
index 3bbc348..7e4c4e0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateFuture.java
@@ -45,6 +45,7 @@ import org.apache.ignite.internal.util.typedef.CI2;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteUuid;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
@@ -80,7 +81,7 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridFutureAdapte
private final CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse> completionCb;
/** Update request. */
- private final GridNearAtomicAbstractUpdateRequest updateReq;
+ protected final GridNearAtomicAbstractUpdateRequest updateReq;
/** Update response. */
final GridNearAtomicUpdateResponse updateRes;
@@ -90,7 +91,7 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridFutureAdapte
/** Mappings. */
@GridToStringInclude
- protected Map<UUID, GridDhtAtomicUpdateRequest> mappings;
+ protected Map<UUID, GridDhtAtomicAbstractUpdateRequest> mappings;
/** Continuous query closures. */
private Collection<CI1<Boolean>> cntQryClsrs;
@@ -188,23 +189,16 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridFutureAdapte
UUID nodeId = node.id();
if (!nodeId.equals(cctx.localNodeId())) {
- GridDhtAtomicUpdateRequest updateReq = mappings.get(nodeId);
+ GridDhtAtomicAbstractUpdateRequest updateReq = mappings.get(nodeId);
if (updateReq == null) {
- updateReq = new GridDhtAtomicUpdateRequest(
- cctx.cacheId(),
- nodeId,
+ updateReq = createRequest(
+ node,
futVer,
writeVer,
syncMode,
topVer,
- forceTransformBackups,
- this.updateReq.subjectId(),
- this.updateReq.taskNameHash(),
- forceTransformBackups ? this.updateReq.invokeArguments() : null,
- cctx.deploymentEnabled(),
- this.updateReq.keepBinary(),
- this.updateReq.skipStore());
+ forceTransformBackups);
mappings.put(nodeId, updateReq);
}
@@ -256,7 +250,7 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridFutureAdapte
AffinityTopologyVersion topVer = updateReq.topologyVersion();
for (UUID nodeId : readers) {
- GridDhtAtomicUpdateRequest updateReq = mappings.get(nodeId);
+ GridDhtAtomicAbstractUpdateRequest updateReq = mappings.get(nodeId);
if (updateReq == null) {
ClusterNode node = cctx.discovery().node(nodeId);
@@ -265,20 +259,13 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridFutureAdapte
if (node == null)
continue;
- updateReq = new GridDhtAtomicUpdateRequest(
- cctx.cacheId(),
- nodeId,
+ updateReq = createRequest(
+ node,
futVer,
writeVer,
syncMode,
topVer,
- forceTransformBackups,
- this.updateReq.subjectId(),
- this.updateReq.taskNameHash(),
- forceTransformBackups ? this.updateReq.invokeArguments() : null,
- cctx.deploymentEnabled(),
- this.updateReq.keepBinary(),
- this.updateReq.skipStore());
+ forceTransformBackups);
mappings.put(nodeId, updateReq);
}
@@ -336,7 +323,7 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridFutureAdapte
final boolean registerResponse(UUID nodeId) {
int resCnt0;
- GridDhtAtomicUpdateRequest req = mappings != null ? mappings.get(nodeId) : null;
+ GridDhtAtomicAbstractUpdateRequest req = mappings != null ? mappings.get(nodeId) : null;
if (req != null) {
synchronized (this) {
@@ -365,7 +352,7 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridFutureAdapte
*/
final void map() {
if (!F.isEmpty(mappings)) {
- for (GridDhtAtomicUpdateRequest req : mappings.values()) {
+ for (GridDhtAtomicAbstractUpdateRequest req : mappings.values()) {
try {
cctx.io().send(req.nodeId(), req, cctx.ioPolicy());
@@ -412,6 +399,24 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridFutureAdapte
}
/**
+ * @param node Node.
+ * @param futVer Future version.
+ * @param writeVer Update version.
+ * @param syncMode Write synchronization mode.
+ * @param topVer Topology version.
+ * @param forceTransformBackups Force transform backups flag.
+ * @return Request.
+ */
+ protected abstract GridDhtAtomicAbstractUpdateRequest createRequest(
+ ClusterNode node,
+ GridCacheVersion futVer,
+ GridCacheVersion writeVer,
+ CacheWriteSynchronizationMode syncMode,
+ @NotNull AffinityTopologyVersion topVer,
+ boolean forceTransformBackups
+ );
+
+ /**
* Callback for backup update response.
*
* @param nodeId Backup node ID.
http://git-wip-us.apache.org/repos/asf/ignite/blob/51ca24f2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateRequest.java
new file mode 100644
index 0000000..f0bea07
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateRequest.java
@@ -0,0 +1,287 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import java.io.Externalizable;
+import java.util.UUID;
+import javax.cache.processor.EntryProcessor;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.internal.GridDirectTransient;
+import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
+import org.apache.ignite.internal.processors.cache.GridCacheMessage;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ *
+ */
+public abstract class GridDhtAtomicAbstractUpdateRequest extends GridCacheMessage implements GridCacheDeployable {
+ /** Message index. */
+ public static final int CACHE_MSG_IDX = nextIndexId();
+
+ /** Node ID. */
+ @GridDirectTransient
+ protected UUID nodeId;
+
+ /** On response flag. Access should be synced on future. */
+ @GridDirectTransient
+ private boolean onRes;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ protected GridDhtAtomicAbstractUpdateRequest() {
+ // N-op.
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param cacheId Cache ID.
+ * @param nodeId Node ID.
+ */
+ protected GridDhtAtomicAbstractUpdateRequest(int cacheId, UUID nodeId) {
+ this.cacheId = cacheId;
+ this.nodeId = nodeId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int lookupIndex() {
+ return CACHE_MSG_IDX;
+ }
+
+ /**
+ * @return Node ID.
+ */
+ public UUID nodeId() {
+ return nodeId;
+ }
+
+ /**
+ * @return Keep binary flag.
+ */
+ public abstract boolean keepBinary();
+
+ /**
+ * @return Skip write-through to a persistent storage.
+ */
+ public abstract boolean skipStore();
+
+ /**
+ * @return {@code True} if on response flag changed.
+ */
+ public boolean onResponse() {
+ return !onRes && (onRes = true);
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean addDeploymentInfo() {
+ return addDepInfo;
+ }
+
+ /**
+ * @return Force transform backups flag.
+ */
+ public abstract boolean forceTransformBackups();
+
+ /** {@inheritDoc} */
+ @Override public IgniteLogger messageLogger(GridCacheSharedContext ctx) {
+ return ctx.atomicMessageLogger();
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onAckReceived() {
+ cleanup();
+ }
+
+ /**
+ * @param key Key to add.
+ * @param val Value, {@code null} if should be removed.
+ * @param entryProcessor Entry processor.
+ * @param ttl TTL (optional).
+ * @param conflictExpireTime Conflict expire time (optional).
+ * @param conflictVer Conflict version (optional).
+ * @param addPrevVal If {@code true} adds previous value.
+ * @param partId Partition.
+ * @param prevVal Previous value.
+ * @param updateCntr Update counter.
+ */
+ public abstract void addWriteValue(KeyCacheObject key,
+ @Nullable CacheObject val,
+ EntryProcessor<Object, Object, Object> entryProcessor,
+ long ttl,
+ long conflictExpireTime,
+ @Nullable GridCacheVersion conflictVer,
+ boolean addPrevVal,
+ int partId,
+ @Nullable CacheObject prevVal,
+ @Nullable Long updateCntr
+ );
+
+ /**
+ * @param key Key to add.
+ * @param val Value, {@code null} if should be removed.
+ * @param entryProcessor Entry processor.
+ * @param ttl TTL.
+ * @param expireTime Expire time.
+ */
+ public abstract void addNearWriteValue(KeyCacheObject key,
+ @Nullable CacheObject val,
+ EntryProcessor<Object, Object, Object> entryProcessor,
+ long ttl,
+ long expireTime);
+
+ /**
+ * Cleanup values not needed after message was sent.
+ */
+ protected abstract void cleanup();
+
+ /**
+ * @return Subject ID.
+ */
+ public abstract UUID subjectId();
+
+ /**
+ * @return Task name.
+ */
+ public abstract int taskNameHash();
+
+ /**
+ * @return Version assigned on primary node.
+ */
+ public abstract GridCacheVersion futureVersion();
+
+ /**
+ * @return Write version.
+ */
+ public abstract GridCacheVersion writeVersion();
+
+ /**
+ * @return Cache write synchronization mode.
+ */
+ public abstract CacheWriteSynchronizationMode writeSynchronizationMode();
+
+ /**
+ * @return Keys size.
+ */
+ public abstract int size();
+
+ /**
+ * @return Keys size.
+ */
+ public abstract int nearSize();
+
+ /**
+ * @param key Key to check.
+ * @return {@code true} if request keys contain key.
+ */
+ public abstract boolean hasKey(KeyCacheObject key);
+
+ /**
+ * @param idx Key index.
+ * @return Key.
+ */
+ public abstract KeyCacheObject key(int idx);
+
+ /**
+ * @param idx Partition index.
+ * @return Partition id.
+ */
+ public abstract int partitionId(int idx);
+
+ /**
+ * @param updCntr Update counter.
+ * @return Update counter.
+ */
+ public abstract Long updateCounter(int updCntr);
+
+ /**
+ * @param idx Near key index.
+ * @return Key.
+ */
+ public abstract KeyCacheObject nearKey(int idx);
+
+ /**
+ * @param idx Key index.
+ * @return Value.
+ */
+ @Nullable public abstract CacheObject value(int idx);
+
+ /**
+ * @param idx Key index.
+ * @return Value.
+ */
+ @Nullable public abstract CacheObject previousValue(int idx);
+
+ /**
+ * @param idx Key index.
+ * @return Entry processor.
+ */
+ @Nullable public abstract EntryProcessor<Object, Object, Object> entryProcessor(int idx);
+
+ /**
+ * @param idx Near key index.
+ * @return Value.
+ */
+ @Nullable public abstract CacheObject nearValue(int idx);
+
+ /**
+ * @param idx Key index.
+ * @return Transform closure.
+ */
+ @Nullable public abstract EntryProcessor<Object, Object, Object> nearEntryProcessor(int idx);
+
+ /**
+ * @param idx Index.
+ * @return Conflict version.
+ */
+ @Nullable public abstract GridCacheVersion conflictVersion(int idx);
+
+ /**
+ * @param idx Index.
+ * @return TTL.
+ */
+ public abstract long ttl(int idx);
+
+ /**
+ * @param idx Index.
+ * @return TTL for near cache update.
+ */
+ public abstract long nearTtl(int idx);
+
+ /**
+ * @param idx Index.
+ * @return Conflict expire time.
+ */
+ public abstract long conflictExpireTime(int idx);
+
+ /**
+ * @param idx Index.
+ * @return Expire time for near cache update.
+ */
+ public abstract long nearExpireTime(int idx);
+
+ /**
+ * @return Optional arguments for entry processor.
+ */
+ @Nullable public abstract Object[] invokeArguments();
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/51ca24f2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index d7eb062..2a7055d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -360,11 +360,11 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
ctx.io().addHandler(
ctx.cacheId(),
- GridDhtAtomicUpdateRequest.class,
- new CI2<UUID, GridDhtAtomicUpdateRequest>() {
+ GridDhtAtomicAbstractUpdateRequest.class,
+ new CI2<UUID, GridDhtAtomicAbstractUpdateRequest>() {
@Override public void apply(
UUID nodeId,
- GridDhtAtomicUpdateRequest req
+ GridDhtAtomicAbstractUpdateRequest req
) {
processDhtAtomicUpdateRequest(
nodeId,
@@ -3100,12 +3100,9 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
GridNearAtomicAbstractUpdateFuture fut =
(GridNearAtomicAbstractUpdateFuture)ctx.mvcc().atomicFuture(res.futureVersion());
- if (fut != null) {
- if (fut instanceof GridNearAtomicSingleUpdateFuture)
- ((GridNearAtomicSingleUpdateFuture)fut).onResult(nodeId, res, false);
- else
- ((GridNearAtomicUpdateFuture)fut).onResult(nodeId, res, false);
- }
+ if (fut != null)
+ fut.onResult(nodeId, res, false);
+
else
U.warn(msgLog, "Failed to find near update future for update response (will ignore) " +
"[futId" + res.futureVersion() + ", node=" + nodeId + ", res=" + res + ']');
@@ -3115,7 +3112,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
* @param nodeId Sender node ID.
* @param req Dht atomic update request.
*/
- private void processDhtAtomicUpdateRequest(UUID nodeId, GridDhtAtomicUpdateRequest req) {
+ private void processDhtAtomicUpdateRequest(UUID nodeId, GridDhtAtomicAbstractUpdateRequest req) {
if (msgLog.isDebugEnabled()) {
msgLog.debug("Received DHT atomic update request [futId=" + req.futureVersion() +
", writeVer=" + req.writeVersion() + ", node=" + nodeId + ']');
http://git-wip-us.apache.org/repos/asf/ignite/blob/51ca24f2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateFuture.java
index f83a7b7..656caab 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateFuture.java
@@ -20,7 +20,9 @@ package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
import java.util.Collection;
import java.util.List;
import java.util.UUID;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedException;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
@@ -30,6 +32,8 @@ import org.apache.ignite.internal.util.typedef.CI2;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteProductVersion;
+import org.jetbrains.annotations.NotNull;
/**
*
@@ -38,6 +42,9 @@ class GridDhtAtomicSingleUpdateFuture extends GridDhtAtomicAbstractUpdateFuture
/** */
private static final long serialVersionUID = 0L;
+ /** */
+ private static final IgniteProductVersion SINGLE_UPDATE_REQUEST = IgniteProductVersion.fromString("1.7.4");
+
/** Future keys. */
private KeyCacheObject key;
@@ -87,6 +94,49 @@ class GridDhtAtomicSingleUpdateFuture extends GridDhtAtomicAbstractUpdateFuture
}
/** {@inheritDoc} */
+ @Override protected GridDhtAtomicAbstractUpdateRequest createRequest(
+ ClusterNode node,
+ GridCacheVersion futVer,
+ GridCacheVersion writeVer,
+ CacheWriteSynchronizationMode syncMode,
+ @NotNull AffinityTopologyVersion topVer,
+ boolean forceTransformBackups
+ ) {
+ if (canUseSingleRequest(node)) {
+ assert !forceTransformBackups;
+
+ return new GridDhtAtomicSingleUpdateRequest(
+ cctx.cacheId(),
+ node.id(),
+ futVer,
+ writeVer,
+ syncMode,
+ topVer,
+ updateReq.subjectId(),
+ updateReq.taskNameHash(),
+ cctx.deploymentEnabled(),
+ updateReq.keepBinary(),
+ updateReq.skipStore());
+ }
+ else {
+ return new GridDhtAtomicUpdateRequest(
+ cctx.cacheId(),
+ node.id(),
+ futVer,
+ writeVer,
+ syncMode,
+ topVer,
+ forceTransformBackups,
+ updateReq.subjectId(),
+ updateReq.taskNameHash(),
+ forceTransformBackups ? updateReq.invokeArguments() : null,
+ cctx.deploymentEnabled(),
+ updateReq.keepBinary(),
+ updateReq.skipStore());
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public void onResult(UUID nodeId, GridDhtAtomicUpdateResponse updateRes) {
if (log.isDebugEnabled())
log.debug("Received DHT atomic update future result [nodeId=" + nodeId + ", updateRes=" + updateRes + ']');
@@ -114,6 +164,17 @@ class GridDhtAtomicSingleUpdateFuture extends GridDhtAtomicAbstractUpdateFuture
updateRes.addFailedKey(key, err);
}
+ /**
+ * @param node Target node
+ * @return {@code true} if target node supports {@link GridNearAtomicSingleUpdateRequest}
+ */
+ private boolean canUseSingleRequest(ClusterNode node) {
+ return node.version().compareToIgnoreTimestamp(SINGLE_UPDATE_REQUEST) >= 0 &&
+ cctx.expiry() == null &&
+ updateReq.expiry() == null &&
+ !updateReq.hasConflictData();
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(GridDhtAtomicSingleUpdateFuture.class, this);
http://git-wip-us.apache.org/repos/asf/ignite/blob/51ca24f2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
new file mode 100644
index 0000000..a03d948
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
@@ -0,0 +1,678 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import java.io.Externalizable;
+import java.nio.ByteBuffer;
+import java.util.UUID;
+import javax.cache.processor.EntryProcessor;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.plugin.extensions.communication.MessageReader;
+import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import static org.apache.ignite.internal.processors.cache.GridCacheUtils.KEEP_BINARY_FLAG_MASK;
+import static org.apache.ignite.internal.processors.cache.GridCacheUtils.SKIP_STORE_FLAG_MASK;
+
+/**
+ *
+ */
+public class GridDhtAtomicSingleUpdateRequest extends GridDhtAtomicAbstractUpdateRequest {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Near cache key flag. */
+ private static final int NEAR_FLAG_MASK = 0x80;
+
+ /** Future version. */
+ protected GridCacheVersion futVer;
+
+ /** Write version. */
+ protected GridCacheVersion writeVer;
+
+ /** Write synchronization mode. */
+ protected CacheWriteSynchronizationMode syncMode;
+
+ /** Topology version. */
+ protected AffinityTopologyVersion topVer;
+
+ /** Subject ID. */
+ protected UUID subjId;
+
+ /** Task name hash. */
+ protected int taskNameHash;
+
+ /** Additional flags. */
+ protected byte flags;
+
+ /** Key to update. */
+ @GridToStringInclude
+ protected KeyCacheObject key;
+
+ /** Value to update. */
+ @GridToStringInclude
+ protected CacheObject val;
+
+ /** Previous value. */
+ @GridToStringInclude
+ protected CacheObject prevVal;
+
+ /** Partition. */
+ protected long updateCntr;
+
+ /** */
+ protected int partId;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ public GridDhtAtomicSingleUpdateRequest() {
+ // No-op.
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param cacheId Cache ID.
+ * @param nodeId Node ID.
+ * @param futVer Future version.
+ * @param writeVer Write version for cache values.
+ * @param syncMode Cache write synchronization mode.
+ * @param topVer Topology version.
+ * @param subjId Subject ID.
+ * @param taskNameHash Task name hash code.
+ * @param addDepInfo Deployment info.
+ * @param keepBinary Keep binary flag.
+ * @param skipStore Skip store flag.
+ */
+ GridDhtAtomicSingleUpdateRequest(
+ int cacheId,
+ UUID nodeId,
+ GridCacheVersion futVer,
+ GridCacheVersion writeVer,
+ CacheWriteSynchronizationMode syncMode,
+ @NotNull AffinityTopologyVersion topVer,
+ UUID subjId,
+ int taskNameHash,
+ boolean addDepInfo,
+ boolean keepBinary,
+ boolean skipStore
+ ) {
+ super(cacheId, nodeId);
+ this.futVer = futVer;
+ this.writeVer = writeVer;
+ this.syncMode = syncMode;
+ this.topVer = topVer;
+ this.subjId = subjId;
+ this.taskNameHash = taskNameHash;
+ this.addDepInfo = addDepInfo;
+
+ if (skipStore)
+ setFlag(true, SKIP_STORE_FLAG_MASK);
+ if (keepBinary)
+ setFlag(true, KEEP_BINARY_FLAG_MASK);
+ }
+
+ /**
+ * @param key Key to add.
+ * @param val Value, {@code null} if should be removed.
+ * @param entryProcessor Entry processor.
+ * @param ttl TTL (optional).
+ * @param conflictExpireTime Conflict expire time (optional).
+ * @param conflictVer Conflict version (optional).
+ * @param addPrevVal If {@code true} adds previous value.
+ * @param partId Partition.
+ * @param prevVal Previous value.
+ * @param updateCntr Update counter.
+ */
+ @Override public void addWriteValue(KeyCacheObject key,
+ @Nullable CacheObject val,
+ EntryProcessor<Object, Object, Object> entryProcessor,
+ long ttl,
+ long conflictExpireTime,
+ @Nullable GridCacheVersion conflictVer,
+ boolean addPrevVal,
+ int partId,
+ @Nullable CacheObject prevVal,
+ @Nullable Long updateCntr
+ ) {
+ assert entryProcessor == null;
+ assert ttl <= 0 : ttl;
+ assert conflictExpireTime <= 0 : conflictExpireTime;
+ assert conflictVer == null : conflictVer;
+
+ near(false);
+
+ this.key = key;
+ this.partId = partId;
+ this.val = val;
+
+ if (addPrevVal)
+ this.prevVal = prevVal;
+
+ if (updateCntr != null)
+ this.updateCntr = updateCntr;
+ }
+
+ /**
+ * @param key Key to add.
+ * @param val Value, {@code null} if should be removed.
+ * @param entryProcessor Entry processor.
+ * @param ttl TTL.
+ * @param expireTime Expire time.
+ */
+ @Override public void addNearWriteValue(KeyCacheObject key,
+ @Nullable CacheObject val,
+ EntryProcessor<Object, Object, Object> entryProcessor,
+ long ttl,
+ long expireTime) {
+ assert entryProcessor == null;
+ assert ttl <= 0 : ttl;
+
+ near(true);
+
+ this.key = key;
+ this.val = val;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean forceTransformBackups() {
+ return false;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int size() {
+ return key != null ? near() ? 0 : 1 : 0;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int nearSize() {
+ return key != null ? near() ? 1 : 0 : 0;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean hasKey(KeyCacheObject key) {
+ return !near() && F.eq(this.key, key);
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean skipStore() {
+ return isFlag(SKIP_STORE_FLAG_MASK);
+ }
+
+ /** {@inheritDoc} */
+ @Override public KeyCacheObject key(int idx) {
+ assert idx == 0 : idx;
+
+ return near() ? null : key;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int partitionId(int idx) {
+ assert idx == 0 : idx;
+
+ return partId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Long updateCounter(int updCntr) {
+ assert updCntr == 0 : updCntr;
+
+ return updateCntr;
+ }
+
+ /** {@inheritDoc} */
+ @Override public KeyCacheObject nearKey(int idx) {
+ assert idx == 0 : idx;
+
+ return near() ? key : null;
+ }
+
+ /** {@inheritDoc} */
+ @Override @Nullable public CacheObject value(int idx) {
+ assert idx == 0 : idx;
+
+ return near() ? null : val;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridCacheVersion futureVersion() {
+ return futVer;
+ }
+
+ /** {@inheritDoc} */
+ @Override public GridCacheVersion writeVersion() {
+ return writeVer;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int taskNameHash() {
+ return taskNameHash;
+ }
+
+ /** {@inheritDoc} */
+ @Override public UUID subjectId() {
+ return subjId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public CacheWriteSynchronizationMode writeSynchronizationMode() {
+ return syncMode;
+ }
+
+ /** {@inheritDoc} */
+ @Override @Nullable public CacheObject previousValue(int idx) {
+ assert idx == 0 : idx;
+
+ return prevVal;
+ }
+
+ /** {@inheritDoc} */
+ @Override @Nullable public CacheObject nearValue(int idx) {
+ assert idx == 0 : idx;
+
+ return near() ? val : null;
+ }
+
+ /** {@inheritDoc} */
+ @Override @Nullable public EntryProcessor<Object, Object, Object> entryProcessor(int idx) {
+ assert idx == 0 : idx;
+
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override @Nullable public EntryProcessor<Object, Object, Object> nearEntryProcessor(int idx) {
+ assert idx == 0 : idx;
+
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override @Nullable public GridCacheVersion conflictVersion(int idx) {
+ assert idx == 0 : idx;
+
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long ttl(int idx) {
+ assert idx == 0 : idx;
+
+ return CU.TTL_NOT_CHANGED;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long nearTtl(int idx) {
+ assert idx == 0 : idx;
+
+ return CU.TTL_NOT_CHANGED;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long conflictExpireTime(int idx) {
+ assert idx == 0 : idx;
+
+ return CU.EXPIRE_TIME_CALCULATE;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long nearExpireTime(int idx) {
+ assert idx == 0 : idx;
+
+ return CU.EXPIRE_TIME_CALCULATE;
+ }
+
+ /** {@inheritDoc} */
+ @Override @Nullable public Object[] invokeArguments() {
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean keepBinary() {
+ return isFlag(KEEP_BINARY_FLAG_MASK);
+ }
+
+ /**
+ *
+ */
+ private boolean near() {
+ return isFlag(NEAR_FLAG_MASK);
+ }
+
+ /**
+ *
+ */
+ private void near(boolean near) {
+ setFlag(near, NEAR_FLAG_MASK);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
+ super.prepareMarshal(ctx);
+
+ GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+ prepareMarshalObject(key, cctx);
+
+ prepareMarshalObject(val, cctx);
+
+ prepareMarshalObject(prevVal, cctx);
+
+ }
+
+ /** {@inheritDoc} */
+ @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
+ super.finishUnmarshal(ctx, ldr);
+
+ GridCacheContext cctx = ctx.cacheContext(cacheId);
+
+ finishUnmarshalObject(key, cctx, ldr);
+
+ finishUnmarshalObject(val, cctx, ldr);
+
+ finishUnmarshalObject(prevVal, cctx, ldr);
+
+ key.partition(partId);
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+ writer.setBuffer(buf);
+
+ if (!super.writeTo(buf, writer))
+ return false;
+
+ if (!writer.isHeaderWritten()) {
+ if (!writer.writeHeader(directType(), fieldsCount()))
+ return false;
+
+ writer.onHeaderWritten();
+ }
+
+ switch (writer.state()) {
+ case 3:
+ if (!writer.writeByte("flags", flags))
+ return false;
+
+ writer.incrementState();
+
+ case 4:
+ if (!writer.writeMessage("futVer", futVer))
+ return false;
+
+ writer.incrementState();
+
+ case 5:
+ if (!writer.writeMessage("key", key))
+ return false;
+
+ writer.incrementState();
+
+ case 6:
+ if (!writer.writeInt("partId", partId))
+ return false;
+
+ writer.incrementState();
+
+ case 7:
+ if (!writer.writeMessage("prevVal", prevVal))
+ return false;
+
+ writer.incrementState();
+
+ case 8:
+ if (!writer.writeUuid("subjId", subjId))
+ return false;
+
+ writer.incrementState();
+
+ case 9:
+ if (!writer.writeByte("syncMode", syncMode != null ? (byte)syncMode.ordinal() : -1))
+ return false;
+
+ writer.incrementState();
+
+ case 10:
+ if (!writer.writeInt("taskNameHash", taskNameHash))
+ return false;
+
+ writer.incrementState();
+
+ case 11:
+ if (!writer.writeMessage("topVer", topVer))
+ return false;
+
+ writer.incrementState();
+
+ case 12:
+ if (!writer.writeLong("updateCntr", updateCntr))
+ return false;
+
+ writer.incrementState();
+
+ case 13:
+ if (!writer.writeMessage("val", val))
+ return false;
+
+ writer.incrementState();
+
+ case 14:
+ if (!writer.writeMessage("writeVer", writeVer))
+ return false;
+
+ writer.incrementState();
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+ reader.setBuffer(buf);
+
+ if (!reader.beforeMessageRead())
+ return false;
+
+ if (!super.readFrom(buf, reader))
+ return false;
+
+ switch (reader.state()) {
+ case 3:
+ flags = reader.readByte("flags");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 4:
+ futVer = reader.readMessage("futVer");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 5:
+ key = reader.readMessage("key");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 6:
+ partId = reader.readInt("partId");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 7:
+ prevVal = reader.readMessage("prevVal");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 8:
+ subjId = reader.readUuid("subjId");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 9:
+ byte syncModeOrd;
+
+ syncModeOrd = reader.readByte("syncMode");
+
+ if (!reader.isLastRead())
+ return false;
+
+ syncMode = CacheWriteSynchronizationMode.fromOrdinal(syncModeOrd);
+
+ reader.incrementState();
+
+ case 10:
+ taskNameHash = reader.readInt("taskNameHash");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 11:
+ topVer = reader.readMessage("topVer");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 12:
+ updateCntr = reader.readLong("updateCntr");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 13:
+ val = reader.readMessage("val");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 14:
+ writeVer = reader.readMessage("writeVer");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ }
+
+ return reader.afterMessageRead(GridDhtAtomicSingleUpdateRequest.class);
+ }
+
+ /**
+ * @param obj CacheObject to marshal
+ * @param ctx context
+ * @throws IgniteCheckedException if error
+ */
+ private void prepareMarshalObject(CacheObject obj, GridCacheContext ctx) throws IgniteCheckedException {
+ if (obj != null)
+ obj.prepareMarshal(ctx.cacheObjectContext());
+ }
+
+ /**
+ * @param obj CacheObject un to marshal
+ * @param ctx context
+ * @param ldr class loader
+ * @throws IgniteCheckedException if error
+ */
+ private void finishUnmarshalObject(@Nullable CacheObject obj, GridCacheContext ctx,
+ ClassLoader ldr) throws IgniteCheckedException {
+ if (obj != null)
+ obj.finishUnmarshal(ctx.cacheObjectContext(), ldr);
+ }
+
+ /**
+ * Cleanup values not needed after message was sent.
+ */
+ @Override protected void cleanup() {
+ val = null;
+ prevVal = null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte directType() {
+ return -36;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte fieldsCount() {
+ return 15;
+ }
+
+ /**
+ * Sets flag mask.
+ *
+ * @param flag Set or clear.
+ * @param mask Mask.
+ */
+ private void setFlag(boolean flag, int mask) {
+ flags = flag ? (byte)(flags | mask) : (byte)(flags & ~mask);
+ }
+
+ /**
+ * Reags flag mask.
+ *
+ * @param mask Mask to read.
+ * @return Flag value.
+ */
+ private boolean isFlag(int mask) {
+ return (flags & mask) != 0;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridDhtAtomicSingleUpdateRequest.class, this, "super", super.toString());
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/51ca24f2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
index 864aadd..dd1f1c4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
@@ -23,7 +23,9 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedException;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
@@ -33,6 +35,7 @@ import org.apache.ignite.internal.util.typedef.CI2;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
+import org.jetbrains.annotations.NotNull;
/**
* DHT atomic cache backup update future.
@@ -118,6 +121,29 @@ class GridDhtAtomicUpdateFuture extends GridDhtAtomicAbstractUpdateFuture {
}
/** {@inheritDoc} */
+ @Override protected GridDhtAtomicAbstractUpdateRequest createRequest(ClusterNode node,
+ GridCacheVersion futVer,
+ GridCacheVersion writeVer,
+ CacheWriteSynchronizationMode syncMode,
+ @NotNull AffinityTopologyVersion topVer,
+ boolean forceTransformBackups) {
+ return new GridDhtAtomicUpdateRequest(
+ cctx.cacheId(),
+ node.id(),
+ futVer,
+ writeVer,
+ syncMode,
+ topVer,
+ forceTransformBackups,
+ updateReq.subjectId(),
+ updateReq.taskNameHash(),
+ forceTransformBackups ? updateReq.invokeArguments() : null,
+ cctx.deploymentEnabled(),
+ updateReq.keepBinary(),
+ updateReq.skipStore());
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
return S.toString(GridDhtAtomicUpdateFuture.class, this);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/51ca24f2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
index 55f7560..f2fbb0e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
@@ -20,25 +20,22 @@ package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
import java.io.Externalizable;
import java.nio.ByteBuffer;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.List;
import java.util.UUID;
import javax.cache.processor.EntryProcessor;
import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.internal.GridDirectCollection;
import org.apache.ignite.internal.GridDirectTransient;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.CacheObject;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
-import org.apache.ignite.internal.processors.cache.GridCacheMessage;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.util.GridLongList;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
@@ -52,17 +49,10 @@ import static org.apache.ignite.internal.processors.cache.GridCacheUtils.SKIP_ST
/**
* Lite dht cache backup update request.
*/
-public class GridDhtAtomicUpdateRequest extends GridCacheMessage implements GridCacheDeployable {
+public class GridDhtAtomicUpdateRequest extends GridDhtAtomicAbstractUpdateRequest {
/** */
private static final long serialVersionUID = 0L;
- /** Message index. */
- public static final int CACHE_MSG_IDX = nextIndexId();
-
- /** Node ID. */
- @GridDirectTransient
- private UUID nodeId;
-
/** Future version. */
private GridCacheVersion futVer;
@@ -151,10 +141,6 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage implements Grid
/** Partition. */
private GridLongList updateCntrs;
- /** On response flag. Access should be synced on future. */
- @GridDirectTransient
- private boolean onRes;
-
/** */
@GridDirectTransient
private List<Integer> partIds;
@@ -162,9 +148,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage implements Grid
/** Keep binary flag. */
private boolean keepBinary;
- /**
- * Additional flags.
- */
+ /** Additional flags. */
private byte flags;
/**
@@ -204,10 +188,8 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage implements Grid
boolean keepBinary,
boolean skipStore
) {
- assert invokeArgs == null || forceTransformBackups;
+ super(cacheId, nodeId);
- this.cacheId = cacheId;
- this.nodeId = nodeId;
this.futVer = futVer;
this.writeVer = writeVer;
this.syncMode = syncMode;
@@ -215,12 +197,14 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage implements Grid
this.forceTransformBackups = forceTransformBackups;
this.subjId = subjId;
this.taskNameHash = taskNameHash;
+
+ assert invokeArgs == null || forceTransformBackups;
+
this.invokeArgs = invokeArgs;
this.addDepInfo = addDepInfo;
this.keepBinary = keepBinary;
- if (skipStore)
- flags = (byte)(flags | SKIP_STORE_FLAG_MASK);
+ setFlag(skipStore, SKIP_STORE_FLAG_MASK);
keys = new ArrayList<>();
partIds = new ArrayList<>();
@@ -233,26 +217,8 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage implements Grid
vals = new ArrayList<>();
}
- /**
- * @return Force transform backups flag.
- */
- public boolean forceTransformBackups() {
- return forceTransformBackups;
- }
-
- /**
- * @param key Key to add.
- * @param val Value, {@code null} if should be removed.
- * @param entryProcessor Entry processor.
- * @param ttl TTL (optional).
- * @param conflictExpireTime Conflict expire time (optional).
- * @param conflictVer Conflict version (optional).
- * @param addPrevVal If {@code true} adds previous value.
- * @param partId Partition.
- * @param prevVal Previous value.
- * @param updateCntr Update counter.
- */
- public void addWriteValue(KeyCacheObject key,
+ /** {@inheritDoc} */
+ @Override public void addWriteValue(KeyCacheObject key,
@Nullable CacheObject val,
EntryProcessor<Object, Object, Object> entryProcessor,
long ttl,
@@ -328,14 +294,8 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage implements Grid
conflictExpireTimes.add(conflictExpireTime);
}
- /**
- * @param key Key to add.
- * @param val Value, {@code null} if should be removed.
- * @param entryProcessor Entry processor.
- * @param ttl TTL.
- * @param expireTime Expire time.
- */
- public void addNearWriteValue(KeyCacheObject key,
+ /** {@inheritDoc} */
+ @Override public void addNearWriteValue(KeyCacheObject key,
@Nullable CacheObject val,
EntryProcessor<Object, Object, Object> entryProcessor,
long ttl,
@@ -387,183 +347,114 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage implements Grid
}
/** {@inheritDoc} */
- @Override public int lookupIndex() {
- return CACHE_MSG_IDX;
- }
-
- /**
- * @return Node ID.
- */
- public UUID nodeId() {
- return nodeId;
+ @Override public boolean forceTransformBackups() {
+ return forceTransformBackups;
}
- /**
- * @return Subject ID.
- */
- public UUID subjectId() {
+ /** {@inheritDoc} */
+ @Override public UUID subjectId() {
return subjId;
}
- /**
- * @return Task name.
- */
- public int taskNameHash() {
+ /** {@inheritDoc} */
+ @Override public int taskNameHash() {
return taskNameHash;
}
- /**
- * @return Keys size.
- */
- public int size() {
- return keys.size();
- }
-
- /**
- * @return Keys size.
- */
- public int nearSize() {
- return nearKeys != null ? nearKeys.size() : 0;
- }
-
- /**
- * @return Version assigned on primary node.
- */
- public GridCacheVersion futureVersion() {
+ /** {@inheritDoc} */
+ @Override public GridCacheVersion futureVersion() {
return futVer;
}
- /**
- * @return Write version.
- */
- public GridCacheVersion writeVersion() {
+ /** {@inheritDoc} */
+ @Override public GridCacheVersion writeVersion() {
return writeVer;
}
- /**
- * @return Cache write synchronization mode.
- */
- public CacheWriteSynchronizationMode writeSynchronizationMode() {
+ /** {@inheritDoc} */
+ @Override public CacheWriteSynchronizationMode writeSynchronizationMode() {
return syncMode;
}
- /**
- * @return Topology version.
- */
+ /** {@inheritDoc} */
@Override public AffinityTopologyVersion topologyVersion() {
return topVer;
}
- /**
- * @return Keys.
- */
- public Collection<KeyCacheObject> keys() {
- return keys;
+ /** {@inheritDoc} */
+ @Override public int size() {
+ return keys.size();
}
- /**
- * @param idx Key index.
- * @return Key.
- */
- public KeyCacheObject key(int idx) {
- return keys.get(idx);
+ /** {@inheritDoc} */
+ @Override public int nearSize() {
+ return nearKeys != null ? nearKeys.size() : 0;
}
- /**
- * @param idx Partition index.
- * @return Partition id.
- */
- public int partitionId(int idx) {
- return partIds.get(idx);
+ /** {@inheritDoc} */
+ @Override public boolean hasKey(KeyCacheObject key) {
+ return F.contains(keys, key);
}
- /**
- * @return Skip write-through to a persistent storage.
- */
- public boolean skipStore() {
- return (flags & SKIP_STORE_FLAG_MASK) == SKIP_STORE_FLAG_MASK;
+ /** {@inheritDoc} */
+ @Override public KeyCacheObject key(int idx) {
+ return keys.get(idx);
}
- /**
- * @param updCntr Update counter.
- * @return Update counter.
- */
- public Long updateCounter(int updCntr) {
+ /** {@inheritDoc} */
+ @Override public int partitionId(int idx) {
+ return partIds.get(idx);
+ }
+
+ /** {@inheritDoc} */
+ @Override public Long updateCounter(int updCntr) {
if (updateCntrs != null && updCntr < updateCntrs.size())
return updateCntrs.get(updCntr);
return null;
}
- /**
- * @param idx Near key index.
- * @return Key.
- */
- public KeyCacheObject nearKey(int idx) {
+ /** {@inheritDoc} */
+ @Override public KeyCacheObject nearKey(int idx) {
return nearKeys.get(idx);
}
- /**
- * @return Keep binary flag.
- */
- public boolean keepBinary() {
- return keepBinary;
- }
-
- /**
- * @param idx Key index.
- * @return Value.
- */
- @Nullable public CacheObject value(int idx) {
+ /** {@inheritDoc} */
+ @Override @Nullable public CacheObject value(int idx) {
if (vals != null)
return vals.get(idx);
return null;
}
- /**
- * @param idx Key index.
- * @return Value.
- */
- @Nullable public CacheObject previousValue(int idx) {
+ /** {@inheritDoc} */
+ @Override @Nullable public CacheObject previousValue(int idx) {
if (prevVals != null)
return prevVals.get(idx);
return null;
}
- /**
- * @param idx Key index.
- * @return Entry processor.
- */
- @Nullable public EntryProcessor<Object, Object, Object> entryProcessor(int idx) {
+ /** {@inheritDoc} */
+ @Override @Nullable public EntryProcessor<Object, Object, Object> entryProcessor(int idx) {
return entryProcessors == null ? null : entryProcessors.get(idx);
}
- /**
- * @param idx Near key index.
- * @return Value.
- */
- @Nullable public CacheObject nearValue(int idx) {
+ /** {@inheritDoc} */
+ @Override @Nullable public CacheObject nearValue(int idx) {
if (nearVals != null)
return nearVals.get(idx);
return null;
}
- /**
- * @param idx Key index.
- * @return Transform closure.
- */
- @Nullable public EntryProcessor<Object, Object, Object> nearEntryProcessor(int idx) {
+ /** {@inheritDoc} */
+ @Override @Nullable public EntryProcessor<Object, Object, Object> nearEntryProcessor(int idx) {
return nearEntryProcessors == null ? null : nearEntryProcessors.get(idx);
}
- /**
- * @param idx Index.
- * @return Conflict version.
- */
- @Nullable public GridCacheVersion conflictVersion(int idx) {
+ /** {@inheritDoc} */
+ @Override @Nullable public GridCacheVersion conflictVersion(int idx) {
if (conflictVers != null) {
assert idx >= 0 && idx < conflictVers.size();
@@ -573,11 +464,8 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage implements Grid
return null;
}
- /**
- * @param idx Index.
- * @return TTL.
- */
- public long ttl(int idx) {
+ /** {@inheritDoc} */
+ @Override public long ttl(int idx) {
if (ttls != null) {
assert idx >= 0 && idx < ttls.size();
@@ -587,11 +475,8 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage implements Grid
return CU.TTL_NOT_CHANGED;
}
- /**
- * @param idx Index.
- * @return TTL for near cache update.
- */
- public long nearTtl(int idx) {
+ /** {@inheritDoc} */
+ @Override public long nearTtl(int idx) {
if (nearTtls != null) {
assert idx >= 0 && idx < nearTtls.size();
@@ -601,11 +486,8 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage implements Grid
return CU.TTL_NOT_CHANGED;
}
- /**
- * @param idx Index.
- * @return Conflict expire time.
- */
- public long conflictExpireTime(int idx) {
+ /** {@inheritDoc} */
+ @Override public long conflictExpireTime(int idx) {
if (conflictExpireTimes != null) {
assert idx >= 0 && idx < conflictExpireTimes.size();
@@ -615,11 +497,8 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage implements Grid
return CU.EXPIRE_TIME_CALCULATE;
}
- /**
- * @param idx Index.
- * @return Expire time for near cache update.
- */
- public long nearExpireTime(int idx) {
+ /** {@inheritDoc} */
+ @Override public long nearExpireTime(int idx) {
if (nearExpireTimes != null) {
assert idx >= 0 && idx < nearExpireTimes.size();
@@ -629,17 +508,18 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage implements Grid
return CU.EXPIRE_TIME_CALCULATE;
}
- /**
- * @return {@code True} if on response flag changed.
- */
- public boolean onResponse() {
- return !onRes && (onRes = true);
+ /** {@inheritDoc} */
+ @Override public boolean keepBinary() {
+ return keepBinary;
}
- /**
- * @return Optional arguments for entry processor.
- */
- @Nullable public Object[] invokeArguments() {
+ /** {@inheritDoc} */
+ @Override public boolean skipStore() {
+ return isFlag(SKIP_STORE_FLAG_MASK);
+ }
+
+ /** {@inheritDoc} */
+ @Override @Nullable public Object[] invokeArguments() {
return invokeArgs;
}
@@ -711,16 +591,6 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage implements Grid
}
/** {@inheritDoc} */
- @Override public boolean addDeploymentInfo() {
- return addDepInfo;
- }
-
- /** {@inheritDoc} */
- @Override public IgniteLogger messageLogger(GridCacheSharedContext ctx) {
- return ctx.atomicMessageLogger();
- }
-
- /** {@inheritDoc} */
@Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
writer.setBuffer(buf);
@@ -1083,14 +953,7 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage implements Grid
}
/** {@inheritDoc} */
- @Override public void onAckReceived() {
- cleanup();
- }
-
- /**
- * Cleanup values not needed after message was sent.
- */
- private void cleanup() {
+ @Override protected void cleanup() {
nearVals = null;
prevVals = null;
}
@@ -1105,6 +968,27 @@ public class GridDhtAtomicUpdateRequest extends GridCacheMessage implements Grid
return 26;
}
+ /**
+ * Sets flag mask.
+ *
+ * @param flag Set or clear.
+ * @param mask Mask.
+ */
+ private void setFlag(boolean flag, int mask) {
+ flags = flag ? (byte)(flags | mask) : (byte)(flags & ~mask);
+ }
+
+ /**
+ * Reags flag mask.
+ *
+ * @param mask Mask to read.
+ * @return Flag value.
+ */
+ private boolean isFlag(int mask) {
+ return (flags & mask) != 0;
+ }
+
+
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(GridDhtAtomicUpdateRequest.class, this, "super", super.toString());
http://git-wip-us.apache.org/repos/asf/ignite/blob/51ca24f2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java
index bee2ecd..bae9e3a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java
@@ -223,4 +223,9 @@ public abstract class GridNearAtomicAbstractUpdateRequest extends GridCacheMessa
* @return Key.
*/
public abstract KeyCacheObject key(int idx);
+
+ /**
+ * @return {@code True} if request does not have conflict data.
+ */
+ public abstract boolean hasConflictData();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/51ca24f2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
index b733d7b..c785828 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
@@ -41,6 +41,7 @@ import org.apache.ignite.internal.processors.cache.distributed.IgniteExternaliza
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.util.GridLongList;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -68,24 +69,49 @@ public class GridNearAtomicFullUpdateRequest extends GridNearAtomicAbstractUpdat
/** Future version. */
private GridCacheVersion futVer;
- /** Fast map flag. */
- private boolean fastMap;
-
/** Update version. Set to non-null if fastMap is {@code true}. */
private GridCacheVersion updateVer;
/** Topology version. */
private AffinityTopologyVersion topVer;
- /** Topology locked flag. Set if atomic update is performed inside TX or explicit lock. */
- private boolean topLocked;
-
/** Write synchronization mode. */
private CacheWriteSynchronizationMode syncMode;
/** Update operation. */
private GridCacheOperation op;
+ /** Subject ID. */
+ protected UUID subjId;
+
+ /** Task name hash. */
+ protected int taskNameHash;
+
+ /** */
+ @GridDirectTransient
+ private GridNearAtomicUpdateResponse res;
+
+ /** Fast map flag. */
+ protected boolean fastMap;
+
+ /** Topology locked flag. Set if atomic update is performed inside TX or explicit lock. */
+ protected boolean topLocked;
+
+ /** Flag indicating whether request contains primary keys. */
+ protected boolean hasPrimary;
+
+ /** Skip write-through to a persistent storage. */
+ protected boolean skipStore;
+
+ /** */
+ protected boolean clientReq;
+
+ /** Keep binary flag. */
+ protected boolean keepBinary;
+
+ /** Return value flag. */
+ protected boolean retval;
+
/** Keys to update. */
@GridToStringInclude
@GridDirectCollection(KeyCacheObject.class)
@@ -107,13 +133,6 @@ public class GridNearAtomicFullUpdateRequest extends GridNearAtomicAbstractUpdat
@GridDirectCollection(byte[].class)
private List<byte[]> entryProcessorsBytes;
- /** Optional arguments for entry processor. */
- @GridDirectTransient
- private Object[] invokeArgs;
-
- /** Entry processor arguments bytes. */
- private byte[][] invokeArgsBytes;
-
/** Conflict versions. */
@GridDirectCollection(GridCacheVersion.class)
private List<GridCacheVersion> conflictVers;
@@ -124,8 +143,12 @@ public class GridNearAtomicFullUpdateRequest extends GridNearAtomicAbstractUpdat
/** Conflict expire times. */
private GridLongList conflictExpireTimes;
- /** Return value flag. */
- private boolean retval;
+ /** Optional arguments for entry processor. */
+ @GridDirectTransient
+ private Object[] invokeArgs;
+
+ /** Entry processor arguments bytes. */
+ private byte[][] invokeArgsBytes;
/** Expiry policy. */
@GridDirectTransient
@@ -137,28 +160,6 @@ public class GridNearAtomicFullUpdateRequest extends GridNearAtomicAbstractUpdat
/** Filter. */
private CacheEntryPredicate[] filter;
- /** Flag indicating whether request contains primary keys. */
- private boolean hasPrimary;
-
- /** Subject ID. */
- private UUID subjId;
-
- /** Task name hash. */
- private int taskNameHash;
-
- /** Skip write-through to a persistent storage. */
- private boolean skipStore;
-
- /** */
- private boolean clientReq;
-
- /** Keep binary flag. */
- private boolean keepBinary;
-
- /** */
- @GridDirectTransient
- private GridNearAtomicUpdateResponse res;
-
/** Maximum possible size of inner collections. */
@GridDirectTransient
private int initSize;
@@ -523,7 +524,7 @@ public class GridNearAtomicFullUpdateRequest extends GridNearAtomicAbstractUpdat
}
/** {@inheritDoc} */
- @Nullable @Override public CacheEntryPredicate[] filter() {
+ @Override @Nullable public CacheEntryPredicate[] filter() {
return filter;
}
@@ -533,11 +534,19 @@ public class GridNearAtomicFullUpdateRequest extends GridNearAtomicAbstractUpdat
}
/** {@inheritDoc} */
+ @Override public boolean hasConflictData() {
+ return F.size(conflictVers) > 0 || conflictTtls != null || conflictExpireTimes != null;
+ }
+
+ /** {@inheritDoc} */
@Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
super.prepareMarshal(ctx);
GridCacheContext cctx = ctx.cacheContext(cacheId);
+ if (expiryPlc != null && expiryPlcBytes == null)
+ expiryPlcBytes = CU.marshal(cctx, new IgniteExternalizableExpiryPolicy(expiryPlc));
+
prepareMarshalCacheObjects(keys, cctx);
if (filter != null) {
@@ -555,9 +564,6 @@ public class GridNearAtomicFullUpdateRequest extends GridNearAtomicAbstractUpdat
filter = null;
}
- if (expiryPlc != null && expiryPlcBytes == null)
- expiryPlcBytes = CU.marshal(cctx, new IgniteExternalizableExpiryPolicy(expiryPlc));
-
if (op == TRANSFORM) {
// force addition of deployment info for entry processors if P2P is enabled globally.
if (!addDepInfo && ctx.deploymentEnabled())
@@ -579,8 +585,18 @@ public class GridNearAtomicFullUpdateRequest extends GridNearAtomicAbstractUpdat
GridCacheContext cctx = ctx.cacheContext(cacheId);
+ if (expiryPlcBytes != null && expiryPlc == null)
+ expiryPlc = U.unmarshal(ctx, expiryPlcBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
+
finishUnmarshalCacheObjects(keys, cctx, ldr);
+ if (filter != null) {
+ for (CacheEntryPredicate p : filter) {
+ if (p != null)
+ p.finishUnmarshal(cctx, ldr);
+ }
+ }
+
if (op == TRANSFORM) {
if (entryProcessors == null)
entryProcessors = unmarshalCollection(entryProcessorsBytes, ctx, ldr);
@@ -591,16 +607,6 @@ public class GridNearAtomicFullUpdateRequest extends GridNearAtomicAbstractUpdat
else
finishUnmarshalCacheObjects(vals, cctx, ldr);
- if (filter != null) {
- for (CacheEntryPredicate p : filter) {
- if (p != null)
- p.finishUnmarshal(cctx, ldr);
- }
- }
-
- if (expiryPlcBytes != null && expiryPlc == null)
- expiryPlc = U.unmarshal(ctx, expiryPlcBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
-
if (partIds != null && !partIds.isEmpty()) {
assert partIds.size() == keys.size();
http://git-wip-us.apache.org/repos/asf/ignite/blob/51ca24f2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java
index 211b472..f3b9726 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java
@@ -226,6 +226,11 @@ public class GridNearAtomicSingleUpdateRequest extends GridNearAtomicAbstractSin
return CU.EXPIRE_TIME_CALCULATE;
}
+ /** {@inheritDoc} */
+ @Override public boolean hasConflictData() {
+ return false;
+ }
+
/**
* {@inheritDoc}
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/51ca24f2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
index b5b2c72..a8219b0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
@@ -41,8 +41,8 @@ import org.apache.ignite.internal.processors.cache.GridCacheUpdateAtomicResult;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtInvalidPartitionException;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicAbstractUpdateRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponse;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicAbstractUpdateRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse;
@@ -302,15 +302,13 @@ public class GridNearAtomicCache<K, V> extends GridNearCacheAdapter<K, V> {
*/
public void processDhtAtomicUpdateRequest(
UUID nodeId,
- GridDhtAtomicUpdateRequest req,
+ GridDhtAtomicAbstractUpdateRequest req,
GridDhtAtomicUpdateResponse res
) {
GridCacheVersion ver = req.writeVersion();
assert ver != null;
- Collection<KeyCacheObject> backupKeys = req.keys();
-
boolean intercept = req.forceTransformBackups() && ctx.config().getInterceptor() != null;
String taskName = ctx.kernalContext().task().resolveTaskName(req.taskNameHash());
@@ -329,7 +327,7 @@ public class GridNearAtomicCache<K, V> extends GridNearCacheAdapter<K, V> {
break;
}
- if (F.contains(backupKeys, key)) { // Reader became backup.
+ if (req.hasKey(key)) { // Reader became backup.
if (entry.markObsolete(ver))
removeEntry(entry);
http://git-wip-us.apache.org/repos/asf/ignite/blob/51ca24f2/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
index a6d612a..e8c5db1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
@@ -27,6 +27,7 @@ import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.managers.communication.GridIoMessage;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicSingleUpdateRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicFullUpdateRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
@@ -141,6 +142,7 @@ public class GridCacheAtomicMessageCountSelfTest extends GridCommonAbstractTest
commSpi.registerMessage(GridNearAtomicSingleUpdateRequest.class);
commSpi.registerMessage(GridNearAtomicFullUpdateRequest.class);
commSpi.registerMessage(GridDhtAtomicUpdateRequest.class);
+ commSpi.registerMessage(GridDhtAtomicSingleUpdateRequest.class);
int putCnt = 15;
@@ -171,7 +173,7 @@ public class GridCacheAtomicMessageCountSelfTest extends GridCommonAbstractTest
assertEquals(expNearCnt, commSpi.messageCount(GridNearAtomicFullUpdateRequest.class));
assertEquals(expNearSingleCnt, commSpi.messageCount(GridNearAtomicSingleUpdateRequest.class));
- assertEquals(expDhtCnt, commSpi.messageCount(GridDhtAtomicUpdateRequest.class));
+ assertEquals(expDhtCnt, commSpi.messageCount(GridDhtAtomicSingleUpdateRequest.class));
if (writeOrderMode == CLOCK) {
for (int i = 1; i < 4; i++) {
@@ -179,7 +181,7 @@ public class GridCacheAtomicMessageCountSelfTest extends GridCommonAbstractTest
assertEquals(0, commSpi.messageCount(GridNearAtomicSingleUpdateRequest.class));
assertEquals(0, commSpi.messageCount(GridNearAtomicFullUpdateRequest.class));
- assertEquals(0, commSpi.messageCount(GridDhtAtomicUpdateRequest.class));
+ assertEquals(0, commSpi.messageCount(GridDhtAtomicSingleUpdateRequest.class));
}
}
else {
http://git-wip-us.apache.org/repos/asf/ignite/blob/51ca24f2/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
index 0899423..644e310 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
@@ -478,7 +478,7 @@ public class GridCacheAtomicInvalidPartitionHandlingSelfTest extends GridCommonA
Object origMsg = msg.message();
return delay &&
- ((origMsg instanceof GridNearAtomicAbstractUpdateRequest) || (origMsg instanceof GridDhtAtomicUpdateRequest));
+ ((origMsg instanceof GridNearAtomicAbstractUpdateRequest) || (origMsg instanceof GridDhtAtomicAbstractUpdateRequest));
}
}
}
\ No newline at end of file
[23/50] [abbrv] ignite git commit: ignite-4154 Optimize amount of
data stored in discovery history Discovery history optimizations: - remove
discarded message for discovery pending messages - remove duplicated data
from TcpDiscoveryNodeAddedMessage.oldNo
Posted by sb...@apache.org.
ignite-4154 Optimize amount of data stored in discovery history
Discovery history optimizations:
- remove discarded message for discovery pending messages
- remove duplicated data from TcpDiscoveryNodeAddedMessage.oldNodesDiscoData
- do not store unnecessary data in discovery EnsuredMessageHistory
- use special property for EnsuredMessageHistory size instead of IGNITE_DISCOVERY_HISTORY_SIZE
Affinity history optimizations:
- do not store calculated primary/backup maps in history
- try save the same assignments instance for caches with similar affinity
Exchange messages optimizations:
- do not send duplicated partition state maps for caches with similar affinity
- use zip compression for data sent in exchange messages
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7128a395
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7128a395
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7128a395
Branch: refs/heads/master
Commit: 7128a395085b60e86436f807b4bdbca83627d41a
Parents: 8bb8bdd
Author: sboikov <sb...@gridgain.com>
Authored: Fri Nov 11 15:29:38 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Nov 11 15:29:38 2016 +0300
----------------------------------------------------------------------
.../apache/ignite/IgniteSystemProperties.java | 4 +
.../processors/affinity/AffinityAssignment.java | 88 +++++
.../affinity/GridAffinityAssignment.java | 8 +-
.../affinity/GridAffinityAssignmentCache.java | 35 +-
.../affinity/GridAffinityProcessor.java | 89 ++++-
.../processors/affinity/GridAffinityUtils.java | 8 +-
.../affinity/HistoryAffinityAssignment.java | 169 ++++++++
.../cache/CacheAffinitySharedManager.java | 57 ++-
.../cache/DynamicCacheChangeBatch.java | 7 +
.../cache/GridCacheAffinityManager.java | 6 +-
.../GridCachePartitionExchangeManager.java | 284 ++++++++++++--
.../processors/cache/GridCacheProcessor.java | 5 +-
.../dht/GridClientPartitionTopology.java | 33 +-
.../dht/GridDhtPartitionTopology.java | 3 +-
.../dht/GridDhtPartitionTopologyImpl.java | 31 +-
.../dht/preloader/GridDhtPartitionFullMap.java | 18 +
.../dht/preloader/GridDhtPartitionMap2.java | 53 ++-
.../GridDhtPartitionsAbstractMessage.java | 40 +-
.../GridDhtPartitionsExchangeFuture.java | 84 +---
.../preloader/GridDhtPartitionsFullMessage.java | 150 ++++++-
.../GridDhtPartitionsSingleMessage.java | 132 ++++++-
.../GridDhtPartitionsSingleRequest.java | 4 +-
.../dht/preloader/GridDhtPreloader.java | 4 +-
.../continuous/GridContinuousProcessor.java | 4 +-
.../ignite/internal/util/IgniteUtils.java | 64 +++
.../ignite/spi/discovery/tcp/ClientImpl.java | 26 +-
.../ignite/spi/discovery/tcp/ServerImpl.java | 234 +++++++++--
.../TcpDiscoveryNodeAddFinishedMessage.java | 11 +
.../messages/TcpDiscoveryNodeAddedMessage.java | 33 +-
...CacheExchangeMessageDuplicatedStateTest.java | 393 +++++++++++++++++++
.../cache/IgniteCachePeekModesAbstractTest.java | 2 +-
.../distributed/IgniteCacheGetRestartTest.java | 3 +
...cingDelayedPartitionMapExchangeSelfTest.java | 8 +-
.../GridCacheRebalancingSyncSelfTest.java | 18 +-
.../GridCacheSyncReplicatedPreloadSelfTest.java | 3 -
.../IgniteCacheSyncRebalanceModeSelfTest.java | 4 +-
...ContinuousQueryFailoverAbstractSelfTest.java | 2 +-
.../IgniteNoCustomEventsOnNodeStart.java | 7 +
.../spi/discovery/tcp/TcpDiscoverySelfTest.java | 134 ++++++-
.../junits/common/GridCommonAbstractTest.java | 25 +-
.../testsuites/IgniteCacheTestSuite2.java | 3 +
.../cache/IgniteCacheOffheapEvictQueryTest.java | 7 +
...lientQueryReplicatedNodeRestartSelfTest.java | 7 +
...butedQueryStopOnCancelOrTimeoutSelfTest.java | 7 +
.../query/h2/sql/GridQueryParsingTest.java | 11 +-
.../src/test/config/incorrect-store-cache.xml | 2 +
.../src/test/config/jdbc-pojo-store-builtin.xml | 3 +
.../src/test/config/jdbc-pojo-store-obj.xml | 3 +
modules/spring/src/test/config/node.xml | 2 +
modules/spring/src/test/config/node1.xml | 2 +
.../test/config/pojo-incorrect-store-cache.xml | 2 +
modules/spring/src/test/config/store-cache.xml | 2 +
modules/spring/src/test/config/store-cache1.xml | 2 +
53 files changed, 2061 insertions(+), 275 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
index ab6403f..a75027b 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
@@ -383,6 +383,10 @@ public final class IgniteSystemProperties {
/** Maximum size for discovery messages history. */
public static final String IGNITE_DISCOVERY_HISTORY_SIZE = "IGNITE_DISCOVERY_HISTORY_SIZE";
+ /** Maximum number of discovery message history used to support client reconnect. */
+ public static final String IGNITE_DISCOVERY_CLIENT_RECONNECT_HISTORY_SIZE =
+ "IGNITE_DISCOVERY_CLIENT_RECONNECT_HISTORY_SIZE";
+
/** Number of cache operation retries in case of topology exceptions. */
public static final String IGNITE_CACHE_RETRIES_COUNT = "IGNITE_CACHE_RETRIES_COUNT";
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/AffinityAssignment.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/AffinityAssignment.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/AffinityAssignment.java
new file mode 100644
index 0000000..06207d3
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/AffinityAssignment.java
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.affinity;
+
+import org.apache.ignite.cluster.ClusterNode;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
+
+/**
+ * Cached affinity calculations.
+ */
+public interface AffinityAssignment {
+ /**
+ * @return {@code True} if related discovery event did not not cause affinity assignment change and
+ * this assignment is just reference to the previous one.
+ */
+ public boolean clientEventChange();
+
+ /**
+ * @return Affinity assignment computed by affinity function.
+ */
+ public List<List<ClusterNode>> idealAssignment();
+
+ /**
+ * @return Affinity assignment.
+ */
+ public List<List<ClusterNode>> assignment();
+
+ /**
+ * @return Topology version.
+ */
+ public AffinityTopologyVersion topologyVersion();
+
+ /**
+ * Get affinity nodes for partition.
+ *
+ * @param part Partition.
+ * @return Affinity nodes.
+ */
+ public List<ClusterNode> get(int part);
+
+ /**
+ * Get affinity node IDs for partition.
+ *
+ * @param part Partition.
+ * @return Affinity nodes IDs.
+ */
+ public HashSet<UUID> getIds(int part);
+
+ /**
+ * @return Nodes having primary partitions assignments.
+ */
+ public Set<ClusterNode> primaryPartitionNodes();
+
+ /**
+ * Get primary partitions for specified node ID.
+ *
+ * @param nodeId Node ID to get primary partitions for.
+ * @return Primary partitions for specified node ID.
+ */
+ public Set<Integer> primaryPartitions(UUID nodeId);
+
+ /**
+ * Get backup partitions for specified node ID.
+ *
+ * @param nodeId Node ID to get backup partitions for.
+ * @return Backup partitions for specified node ID.
+ */
+ public Set<Integer> backupPartitions(UUID nodeId);
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignment.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignment.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignment.java
index 568e4e8..35130a3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignment.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignment.java
@@ -32,7 +32,7 @@ import org.apache.ignite.internal.util.typedef.internal.S;
/**
* Cached affinity calculations.
*/
-public class GridAffinityAssignment implements Serializable {
+public class GridAffinityAssignment implements AffinityAssignment, Serializable {
/** */
private static final long serialVersionUID = 0L;
@@ -86,7 +86,7 @@ public class GridAffinityAssignment implements Serializable {
this.topVer = topVer;
this.assignment = assignment;
- this.idealAssignment = idealAssignment;
+ this.idealAssignment = idealAssignment.equals(assignment) ? assignment : idealAssignment;
primary = new HashMap<>();
backup = new HashMap<>();
@@ -274,10 +274,10 @@ public class GridAffinityAssignment implements Serializable {
if (o == this)
return true;
- if (o == null || getClass() != o.getClass())
+ if (o == null || !(o instanceof AffinityAssignment))
return false;
- return topVer.equals(((GridAffinityAssignment)o).topVer);
+ return topVer.equals(((AffinityAssignment)o).topologyVersion());
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java
index a81b34d..a388c7a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java
@@ -78,7 +78,7 @@ public class GridAffinityAssignmentCache {
private final int partsCnt;
/** Affinity calculation results cache: topology version => partition => nodes. */
- private final ConcurrentNavigableMap<AffinityTopologyVersion, GridAffinityAssignment> affCache;
+ private final ConcurrentNavigableMap<AffinityTopologyVersion, HistoryAffinityAssignment> affCache;
/** */
private List<List<ClusterNode>> idealAssignment;
@@ -107,6 +107,9 @@ public class GridAffinityAssignmentCache {
/** Full history size. */
private final AtomicInteger fullHistSize = new AtomicInteger();
+ /** */
+ private final Object similarAffKey;
+
/**
* Constructs affinity cached calculations.
*
@@ -127,6 +130,7 @@ public class GridAffinityAssignmentCache {
{
assert ctx != null;
assert aff != null;
+ assert nodeFilter != null;
this.ctx = ctx;
this.aff = aff;
@@ -142,6 +146,17 @@ public class GridAffinityAssignmentCache {
partsCnt = aff.partitions();
affCache = new ConcurrentSkipListMap<>();
head = new AtomicReference<>(new GridAffinityAssignment(AffinityTopologyVersion.NONE));
+
+ similarAffKey = ctx.affinity().similaryAffinityKey(aff, nodeFilter, backups, partsCnt);
+
+ assert similarAffKey != null;
+ }
+
+ /**
+ * @return Key to find caches with similar affinity.
+ */
+ public Object similarAffinityKey() {
+ return similarAffKey;
}
/**
@@ -170,7 +185,7 @@ public class GridAffinityAssignmentCache {
GridAffinityAssignment assignment = new GridAffinityAssignment(topVer, affAssignment, idealAssignment);
- affCache.put(topVer, assignment);
+ affCache.put(topVer, new HistoryAffinityAssignment(assignment));
head.set(assignment);
for (Map.Entry<AffinityTopologyVersion, AffinityReadyFuture> entry : readyFuts.entrySet()) {
@@ -300,7 +315,7 @@ public class GridAffinityAssignmentCache {
GridAffinityAssignment assignmentCpy = new GridAffinityAssignment(topVer, aff);
- affCache.put(topVer, assignmentCpy);
+ affCache.put(topVer, new HistoryAffinityAssignment(assignmentCpy));
head.set(assignmentCpy);
for (Map.Entry<AffinityTopologyVersion, AffinityReadyFuture> entry : readyFuts.entrySet()) {
@@ -328,7 +343,7 @@ public class GridAffinityAssignmentCache {
* @return Affinity assignment.
*/
public List<List<ClusterNode>> assignments(AffinityTopologyVersion topVer) {
- GridAffinityAssignment aff = cachedAffinity(topVer);
+ AffinityAssignment aff = cachedAffinity(topVer);
return aff.assignment();
}
@@ -427,7 +442,7 @@ public class GridAffinityAssignmentCache {
* @param topVer Topology version.
* @return Cached affinity.
*/
- public GridAffinityAssignment cachedAffinity(AffinityTopologyVersion topVer) {
+ public AffinityAssignment cachedAffinity(AffinityTopologyVersion topVer) {
if (topVer.equals(AffinityTopologyVersion.NONE))
topVer = lastVersion();
else
@@ -435,7 +450,7 @@ public class GridAffinityAssignmentCache {
assert topVer.topologyVersion() >= 0 : topVer;
- GridAffinityAssignment cache = head.get();
+ AffinityAssignment cache = head.get();
if (!cache.topologyVersion().equals(topVer)) {
cache = affCache.get(topVer);
@@ -463,7 +478,7 @@ public class GridAffinityAssignmentCache {
* @return {@code True} if primary changed or required affinity version not found in history.
*/
public boolean primaryChanged(int part, AffinityTopologyVersion startVer, AffinityTopologyVersion endVer) {
- GridAffinityAssignment aff = affCache.get(startVer);
+ AffinityAssignment aff = affCache.get(startVer);
if (aff == null)
return false;
@@ -475,7 +490,7 @@ public class GridAffinityAssignmentCache {
ClusterNode primary = nodes.get(0);
- for (GridAffinityAssignment assignment : affCache.tailMap(startVer, false).values()) {
+ for (AffinityAssignment assignment : affCache.tailMap(startVer, false).values()) {
List<ClusterNode> nodes0 = assignment.assignment().get(part);
if (nodes0.isEmpty())
@@ -549,10 +564,10 @@ public class GridAffinityAssignmentCache {
}
if (rmvCnt > 0) {
- Iterator<GridAffinityAssignment> it = affCache.values().iterator();
+ Iterator<HistoryAffinityAssignment> it = affCache.values().iterator();
while (it.hasNext() && rmvCnt > 0) {
- GridAffinityAssignment aff0 = it.next();
+ AffinityAssignment aff0 = it.next();
it.remove();
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessor.java
index 1726d02..b9182ae 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessor.java
@@ -58,6 +58,7 @@ import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.A;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.lang.IgniteUuid;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -385,10 +386,16 @@ public class GridAffinityProcessor extends GridProcessorAdapter {
}
try {
+ AffinityAssignment assign0 = cctx.affinity().assignment(topVer);
+
+ GridAffinityAssignment assign = assign0 instanceof GridAffinityAssignment ?
+ (GridAffinityAssignment)assign0 :
+ new GridAffinityAssignment(topVer, assign0.assignment(), assign0.idealAssignment());
+
AffinityInfo info = new AffinityInfo(
cctx.config().getAffinity(),
cctx.config().getAffinityMapper(),
- new GridAffinityAssignment(topVer, cctx.affinity().assignment(topVer)),
+ assign,
cctx.cacheObjectContext());
IgniteInternalFuture<AffinityInfo> old = affMap.putIfAbsent(key, new GridFinishedFuture<>(info));
@@ -562,6 +569,20 @@ public class GridAffinityProcessor extends GridProcessorAdapter {
return nodes.iterator().next();
}
+ /**
+ * @param aff Affinity function.
+ * @param nodeFilter Node class.
+ * @param backups Number of backups.
+ * @param parts Number of partitions.
+ * @return Key to find caches with similar affinity.
+ */
+ public Object similaryAffinityKey(AffinityFunction aff,
+ IgnitePredicate<ClusterNode> nodeFilter,
+ int backups,
+ int parts) {
+ return new SimilarAffinityKey(aff.getClass(), nodeFilter.getClass(), backups, parts);
+ }
+
/** {@inheritDoc} */
@Override public void printMemoryStats() {
X.println(">>>");
@@ -960,4 +981,70 @@ public class GridAffinityProcessor extends GridProcessorAdapter {
return aff;
}
}
+
+ /**
+ *
+ */
+ private static class SimilarAffinityKey {
+ /** */
+ private final int backups;
+
+ /** */
+ private final Class<?> affFuncCls;
+
+ /** */
+ private final Class<?> filterCls;
+
+ /** */
+ private final int partsCnt;
+
+ /** */
+ private final int hash;
+
+ /**
+ * @param affFuncCls Affinity function class.
+ * @param filterCls Node filter class.
+ * @param backups Number of backups.
+ * @param partsCnt Number of partitions.
+ */
+ SimilarAffinityKey(Class<?> affFuncCls, Class<?> filterCls, int backups, int partsCnt) {
+ this.backups = backups;
+ this.affFuncCls = affFuncCls;
+ this.filterCls = filterCls;
+ this.partsCnt = partsCnt;
+
+ int hash = backups;
+ hash = 31 * hash + affFuncCls.hashCode();
+ hash = 31 * hash + filterCls.hashCode();
+ hash= 31 * hash + partsCnt;
+
+ this.hash = hash;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return hash;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ if (o == this)
+ return true;
+
+ if (o == null || getClass() != o.getClass())
+ return false;
+
+ SimilarAffinityKey key = (SimilarAffinityKey)o;
+
+ return backups == key.backups &&
+ affFuncCls == key.affFuncCls &&
+ filterCls == key.filterCls &&
+ partsCnt == key.partsCnt;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(SimilarAffinityKey.class, this);
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityUtils.java
index c24dd2d..abd5292 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityUtils.java
@@ -180,10 +180,16 @@ class GridAffinityUtils {
cctx.affinity().affinityReadyFuture(topVer).get();
+ AffinityAssignment assign0 = cctx.affinity().assignment(topVer);
+
+ GridAffinityAssignment assign = assign0 instanceof GridAffinityAssignment ?
+ (GridAffinityAssignment)assign0 :
+ new GridAffinityAssignment(topVer, assign0.assignment(), assign0.idealAssignment());
+
return F.t(
affinityMessage(ctx, cctx.config().getAffinity()),
affinityMessage(ctx, cctx.config().getAffinityMapper()),
- new GridAffinityAssignment(topVer, cctx.affinity().assignment(topVer)));
+ assign);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/HistoryAffinityAssignment.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/HistoryAffinityAssignment.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/HistoryAffinityAssignment.java
new file mode 100644
index 0000000..e502dd5
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/HistoryAffinityAssignment.java
@@ -0,0 +1,169 @@
+/*
+ * 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.affinity;
+
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
+
+/**
+ *
+ */
+public class HistoryAffinityAssignment implements AffinityAssignment {
+ /** */
+ private final AffinityTopologyVersion topVer;
+
+ /** */
+ private final List<List<ClusterNode>> assignment;
+
+ /** */
+ private final List<List<ClusterNode>> idealAssignment;
+
+ /** */
+ private final boolean clientEvtChange;
+
+ /**
+ * @param assign Assignment.
+ */
+ public HistoryAffinityAssignment(GridAffinityAssignment assign) {
+ this.topVer = assign.topologyVersion();
+ this.assignment = assign.assignment();
+ this.idealAssignment = assign.idealAssignment();
+ this.clientEvtChange = assign.clientEventChange();
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean clientEventChange() {
+ return clientEvtChange;
+ }
+
+ /** {@inheritDoc} */
+ @Override public List<List<ClusterNode>> idealAssignment() {
+ return idealAssignment;
+ }
+
+ /** {@inheritDoc} */
+ @Override public List<List<ClusterNode>> assignment() {
+ return assignment;
+ }
+
+ /** {@inheritDoc} */
+ @Override public AffinityTopologyVersion topologyVersion() {
+ return topVer;
+ }
+
+ /** {@inheritDoc} */
+ @Override public List<ClusterNode> get(int part) {
+ assert part >= 0 && part < assignment.size() : "Affinity partition is out of range" +
+ " [part=" + part + ", partitions=" + assignment.size() + ']';
+
+ return assignment.get(part);
+ }
+
+ /** {@inheritDoc} */
+ @Override public HashSet<UUID> getIds(int part) {
+ assert part >= 0 && part < assignment.size() : "Affinity partition is out of range" +
+ " [part=" + part + ", partitions=" + assignment.size() + ']';
+
+ List<ClusterNode> nodes = assignment.get(part);
+
+ HashSet<UUID> ids = U.newHashSet(nodes.size());
+
+ for (int i = 0; i < nodes.size(); i++)
+ ids.add(nodes.get(i).id());
+
+ return ids;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Set<ClusterNode> primaryPartitionNodes() {
+ Set<ClusterNode> res = new HashSet<>();
+
+ for (int p = 0; p < assignment.size(); p++) {
+ List<ClusterNode> nodes = assignment.get(p);
+
+ if (!F.isEmpty(nodes))
+ res.add(nodes.get(0));
+ }
+
+ return res;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Set<Integer> primaryPartitions(UUID nodeId) {
+ Set<Integer> res = new HashSet<>();
+
+ for (int p = 0; p < assignment.size(); p++) {
+ List<ClusterNode> nodes = assignment.get(p);
+
+ if (!F.isEmpty(nodes) && nodes.get(0).id().equals(nodeId))
+ res.add(p);
+ }
+
+ return res;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Set<Integer> backupPartitions(UUID nodeId) {
+ Set<Integer> res = new HashSet<>();
+
+ for (int p = 0; p < assignment.size(); p++) {
+ List<ClusterNode> nodes = assignment.get(p);
+
+ for (int i = 1; i < nodes.size(); i++) {
+ ClusterNode node = nodes.get(i);
+
+ if (node.id().equals(nodeId)) {
+ res.add(p);
+
+ break;
+ }
+ }
+ }
+
+ return res;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return topVer.hashCode();
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("SimplifiableIfStatement")
+ @Override public boolean equals(Object o) {
+ if (o == this)
+ return true;
+
+ if (o == null || !(o instanceof AffinityAssignment))
+ return false;
+
+ return topVer.equals(((AffinityAssignment)o).topologyVersion());
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(HistoryAffinityAssignment.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
index 1aedf4e..2890887 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
@@ -127,7 +127,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
* @param node Event node.
* @param topVer Topology version.
*/
- public void onDiscoveryEvent(int type, ClusterNode node, AffinityTopologyVersion topVer) {
+ void onDiscoveryEvent(int type, ClusterNode node, AffinityTopologyVersion topVer) {
if (type == EVT_NODE_JOINED && node.isLocal()) {
// Clean-up in case of client reconnect.
registeredCaches.clear();
@@ -153,7 +153,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
* @param msg Customer message.
* @return {@code True} if minor topology version should be increased.
*/
- public boolean onCustomEvent(CacheAffinityChangeMessage msg) {
+ boolean onCustomEvent(CacheAffinityChangeMessage msg) {
assert lateAffAssign : msg;
if (msg.exchangeId() != null) {
@@ -219,7 +219,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
* @param top Topology.
* @param checkCacheId Cache ID.
*/
- public void checkRebalanceState(GridDhtPartitionTopology top, Integer checkCacheId) {
+ void checkRebalanceState(GridDhtPartitionTopology top, Integer checkCacheId) {
if (!lateAffAssign)
return;
@@ -508,6 +508,8 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
assert assignment != null;
+ final Map<Object, List<List<ClusterNode>>> affCache = new HashMap<>();
+
forAllCaches(crd, new IgniteInClosureX<GridAffinityAssignmentCache>() {
@Override public void applyx(GridAffinityAssignmentCache aff) throws IgniteCheckedException {
List<List<ClusterNode>> idealAssignment = aff.idealAssignment();
@@ -527,7 +529,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
else
newAssignment = idealAssignment;
- aff.initialize(topVer, newAssignment);
+ aff.initialize(topVer, cachedAssignment(aff, newAssignment, affCache));
}
});
}
@@ -562,6 +564,8 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
final Map<Integer, IgniteUuid> deploymentIds = msg.cacheDeploymentIds();
+ final Map<Object, List<List<ClusterNode>>> affCache = new HashMap<>();
+
forAllCaches(crd, new IgniteInClosureX<GridAffinityAssignmentCache>() {
@Override public void applyx(GridAffinityAssignmentCache aff) throws IgniteCheckedException {
AffinityTopologyVersion affTopVer = aff.lastVersion();
@@ -602,7 +606,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
assignment.set(part, nodes);
}
- aff.initialize(topVer, assignment);
+ aff.initialize(topVer, cachedAssignment(aff, assignment, affCache));
}
else
aff.clientEventTopologyChange(exchFut.discoveryEvent(), topVer);
@@ -1206,6 +1210,8 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
throws IgniteCheckedException {
AffinityTopologyVersion topVer = fut.topologyVersion();
+ final Map<Object, List<List<ClusterNode>>> affCache = new HashMap<>();
+
if (!crd) {
for (GridCacheContext cacheCtx : cctx.cacheContexts()) {
if (cacheCtx.isLocal())
@@ -1213,7 +1219,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
boolean latePrimary = cacheCtx.rebalanceEnabled();
- initAffinityOnNodeJoin(fut, cacheCtx.affinity().affinityCache(), null, latePrimary);
+ initAffinityOnNodeJoin(fut, cacheCtx.affinity().affinityCache(), null, latePrimary, affCache);
}
return null;
@@ -1227,7 +1233,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
boolean latePrimary = cache.rebalanceEnabled;
- initAffinityOnNodeJoin(fut, cache.affinity(), waitRebalanceInfo, latePrimary);
+ initAffinityOnNodeJoin(fut, cache.affinity(), waitRebalanceInfo, latePrimary, affCache);
}
});
@@ -1240,12 +1246,14 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
* @param aff Affinity.
* @param rebalanceInfo Rebalance information.
* @param latePrimary If {@code true} delays primary assignment if it is not owner.
+ * @param affCache Already calculated assignments (to reduce data stored in history).
* @throws IgniteCheckedException If failed.
*/
private void initAffinityOnNodeJoin(GridDhtPartitionsExchangeFuture fut,
GridAffinityAssignmentCache aff,
WaitRebalanceInfo rebalanceInfo,
- boolean latePrimary)
+ boolean latePrimary,
+ Map<Object, List<List<ClusterNode>>> affCache)
throws IgniteCheckedException
{
assert lateAffAssign;
@@ -1292,7 +1300,26 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
if (newAssignment == null)
newAssignment = idealAssignment;
- aff.initialize(fut.topologyVersion(), newAssignment);
+ aff.initialize(fut.topologyVersion(), cachedAssignment(aff, newAssignment, affCache));
+ }
+
+ /**
+ * @param aff Assignment cache.
+ * @param assign Assignment.
+ * @param affCache Assignments already calculated for other caches.
+ * @return Assignment.
+ */
+ private List<List<ClusterNode>> cachedAssignment(GridAffinityAssignmentCache aff,
+ List<List<ClusterNode>> assign,
+ Map<Object, List<List<ClusterNode>>> affCache) {
+ List<List<ClusterNode>> assign0 = affCache.get(aff.similarAffinityKey());
+
+ if (assign0 != null && assign0.equals(assign))
+ assign = assign0;
+ else
+ affCache.put(aff.similarAffinityKey(), assign);
+
+ return assign;
}
/**
@@ -1367,7 +1394,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
* @return Affinity assignment.
* @throws IgniteCheckedException If failed.
*/
- public Map<Integer, Map<Integer, List<UUID>>> initAffinityOnNodeLeft0(final GridDhtPartitionsExchangeFuture fut)
+ private Map<Integer, Map<Integer, List<UUID>>> initAffinityOnNodeLeft0(final GridDhtPartitionsExchangeFuture fut)
throws IgniteCheckedException {
final AffinityTopologyVersion topVer = fut.topologyVersion();
@@ -1554,7 +1581,9 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
* @param aff Affinity cache.
* @param initAff Existing affinity cache.
*/
- public CacheHolder(boolean rebalanceEnabled, GridAffinityAssignmentCache aff, @Nullable GridAffinityAssignmentCache initAff) {
+ CacheHolder(boolean rebalanceEnabled,
+ GridAffinityAssignmentCache aff,
+ @Nullable GridAffinityAssignmentCache initAff) {
this.aff = aff;
if (initAff != null)
@@ -1606,7 +1635,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
/**
* Created cache is started on coordinator.
*/
- class CacheHolder1 extends CacheHolder {
+ private class CacheHolder1 extends CacheHolder {
/** */
private final GridCacheContext cctx;
@@ -1614,7 +1643,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
* @param cctx Cache context.
* @param initAff Current affinity.
*/
- public CacheHolder1(GridCacheContext cctx, @Nullable GridAffinityAssignmentCache initAff) {
+ CacheHolder1(GridCacheContext cctx, @Nullable GridAffinityAssignmentCache initAff) {
super(cctx.rebalanceEnabled(), cctx.affinity().affinityCache(), initAff);
assert !cctx.isLocal() : cctx.name();
@@ -1651,7 +1680,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
/**
* Created if cache is not started on coordinator.
*/
- static class CacheHolder2 extends CacheHolder {
+ private static class CacheHolder2 extends CacheHolder {
/** */
private final GridCacheSharedContext cctx;
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeBatch.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeBatch.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeBatch.java
index e10e5aa..4dcff9b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeBatch.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeBatch.java
@@ -62,6 +62,13 @@ public class DynamicCacheChangeBatch implements DiscoveryCustomMessage {
}
/**
+ * @param id Message ID.
+ */
+ public void id(IgniteUuid id) {
+ this.id = id;
+ }
+
+ /**
* @return Collection of change requests.
*/
public Collection<DynamicCacheChangeRequest> requests() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityManager.java
index 71ae5c9..c6e7ee6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityManager.java
@@ -25,8 +25,8 @@ import org.apache.ignite.cache.affinity.AffinityKeyMapper;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.internal.IgniteClientDisconnectedCheckedException;
import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.processors.affinity.AffinityAssignment;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.affinity.GridAffinityAssignment;
import org.apache.ignite.internal.processors.affinity.GridAffinityAssignmentCache;
import org.apache.ignite.internal.util.GridLeanSet;
import org.apache.ignite.internal.util.future.GridFinishedFuture;
@@ -48,7 +48,7 @@ public class GridCacheAffinityManager extends GridCacheManagerAdapter {
private static final AffinityTopologyVersion LOC_CACHE_TOP_VER = new AffinityTopologyVersion(1);
/** */
- public static final String FAILED_TO_FIND_CACHE_ERR_MSG = "Failed to find cache (cache was not started " +
+ private static final String FAILED_TO_FIND_CACHE_ERR_MSG = "Failed to find cache (cache was not started " +
"yet or cache was already stopped): ";
/** Affinity cached function. */
@@ -265,7 +265,7 @@ public class GridCacheAffinityManager extends GridCacheManagerAdapter {
* @param topVer Topology version.
* @return Affinity assignment.
*/
- public GridAffinityAssignment assignment(AffinityTopologyVersion topVer) {
+ public AffinityAssignment assignment(AffinityTopologyVersion topVer) {
if (cctx.isLocal())
topVer = LOC_CACHE_TOP_VER;
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
index 00d2d16..503b334 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
@@ -44,7 +44,9 @@ import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteSystemProperties;
+import org.apache.ignite.cache.affinity.AffinityFunction;
import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.events.DiscoveryEvent;
import org.apache.ignite.events.Event;
import org.apache.ignite.internal.IgniteClientDisconnectedCheckedException;
@@ -56,6 +58,7 @@ import org.apache.ignite.internal.events.DiscoveryCustomEvent;
import org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridClientPartitionTopology;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopology;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTopologyFuture;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemandMessage;
@@ -64,6 +67,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.Gri
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap2;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionSupplyMessageV2;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsAbstractMessage;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsFullMessage;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsSingleMessage;
@@ -71,6 +75,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.Gri
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPreloaderAssignments;
import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
import org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.processors.timeout.GridTimeoutObject;
import org.apache.ignite.internal.util.GridListSet;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
@@ -80,6 +85,7 @@ import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.CI1;
import org.apache.ignite.internal.util.typedef.CI2;
import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.T2;
import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.GPC;
import org.apache.ignite.internal.util.typedef.internal.S;
@@ -531,8 +537,23 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
if (top != null)
return top;
+ Object affKey = null;
+
+ DynamicCacheDescriptor desc = cctx.cache().cacheDescriptor(cacheId);
+
+ if (desc != null) {
+ CacheConfiguration ccfg = desc.cacheConfiguration();
+
+ AffinityFunction aff = ccfg.getAffinity();
+
+ affKey = cctx.kernalContext().affinity().similaryAffinityKey(aff,
+ ccfg.getNodeFilter(),
+ ccfg.getBackups(),
+ aff.partitions());
+ }
+
GridClientPartitionTopology old = clientTops.putIfAbsent(cacheId,
- top = new GridClientPartitionTopology(cctx, cacheId, exchFut));
+ top = new GridClientPartitionTopology(cctx, cacheId, exchFut, affKey));
return old != null ? old : top;
}
@@ -761,40 +782,16 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
* @param nodes Nodes.
* @return {@code True} if message was sent, {@code false} if node left grid.
*/
- private boolean sendAllPartitions(Collection<? extends ClusterNode> nodes) {
- GridDhtPartitionsFullMessage m = new GridDhtPartitionsFullMessage(null, null, AffinityTopologyVersion.NONE);
-
- boolean useOldApi = false;
-
- for (ClusterNode node : nodes) {
- if (node.version().compareTo(GridDhtPartitionMap2.SINCE) < 0)
- useOldApi = true;
- }
-
- for (GridCacheContext cacheCtx : cctx.cacheContexts()) {
- if (!cacheCtx.isLocal() && cacheCtx.started()) {
- GridDhtPartitionFullMap locMap = cacheCtx.topology().partitionMap(true);
-
- if (useOldApi) {
- locMap = new GridDhtPartitionFullMap(locMap.nodeId(),
- locMap.nodeOrder(),
- locMap.updateSequence(),
- locMap);
- }
-
- m.addFullPartitionsMap(cacheCtx.cacheId(), locMap);
- }
- }
-
- // It is important that client topologies be added after contexts.
- for (GridClientPartitionTopology top : cctx.exchange().clientTopologies())
- m.addFullPartitionsMap(top.cacheId(), top.partitionMap(true));
+ private boolean sendAllPartitions(Collection<ClusterNode> nodes) {
+ GridDhtPartitionsFullMessage m = createPartitionsFullMessage(nodes, null, null, true);
if (log.isDebugEnabled())
log.debug("Sending all partitions [nodeIds=" + U.nodeIds(nodes) + ", msg=" + m + ']');
for (ClusterNode node : nodes) {
try {
+ assert !node.equals(cctx.localNode());
+
cctx.io().sendNoRetry(node, m, SYSTEM_POOL);
}
catch (ClusterTopologyCheckedException ignore) {
@@ -811,31 +808,140 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
}
/**
- * @param node Node.
- * @param id ID.
+ * @param nodes Target nodes.
+ * @param exchId Non-null exchange ID if message is created for exchange.
+ * @param lastVer Last version.
+ * @param compress {@code True} if it is possible to use compression for message.
+ * @return Message.
*/
- private void sendLocalPartitions(ClusterNode node, @Nullable GridDhtPartitionExchangeId id) {
- GridDhtPartitionsSingleMessage m = new GridDhtPartitionsSingleMessage(id,
- cctx.kernalContext().clientNode(),
- cctx.versions().last());
+ public GridDhtPartitionsFullMessage createPartitionsFullMessage(Collection<ClusterNode> nodes,
+ @Nullable GridDhtPartitionExchangeId exchId,
+ @Nullable GridCacheVersion lastVer,
+ boolean compress) {
+ GridDhtPartitionsFullMessage m = new GridDhtPartitionsFullMessage(exchId,
+ lastVer,
+ exchId != null ? exchId.topologyVersion() : AffinityTopologyVersion.NONE);
+
+ boolean useOldApi = false;
+
+ if (nodes != null) {
+ for (ClusterNode node : nodes) {
+ if (node.version().compareTo(GridDhtPartitionMap2.SINCE) < 0) {
+ useOldApi = true;
+ compress = false;
+
+ break;
+ }
+ else if (node.version().compareToIgnoreTimestamp(GridDhtPartitionsAbstractMessage.PART_MAP_COMPRESS_SINCE) < 0)
+ compress = false;
+ }
+ }
+
+ m.compress(compress);
+
+ Map<Object, T2<Integer, GridDhtPartitionFullMap>> dupData = new HashMap<>();
for (GridCacheContext cacheCtx : cctx.cacheContexts()) {
if (!cacheCtx.isLocal()) {
- GridDhtPartitionMap2 locMap = cacheCtx.topology().localPartitionMap();
+ boolean ready;
- if (node.version().compareTo(GridDhtPartitionMap2.SINCE) < 0)
- locMap = new GridDhtPartitionMap(locMap.nodeId(), locMap.updateSequence(), locMap.map());
+ if (exchId != null) {
+ AffinityTopologyVersion startTopVer = cacheCtx.startTopologyVersion();
+
+ ready = startTopVer == null || startTopVer.compareTo(exchId.topologyVersion()) <= 0;
+ }
+ else
+ ready = cacheCtx.started();
+
+ if (ready) {
+ GridDhtPartitionFullMap locMap = cacheCtx.topology().partitionMap(true);
- m.addLocalPartitionMap(cacheCtx.cacheId(), locMap);
+ if (useOldApi) {
+ locMap = new GridDhtPartitionFullMap(locMap.nodeId(),
+ locMap.nodeOrder(),
+ locMap.updateSequence(),
+ locMap);
+ }
+
+ addFullPartitionsMap(m,
+ dupData,
+ compress,
+ cacheCtx.cacheId(),
+ locMap,
+ cacheCtx.affinity().affinityCache().similarAffinityKey());
+
+ if (exchId != null)
+ m.addPartitionUpdateCounters(cacheCtx.cacheId(), cacheCtx.topology().updateCounters(true));
+ }
}
}
- for (GridClientPartitionTopology top : clientTops.values()) {
- GridDhtPartitionMap2 locMap = top.localPartitionMap();
+ // It is important that client topologies be added after contexts.
+ for (GridClientPartitionTopology top : cctx.exchange().clientTopologies()) {
+ GridDhtPartitionFullMap map = top.partitionMap(true);
+
+ addFullPartitionsMap(m,
+ dupData,
+ compress,
+ top.cacheId(),
+ map,
+ top.similarAffinityKey());
+
+ if (exchId != null)
+ m.addPartitionUpdateCounters(top.cacheId(), top.updateCounters(true));
+ }
+
+ return m;
+ }
- m.addLocalPartitionMap(top.cacheId(), locMap);
+ /**
+ * @param m Message.
+ * @param dupData Duplicated data map.
+ * @param compress {@code True} if need check for duplicated partition state data.
+ * @param cacheId Cache ID.
+ * @param map Map to add.
+ * @param affKey Cache affinity key.
+ */
+ private void addFullPartitionsMap(GridDhtPartitionsFullMessage m,
+ Map<Object, T2<Integer, GridDhtPartitionFullMap>> dupData,
+ boolean compress,
+ Integer cacheId,
+ GridDhtPartitionFullMap map,
+ Object affKey) {
+ Integer dupDataCache = null;
+
+ if (compress && affKey != null && !m.containsCache(cacheId)) {
+ T2<Integer, GridDhtPartitionFullMap> state0 = dupData.get(affKey);
+
+ if (state0 != null && state0.get2().partitionStateEquals(map)) {
+ GridDhtPartitionFullMap map0 = new GridDhtPartitionFullMap(map.nodeId(),
+ map.nodeOrder(),
+ map.updateSequence());
+
+ for (Map.Entry<UUID, GridDhtPartitionMap2> e : map.entrySet())
+ map0.put(e.getKey(), e.getValue().emptyCopy());
+
+ map = map0;
+
+ dupDataCache = state0.get1();
+ }
+ else
+ dupData.put(affKey, new T2<>(cacheId, map));
}
+ m.addFullPartitionsMap(cacheId, map, dupDataCache);
+ }
+
+ /**
+ * @param node Node.
+ * @param id ID.
+ */
+ private void sendLocalPartitions(ClusterNode node, @Nullable GridDhtPartitionExchangeId id) {
+ GridDhtPartitionsSingleMessage m = createPartitionsSingleMessage(node,
+ id,
+ cctx.kernalContext().clientNode(),
+ false);
+
if (log.isDebugEnabled())
log.debug("Sending local partitions [nodeId=" + node.id() + ", msg=" + m + ']');
@@ -853,6 +959,98 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
}
/**
+ * @param targetNode Target node.
+ * @param exchangeId ID.
+ * @param clientOnlyExchange Client exchange flag.
+ * @param sndCounters {@code True} if need send partition update counters.
+ * @return Message.
+ */
+ public GridDhtPartitionsSingleMessage createPartitionsSingleMessage(ClusterNode targetNode,
+ @Nullable GridDhtPartitionExchangeId exchangeId,
+ boolean clientOnlyExchange,
+ boolean sndCounters)
+ {
+ boolean compress =
+ targetNode.version().compareToIgnoreTimestamp(GridDhtPartitionsSingleMessage.PART_MAP_COMPRESS_SINCE) >= 0;
+
+ GridDhtPartitionsSingleMessage m = new GridDhtPartitionsSingleMessage(exchangeId,
+ clientOnlyExchange,
+ cctx.versions().last(),
+ compress);
+
+ Map<Object, T2<Integer,Map<Integer, GridDhtPartitionState>>> dupData = new HashMap<>();
+
+ for (GridCacheContext cacheCtx : cctx.cacheContexts()) {
+ if (!cacheCtx.isLocal()) {
+ GridDhtPartitionMap2 locMap = cacheCtx.topology().localPartitionMap();
+
+ if (targetNode.version().compareTo(GridDhtPartitionMap2.SINCE) < 0)
+ locMap = new GridDhtPartitionMap(locMap.nodeId(), locMap.updateSequence(), locMap.map());
+
+ addPartitionMap(m,
+ dupData,
+ compress,
+ cacheCtx.cacheId(),
+ locMap,
+ cacheCtx.affinity().affinityCache().similarAffinityKey());
+
+ if (sndCounters)
+ m.partitionUpdateCounters(cacheCtx.cacheId(), cacheCtx.topology().updateCounters(true));
+ }
+ }
+
+ for (GridClientPartitionTopology top : clientTops.values()) {
+ if (m.partitions() != null && m.partitions().containsKey(top.cacheId()))
+ continue;
+
+ GridDhtPartitionMap2 locMap = top.localPartitionMap();
+
+ addPartitionMap(m,
+ dupData,
+ compress,
+ top.cacheId(),
+ locMap,
+ top.similarAffinityKey());
+
+ if (sndCounters)
+ m.partitionUpdateCounters(top.cacheId(), top.updateCounters(true));
+ }
+
+ return m;
+ }
+
+ /**
+ * @param m Message.
+ * @param dupData Duplicated data map.
+ * @param compress {@code True} if need check for duplicated partition state data.
+ * @param cacheId Cache ID.
+ * @param map Map to add.
+ * @param affKey Cache affinity key.
+ */
+ private void addPartitionMap(GridDhtPartitionsSingleMessage m,
+ Map<Object, T2<Integer, Map<Integer, GridDhtPartitionState>>> dupData,
+ boolean compress,
+ Integer cacheId,
+ GridDhtPartitionMap2 map,
+ Object affKey) {
+ Integer dupDataCache = null;
+
+ if (compress) {
+ T2<Integer, Map<Integer, GridDhtPartitionState>> state0 = dupData.get(affKey);
+
+ if (state0 != null && state0.get2().equals(map.map())) {
+ dupDataCache = state0.get1();
+
+ map = map.emptyCopy();
+ }
+ else
+ dupData.put(affKey, new T2<>(cacheId, map.map()));
+ }
+
+ m.addLocalPartitionMap(cacheId, map, dupDataCache);
+ }
+
+ /**
* @param nodeId Cause node ID.
* @param topVer Topology version.
* @param evt Event type.
@@ -869,7 +1067,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
* @param affChangeMsg Affinity change message.
* @return Exchange future.
*/
- GridDhtPartitionsExchangeFuture exchangeFuture(GridDhtPartitionExchangeId exchId,
+ private GridDhtPartitionsExchangeFuture exchangeFuture(GridDhtPartitionExchangeId exchId,
@Nullable DiscoveryEvent discoEvt,
@Nullable Collection<DynamicCacheChangeRequest> reqs,
@Nullable CacheAffinityChangeMessage affChangeMsg) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/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 fd6abbd..5e777fd 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -1958,8 +1958,6 @@ public class GridCacheProcessor extends GridProcessorAdapter {
req.template(true);
- req.deploymentId(desc.deploymentId());
-
reqs.add(req);
}
@@ -1972,6 +1970,9 @@ public class GridCacheProcessor extends GridProcessorAdapter {
batch.clientReconnect(reconnect);
+ // Reset random batch ID so that serialized batches with the same descriptors will be exactly the same.
+ batch.id(null);
+
return batch;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
index 58933b7..5efb317 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
@@ -61,6 +61,9 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
/** Flag to control amount of output for full map. */
private static final boolean FULL_MAP_DEBUG = false;
+ /** */
+ private static final Long ZERO = 0L;
+
/** Cache shared context. */
private GridCacheSharedContext cctx;
@@ -97,18 +100,24 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
/** Partition update counters. */
private Map<Integer, Long> cntrMap = new HashMap<>();
+ /** */
+ private final Object similarAffKey;
+
/**
* @param cctx Context.
* @param cacheId Cache ID.
* @param exchFut Exchange ID.
+ * @param similarAffKey Key to find caches with similar affinity.
*/
public GridClientPartitionTopology(
GridCacheSharedContext cctx,
int cacheId,
- GridDhtPartitionsExchangeFuture exchFut
+ GridDhtPartitionsExchangeFuture exchFut,
+ Object similarAffKey
) {
this.cctx = cctx;
this.cacheId = cacheId;
+ this.similarAffKey = similarAffKey;
topVer = exchFut.topologyVersion();
@@ -125,6 +134,13 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
}
/**
+ * @return Key to find caches with similar affinity.
+ */
+ @Nullable public Object similarAffinityKey() {
+ return similarAffKey;
+ }
+
+ /**
* @return Full map string representation.
*/
@SuppressWarnings( {"ConstantConditions"})
@@ -873,11 +889,22 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
}
/** {@inheritDoc} */
- @Override public Map<Integer, Long> updateCounters() {
+ @Override public Map<Integer, Long> updateCounters(boolean skipZeros) {
lock.readLock().lock();
try {
- return new HashMap<>(cntrMap);
+ if (skipZeros) {
+ Map<Integer, Long> res = U.newHashMap(cntrMap.size());
+
+ for (Map.Entry<Integer, Long> e : cntrMap.entrySet()) {
+ if (!e.getValue().equals(ZERO))
+ res.put(e.getKey(), e.getValue());
+ }
+
+ return res;
+ }
+ else
+ return new HashMap<>(cntrMap);
}
finally {
lock.readLock().unlock();
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
index 6e9b907..4ae4e47 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
@@ -220,9 +220,10 @@ public interface GridDhtPartitionTopology {
@Nullable Map<Integer, Long> cntrMap);
/**
+ * @param skipZeros If {@code true} then filters out zero counters.
* @return Partition update counters.
*/
- public Map<Integer, Long> updateCounters();
+ public Map<Integer, Long> updateCounters(boolean skipZeros);
/**
* @param part Partition to own.
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
index 50f7f0f..f3751ac 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
@@ -35,8 +35,8 @@ import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.events.DiscoveryEvent;
import org.apache.ignite.internal.IgniteFutureTimeoutCheckedException;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
+import org.apache.ignite.internal.processors.affinity.AffinityAssignment;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.affinity.GridAffinityAssignment;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCacheMapEntryFactory;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionExchangeId;
@@ -71,6 +71,9 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
/** Flag to control amount of output for full map. */
private static final boolean FULL_MAP_DEBUG = false;
+ /** */
+ private static final Long ZERO = 0L;
+
/** Context. */
private final GridCacheContext<?, ?> cctx;
@@ -859,7 +862,7 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
/** {@inheritDoc} */
@Override public List<ClusterNode> nodes(int p, AffinityTopologyVersion topVer) {
- GridAffinityAssignment affAssignment = cctx.affinity().assignment(topVer);
+ AffinityAssignment affAssignment = cctx.affinity().assignment(topVer);
List<ClusterNode> affNodes = affAssignment.get(p);
@@ -1500,11 +1503,26 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
}
/** {@inheritDoc} */
- @Override public Map<Integer, Long> updateCounters() {
+ @Override public Map<Integer, Long> updateCounters(boolean skipZeros) {
lock.readLock().lock();
try {
- Map<Integer, Long> res = new HashMap<>(cntrMap);
+ Map<Integer, Long> res;
+
+ if (skipZeros) {
+ res = U.newHashMap(cntrMap.size());
+
+ for (Map.Entry<Integer, Long> e : cntrMap.entrySet()) {
+ Long cntr = e.getValue();
+
+ if (ZERO.equals(cntr))
+ continue;
+
+ res.put(e.getKey(), cntr);
+ }
+ }
+ else
+ res = new HashMap<>(cntrMap);
for (int i = 0; i < locParts.length; i++) {
GridDhtLocalPartition part = locParts[i];
@@ -1513,7 +1531,10 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
continue;
Long cntr0 = res.get(part.id());
- Long cntr1 = part.updateCounter();
+ long cntr1 = part.updateCounter();
+
+ if (skipZeros && cntr1 == 0L)
+ continue;
if (cntr0 == null || cntr1 > cntr0)
res.put(part.id(), cntr1);
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionFullMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionFullMap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionFullMap.java
index 498d492..8f5ad17 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionFullMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionFullMap.java
@@ -158,6 +158,24 @@ public class GridDhtPartitionFullMap extends HashMap<UUID, GridDhtPartitionMap2>
}
/**
+ * @param fullMap Map.
+ * @return {@code True} if this map and given map contain the same data.
+ */
+ public boolean partitionStateEquals(GridDhtPartitionFullMap fullMap) {
+ if (size() != fullMap.size())
+ return false;
+
+ for (Map.Entry<UUID, GridDhtPartitionMap2> e : entrySet()) {
+ GridDhtPartitionMap2 m = fullMap.get(e.getKey());
+
+ if (m == null || !m.map().equals(e.getValue().map()))
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
* @param updateSeq New update sequence value.
* @return Old update sequence value.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap2.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap2.java
index 15b5a2e..ce36a11 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap2.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap2.java
@@ -61,27 +61,24 @@ public class GridDhtPartitionMap2 implements Comparable<GridDhtPartitionMap2>, E
private volatile int moving;
/**
- * @param nodeId Node ID.
- * @param updateSeq Update sequence number.
+ * Empty constructor required for {@link Externalizable}.
*/
- public GridDhtPartitionMap2(UUID nodeId, long updateSeq) {
- assert nodeId != null;
- assert updateSeq > 0;
-
- this.nodeId = nodeId;
- this.updateSeq = updateSeq;
-
- map = new HashMap<>();
+ public GridDhtPartitionMap2() {
+ // No-op.
}
/**
* @param nodeId Node ID.
* @param updateSeq Update sequence number.
+ * @param top Topology version.
* @param m Map to copy.
* @param onlyActive If {@code true}, then only active states will be included.
*/
- public GridDhtPartitionMap2(UUID nodeId, long updateSeq, AffinityTopologyVersion top,
- Map<Integer, GridDhtPartitionState> m, boolean onlyActive) {
+ public GridDhtPartitionMap2(UUID nodeId,
+ long updateSeq,
+ AffinityTopologyVersion top,
+ Map<Integer, GridDhtPartitionState> m,
+ boolean onlyActive) {
assert nodeId != null;
assert updateSeq > 0;
@@ -100,10 +97,33 @@ public class GridDhtPartitionMap2 implements Comparable<GridDhtPartitionMap2>, E
}
/**
- * Empty constructor required for {@link Externalizable}.
+ * @param nodeId Node ID.
+ * @param updateSeq Update sequence number.
+ * @param top Topology version.
+ * @param map Map.
+ * @param moving Number of moving partitions.
*/
- public GridDhtPartitionMap2() {
- // No-op.
+ private GridDhtPartitionMap2(UUID nodeId,
+ long updateSeq,
+ AffinityTopologyVersion top,
+ Map<Integer, GridDhtPartitionState> map,
+ int moving) {
+ this.nodeId = nodeId;
+ this.updateSeq = updateSeq;
+ this.top = top;
+ this.map = map;
+ this.moving = moving;
+ }
+
+ /**
+ * @return Copy with empty partition state map.
+ */
+ public GridDhtPartitionMap2 emptyCopy() {
+ return new GridDhtPartitionMap2(nodeId,
+ updateSeq,
+ top,
+ U.<Integer, GridDhtPartitionState>newHashMap(0),
+ 0);
}
/**
@@ -277,9 +297,8 @@ public class GridDhtPartitionMap2 implements Comparable<GridDhtPartitionMap2>, E
long ver = in.readLong();
int minorVer = in.readInt();
- if (ver != 0) {
+ if (ver != 0)
top = new AffinityTopologyVersion(ver, minorVer);
- }
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsAbstractMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsAbstractMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsAbstractMessage.java
index 4e714ed..6e69161 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsAbstractMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsAbstractMessage.java
@@ -22,6 +22,7 @@ import java.nio.ByteBuffer;
import org.apache.ignite.internal.processors.cache.GridCacheMessage;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.lang.IgniteProductVersion;
import org.apache.ignite.plugin.extensions.communication.MessageReader;
import org.apache.ignite.plugin.extensions.communication.MessageWriter;
import org.jetbrains.annotations.Nullable;
@@ -29,7 +30,13 @@ import org.jetbrains.annotations.Nullable;
/**
* Request for single partition info.
*/
-abstract class GridDhtPartitionsAbstractMessage extends GridCacheMessage {
+public abstract class GridDhtPartitionsAbstractMessage extends GridCacheMessage {
+ /** */
+ public static final IgniteProductVersion PART_MAP_COMPRESS_SINCE = IgniteProductVersion.fromString("1.6.11");
+
+ /** */
+ protected static final byte COMPRESSED_FLAG_MASK = 1;
+
/** */
private static final long serialVersionUID = 0L;
@@ -39,6 +46,9 @@ abstract class GridDhtPartitionsAbstractMessage extends GridCacheMessage {
/** Last used cache version. */
private GridCacheVersion lastVer;
+ /** */
+ private byte flags;
+
/**
* Required by {@link Externalizable}.
*/
@@ -79,6 +89,20 @@ abstract class GridDhtPartitionsAbstractMessage extends GridCacheMessage {
return lastVer;
}
+ /**
+ * @return {@code True} if message data is compressed.
+ */
+ protected final boolean compressed() {
+ return (flags & COMPRESSED_FLAG_MASK) != 0;
+ }
+
+ /**
+ * @param compressed {@code True} if message data is compressed.
+ */
+ protected final void compressed(boolean compressed) {
+ flags = compressed ? (byte)(flags | COMPRESSED_FLAG_MASK) : (byte)(flags & ~COMPRESSED_FLAG_MASK);
+ }
+
/** {@inheritDoc} */
@Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
writer.setBuffer(buf);
@@ -101,6 +125,12 @@ abstract class GridDhtPartitionsAbstractMessage extends GridCacheMessage {
writer.incrementState();
case 4:
+ if (!writer.writeByte("flags", flags))
+ return false;
+
+ writer.incrementState();
+
+ case 5:
if (!writer.writeMessage("lastVer", lastVer))
return false;
@@ -131,6 +161,14 @@ abstract class GridDhtPartitionsAbstractMessage extends GridCacheMessage {
reader.incrementState();
case 4:
+ flags = reader.readByte("flags");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 5:
lastVer = reader.readMessage("lastVer");
if (!reader.isLastRead())
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index 80b3768..f391265 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -54,6 +54,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridClientPartitionTopology;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopology;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTopologyFuture;
import org.apache.ignite.internal.processors.cache.transactions.IgniteTxKey;
@@ -64,6 +65,7 @@ import org.apache.ignite.internal.util.tostring.GridToStringExclude;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.CI1;
import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.T2;
import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.LT;
import org.apache.ignite.internal.util.typedef.internal.S;
@@ -544,7 +546,7 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
exchId.topologyVersion().equals(cacheCtx.startTopologyVersion());
if (updateTop && clientTop != null)
- cacheCtx.topology().update(exchId, clientTop.partitionMap(true), clientTop.updateCounters());
+ cacheCtx.topology().update(exchId, clientTop.partitionMap(true), clientTop.updateCounters(false));
}
top.updateTopologyVersion(exchId, this, updSeq, stopping(cacheCtx.cacheId()));
@@ -668,7 +670,7 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
if (top.cacheId() == cacheCtx.cacheId()) {
cacheCtx.topology().update(exchId,
top.partitionMap(true),
- top.updateCounters());
+ top.updateCounters(false));
break;
}
@@ -678,7 +680,7 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
}
else {
if (!centralizedAff)
- sendLocalPartitions(crd, exchId);
+ sendLocalPartitions(crd);
initDone();
@@ -928,27 +930,14 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
/**
* @param node Node.
- * @param id ID.
* @throws IgniteCheckedException If failed.
*/
- private void sendLocalPartitions(ClusterNode node, @Nullable GridDhtPartitionExchangeId id)
+ private void sendLocalPartitions(ClusterNode node)
throws IgniteCheckedException {
- GridDhtPartitionsSingleMessage m = new GridDhtPartitionsSingleMessage(id,
+ GridDhtPartitionsSingleMessage m = cctx.exchange().createPartitionsSingleMessage(node,
+ exchangeId(),
clientOnlyExchange,
- cctx.versions().last());
-
- for (GridCacheContext cacheCtx : cctx.cacheContexts()) {
- if (!cacheCtx.isLocal()) {
- GridDhtPartitionMap2 locMap = cacheCtx.topology().localPartitionMap();
-
- if (node.version().compareTo(GridDhtPartitionMap2.SINCE) < 0)
- locMap = new GridDhtPartitionMap(locMap.nodeId(), locMap.updateSequence(), locMap.map());
-
- m.addLocalPartitionMap(cacheCtx.cacheId(), locMap);
-
- m.partitionUpdateCounters(cacheCtx.cacheId(), cacheCtx.topology().updateCounters());
- }
- }
+ true);
if (log.isDebugEnabled())
log.debug("Sending local partitions [nodeId=" + node.id() + ", exchId=" + exchId + ", msg=" + m + ']');
@@ -964,51 +953,16 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
/**
* @param nodes Target nodes.
- * @return Message;
+ * @param compress {@code True} if it is possible to use compression for message.
+ * @return Message.
*/
- private GridDhtPartitionsFullMessage createPartitionsMessage(Collection<ClusterNode> nodes) {
+ private GridDhtPartitionsFullMessage createPartitionsMessage(Collection<ClusterNode> nodes, boolean compress) {
GridCacheVersion last = lastVer.get();
- GridDhtPartitionsFullMessage m = new GridDhtPartitionsFullMessage(exchangeId(),
+ return cctx.exchange().createPartitionsFullMessage(nodes,
+ exchangeId(),
last != null ? last : cctx.versions().last(),
- topologyVersion());
-
- boolean useOldApi = false;
-
- if (nodes != null) {
- for (ClusterNode node : nodes) {
- if (node.version().compareTo(GridDhtPartitionMap2.SINCE) < 0)
- useOldApi = true;
- }
- }
-
- for (GridCacheContext cacheCtx : cctx.cacheContexts()) {
- if (!cacheCtx.isLocal()) {
- AffinityTopologyVersion startTopVer = cacheCtx.startTopologyVersion();
-
- boolean ready = startTopVer == null || startTopVer.compareTo(topologyVersion()) <= 0;
-
- if (ready) {
- GridDhtPartitionFullMap locMap = cacheCtx.topology().partitionMap(true);
-
- if (useOldApi)
- locMap = new GridDhtPartitionFullMap(locMap.nodeId(), locMap.nodeOrder(), locMap.updateSequence(), locMap);
-
- m.addFullPartitionsMap(cacheCtx.cacheId(), locMap);
-
- m.addPartitionUpdateCounters(cacheCtx.cacheId(), cacheCtx.topology().updateCounters());
- }
- }
- }
-
- // It is important that client topologies be added after contexts.
- for (GridClientPartitionTopology top : cctx.exchange().clientTopologies()) {
- m.addFullPartitionsMap(top.cacheId(), top.partitionMap(true));
-
- m.addPartitionUpdateCounters(top.cacheId(), top.updateCounters());
- }
-
- return m;
+ compress);
}
/**
@@ -1016,7 +970,9 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
* @throws IgniteCheckedException If failed.
*/
private void sendAllPartitions(Collection<ClusterNode> nodes) throws IgniteCheckedException {
- GridDhtPartitionsFullMessage m = createPartitionsMessage(nodes);
+ GridDhtPartitionsFullMessage m = createPartitionsMessage(nodes, true);
+
+ assert !nodes.contains(cctx.localNode());
if (log.isDebugEnabled())
log.debug("Sending full partition map [nodeIds=" + F.viewReadOnly(nodes, F.node2id()) +
@@ -1030,7 +986,7 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
*/
private void sendPartitions(ClusterNode oldestNode) {
try {
- sendLocalPartitions(oldestNode, exchId);
+ sendLocalPartitions(oldestNode);
}
catch (ClusterTopologyCheckedException ignore) {
if (log.isDebugEnabled())
@@ -1234,7 +1190,7 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
Map<Integer, Map<Integer, List<UUID>>> assignmentChange = fut.get();
- GridDhtPartitionsFullMessage m = createPartitionsMessage(null);
+ GridDhtPartitionsFullMessage m = createPartitionsMessage(null, false);
CacheAffinityChangeMessage msg = new CacheAffinityChangeMessage(exchId, m, assignmentChange);
[05/50] [abbrv] ignite git commit: IGNITE-4201: Fixed version fix
maven step.
Posted by sb...@apache.org.
IGNITE-4201: Fixed version fix maven step.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1093819a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1093819a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1093819a
Branch: refs/heads/master
Commit: 1093819ac0f3e7a0faacde59919117b8977e6d5b
Parents: b1c7c9b
Author: Igor Sapego <is...@gridgain.com>
Authored: Wed Nov 9 18:19:01 2016 +0300
Committer: Igor Sapego <is...@gridgain.com>
Committed: Wed Nov 9 18:19:01 2016 +0300
----------------------------------------------------------------------
pom.xml | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/1093819a/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 4f4198c..942410f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -888,6 +888,7 @@
<substitution expression="\1${new.client.version}\2" />
<fileset dir="${basedir}/">
<include name="**/configure.ac" />
+ <include name="**/configure.acrel" />
</fileset>
</replaceregexp>
[50/50] [abbrv] ignite git commit: Merge remote-tracking branch
'remotes/community/ignite-1.7.4'
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/community/ignite-1.7.4'
# Conflicts:
# modules/core/src/main/java/org/apache/ignite/internal/util/GridLogThrottle.java
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5ffb8a74
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5ffb8a74
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5ffb8a74
Branch: refs/heads/master
Commit: 5ffb8a74d08d998f8258770669ecb240db41964f
Parents: 12d830d
Author: sboikov <sb...@gridgain.com>
Authored: Tue Nov 22 14:39:14 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Nov 22 14:39:14 2016 +0300
----------------------------------------------------------------------
.../main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/5ffb8a74/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index b3b1e9d..9a36f1a 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -4128,7 +4128,6 @@ class ServerImpl extends TcpDiscoveryImpl {
rmCrd.subject().permissions())) {
// Node has not pass authentication.
LT.warn(log,
- null,
"Failed to authenticate local node " +
"(local authentication result is different from rest of topology) " +
"[nodeId=" + node.id() + ", addrs=" + U.addressesAsString(node) + ']',
[40/50] [abbrv] ignite git commit: IGNITE-3075 Fixed condition for
'single' request creation
Posted by sb...@apache.org.
IGNITE-3075 Fixed condition for 'single' request creation
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d32fa21b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d32fa21b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d32fa21b
Branch: refs/heads/master
Commit: d32fa21b673814b060d2362f06ff44838e9c2cdc
Parents: f2dc1d7
Author: sboikov <sb...@gridgain.com>
Authored: Tue Nov 22 11:33:55 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Nov 22 11:33:55 2016 +0300
----------------------------------------------------------------------
.../GridDhtAtomicAbstractUpdateFuture.java | 19 ++++++++-----
.../dht/atomic/GridDhtAtomicCache.java | 2 +-
.../atomic/GridDhtAtomicSingleUpdateFuture.java | 30 +++++++++++++-------
.../dht/atomic/GridDhtAtomicUpdateFuture.java | 10 +++++--
.../GridNearAtomicAbstractUpdateRequest.java | 5 ----
.../atomic/GridNearAtomicFullUpdateRequest.java | 5 ----
.../GridNearAtomicSingleUpdateRequest.java | 9 ------
...CacheLoadingConcurrentGridStartSelfTest.java | 6 +++-
8 files changed, 44 insertions(+), 42 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d32fa21b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateFuture.java
index 7e4c4e0..361fbe2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateFuture.java
@@ -86,9 +86,6 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridFutureAdapte
/** Update response. */
final GridNearAtomicUpdateResponse updateRes;
- /** Force transform backup flag. */
- private boolean forceTransformBackups;
-
/** Mappings. */
@GridToStringInclude
protected Map<UUID, GridDhtAtomicAbstractUpdateRequest> mappings;
@@ -198,7 +195,9 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridFutureAdapte
writeVer,
syncMode,
topVer,
- forceTransformBackups);
+ ttl,
+ conflictExpireTime,
+ conflictVer);
mappings.put(nodeId, updateReq);
}
@@ -265,7 +264,9 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridFutureAdapte
writeVer,
syncMode,
topVer,
- forceTransformBackups);
+ ttl,
+ expireTime,
+ null);
mappings.put(nodeId, updateReq);
}
@@ -404,7 +405,9 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridFutureAdapte
* @param writeVer Update version.
* @param syncMode Write synchronization mode.
* @param topVer Topology version.
- * @param forceTransformBackups Force transform backups flag.
+ * @param ttl TTL.
+ * @param conflictExpireTime Conflict expire time.
+ * @param conflictVer Conflict version.
* @return Request.
*/
protected abstract GridDhtAtomicAbstractUpdateRequest createRequest(
@@ -413,7 +416,9 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridFutureAdapte
GridCacheVersion writeVer,
CacheWriteSynchronizationMode syncMode,
@NotNull AffinityTopologyVersion topVer,
- boolean forceTransformBackups
+ long ttl,
+ long conflictExpireTime,
+ @Nullable GridCacheVersion conflictVer
);
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/d32fa21b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index 2a7055d..940c74e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -2369,7 +2369,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
assert !(newConflictVer instanceof GridCacheVersionEx) : newConflictVer;
- boolean primary = !req.fastMap() || ctx.affinity().primary(ctx.localNode(), entry.key(),
+ boolean primary = !req.fastMap() || ctx.affinity().primary(ctx.localNode(), entry.partition(),
req.topologyVersion());
Object writeVal = op == TRANSFORM ? req.entryProcessor(i) : req.writeValue(i);
http://git-wip-us.apache.org/repos/asf/ignite/blob/d32fa21b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateFuture.java
index 656caab..20d6e90 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateFuture.java
@@ -30,10 +30,12 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheE
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.util.typedef.CI2;
import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteProductVersion;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
/**
*
@@ -100,11 +102,11 @@ class GridDhtAtomicSingleUpdateFuture extends GridDhtAtomicAbstractUpdateFuture
GridCacheVersion writeVer,
CacheWriteSynchronizationMode syncMode,
@NotNull AffinityTopologyVersion topVer,
- boolean forceTransformBackups
+ long ttl,
+ long conflictExpireTime,
+ @Nullable GridCacheVersion conflictVer
) {
- if (canUseSingleRequest(node)) {
- assert !forceTransformBackups;
-
+ if (canUseSingleRequest(node, ttl, conflictExpireTime, conflictVer)) {
return new GridDhtAtomicSingleUpdateRequest(
cctx.cacheId(),
node.id(),
@@ -126,10 +128,10 @@ class GridDhtAtomicSingleUpdateFuture extends GridDhtAtomicAbstractUpdateFuture
writeVer,
syncMode,
topVer,
- forceTransformBackups,
+ false,
updateReq.subjectId(),
updateReq.taskNameHash(),
- forceTransformBackups ? updateReq.invokeArguments() : null,
+ null,
cctx.deploymentEnabled(),
updateReq.keepBinary(),
updateReq.skipStore());
@@ -166,13 +168,19 @@ class GridDhtAtomicSingleUpdateFuture extends GridDhtAtomicAbstractUpdateFuture
/**
* @param node Target node
- * @return {@code true} if target node supports {@link GridNearAtomicSingleUpdateRequest}
+ * @param ttl TTL.
+ * @param conflictExpireTime Conflict expire time.
+ * @param conflictVer Conflict version.
+ * @return {@code True} if it is possible to use {@link GridDhtAtomicSingleUpdateRequest}.
*/
- private boolean canUseSingleRequest(ClusterNode node) {
+ private boolean canUseSingleRequest(ClusterNode node,
+ long ttl,
+ long conflictExpireTime,
+ @Nullable GridCacheVersion conflictVer) {
return node.version().compareToIgnoreTimestamp(SINGLE_UPDATE_REQUEST) >= 0 &&
- cctx.expiry() == null &&
- updateReq.expiry() == null &&
- !updateReq.hasConflictData();
+ (ttl == CU.TTL_NOT_CHANGED) &&
+ (conflictExpireTime == CU.EXPIRE_TIME_CALCULATE) &&
+ conflictVer == null;
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/d32fa21b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
index dd1f1c4..efb35c4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
@@ -36,6 +36,7 @@ import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
/**
* DHT atomic cache backup update future.
@@ -126,7 +127,10 @@ class GridDhtAtomicUpdateFuture extends GridDhtAtomicAbstractUpdateFuture {
GridCacheVersion writeVer,
CacheWriteSynchronizationMode syncMode,
@NotNull AffinityTopologyVersion topVer,
- boolean forceTransformBackups) {
+ long ttl,
+ long conflictExpireTime,
+ @Nullable GridCacheVersion conflictVer
+ ) {
return new GridDhtAtomicUpdateRequest(
cctx.cacheId(),
node.id(),
@@ -134,10 +138,10 @@ class GridDhtAtomicUpdateFuture extends GridDhtAtomicAbstractUpdateFuture {
writeVer,
syncMode,
topVer,
- forceTransformBackups,
+ false,
updateReq.subjectId(),
updateReq.taskNameHash(),
- forceTransformBackups ? updateReq.invokeArguments() : null,
+ null,
cctx.deploymentEnabled(),
updateReq.keepBinary(),
updateReq.skipStore());
http://git-wip-us.apache.org/repos/asf/ignite/blob/d32fa21b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java
index bae9e3a..bee2ecd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java
@@ -223,9 +223,4 @@ public abstract class GridNearAtomicAbstractUpdateRequest extends GridCacheMessa
* @return Key.
*/
public abstract KeyCacheObject key(int idx);
-
- /**
- * @return {@code True} if request does not have conflict data.
- */
- public abstract boolean hasConflictData();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d32fa21b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
index c785828..1b11688 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
@@ -534,11 +534,6 @@ public class GridNearAtomicFullUpdateRequest extends GridNearAtomicAbstractUpdat
}
/** {@inheritDoc} */
- @Override public boolean hasConflictData() {
- return F.size(conflictVers) > 0 || conflictTtls != null || conflictExpireTimes != null;
- }
-
- /** {@inheritDoc} */
@Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
super.prepareMarshal(ctx);
http://git-wip-us.apache.org/repos/asf/ignite/blob/d32fa21b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java
index f3b9726..1c1addd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java
@@ -227,15 +227,6 @@ public class GridNearAtomicSingleUpdateRequest extends GridNearAtomicAbstractSin
}
/** {@inheritDoc} */
- @Override public boolean hasConflictData() {
- return false;
- }
-
- /**
- * {@inheritDoc}
- *
- * @param ctx
- */
@Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
super.prepareMarshal(ctx);
http://git-wip-us.apache.org/repos/asf/ignite/blob/d32fa21b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLoadingConcurrentGridStartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLoadingConcurrentGridStartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLoadingConcurrentGridStartSelfTest.java
index 0801691..ce64e1d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLoadingConcurrentGridStartSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLoadingConcurrentGridStartSelfTest.java
@@ -42,6 +42,7 @@ import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiInClosure;
import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgniteInClosure;
+import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.jetbrains.annotations.Nullable;
@@ -77,6 +78,8 @@ public class CacheLoadingConcurrentGridStartSelfTest extends GridCommonAbstractT
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
+ ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
+
CacheConfiguration ccfg = new CacheConfiguration();
ccfg.setCacheMode(PARTITIONED);
@@ -95,7 +98,7 @@ public class CacheLoadingConcurrentGridStartSelfTest extends GridCommonAbstractT
else
cfg.setCacheConfiguration(ccfg);
- if (!configured)
+ if (!configured) {
ccfg.setNodeFilter(new P1<ClusterNode>() {
@Override public boolean apply(ClusterNode node) {
String name = node.attribute(ATTR_GRID_NAME).toString();
@@ -103,6 +106,7 @@ public class CacheLoadingConcurrentGridStartSelfTest extends GridCommonAbstractT
return !getTestGridName(0).equals(name);
}
});
+ }
return cfg;
}
[48/50] [abbrv] ignite git commit: Merge remote-tracking branch
'remotes/community/ignite-1.7.4'
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/community/ignite-1.7.4'
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/47fbba8f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/47fbba8f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/47fbba8f
Branch: refs/heads/master
Commit: 47fbba8f6b8b26b3b9ce5087c5fe8b1f4f94e6d9
Parents: a884db5 551f90d
Author: sboikov <sb...@gridgain.com>
Authored: Tue Nov 22 14:18:34 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Nov 22 14:18:34 2016 +0300
----------------------------------------------------------------------
.../java/org/apache/ignite/IgniteCache.java | 21 +-
.../ignite/cache/query/QueryDetailMetrics.java | 98 ++
.../apache/ignite/cache/query/QueryMetrics.java | 2 +-
.../store/jdbc/CacheAbstractJdbcStore.java | 2 +-
.../store/jdbc/dialect/BasicJdbcDialect.java | 4 +-
.../cache/store/jdbc/dialect/DB2Dialect.java | 8 +
.../cache/store/jdbc/dialect/OracleDialect.java | 8 +
.../store/jdbc/dialect/SQLServerDialect.java | 8 +
.../configuration/CacheConfiguration.java | 30 +
.../communication/GridIoMessageFactory.java | 30 +-
.../processors/cache/GridCacheEntryEx.java | 4 +-
.../processors/cache/GridCacheIoManager.java | 89 +-
.../processors/cache/GridCacheMapEntry.java | 4 +-
.../processors/cache/GridCachePreloader.java | 11 +
.../cache/GridCachePreloaderAdapter.java | 7 +
.../processors/cache/GridCacheUtilityKey.java | 6 +-
.../processors/cache/IgniteCacheProxy.java | 59 +-
.../GridDhtAtomicAbstractUpdateFuture.java | 466 ++++++++
.../GridDhtAtomicAbstractUpdateRequest.java | 287 +++++
.../dht/atomic/GridDhtAtomicCache.java | 146 ++-
.../atomic/GridDhtAtomicSingleUpdateFuture.java | 182 +++
.../GridDhtAtomicSingleUpdateRequest.java | 678 +++++++++++
.../dht/atomic/GridDhtAtomicUpdateFuture.java | 421 +------
.../dht/atomic/GridDhtAtomicUpdateRequest.java | 312 ++---
...idNearAtomicAbstractSingleUpdateRequest.java | 562 +++++++++
.../GridNearAtomicAbstractUpdateFuture.java | 15 +-
.../GridNearAtomicAbstractUpdateRequest.java | 231 ++++
.../atomic/GridNearAtomicFullUpdateRequest.java | 1025 ++++++++++++++++
...GridNearAtomicSingleUpdateFilterRequest.java | 226 ++++
.../GridNearAtomicSingleUpdateFuture.java | 135 ++-
...GridNearAtomicSingleUpdateInvokeRequest.java | 303 +++++
.../GridNearAtomicSingleUpdateRequest.java | 364 ++++++
.../dht/atomic/GridNearAtomicUpdateFuture.java | 42 +-
.../dht/atomic/GridNearAtomicUpdateRequest.java | 1092 ------------------
.../dht/preloader/GridDhtPreloader.java | 20 +
.../distributed/near/GridNearAtomicCache.java | 18 +-
.../processors/cache/query/CacheQuery.java | 1 -
.../processors/cache/query/CacheQueryType.java | 2 +-
.../cache/query/GridCacheQueryAdapter.java | 10 -
.../GridCacheQueryDetailMetricsAdapter.java | 248 ++++
.../query/GridCacheQueryDetailMetricsKey.java | 82 ++
.../query/GridCacheQueryFutureAdapter.java | 2 -
.../cache/query/GridCacheQueryManager.java | 149 ++-
.../query/GridCacheQueryMetricsAdapter.java | 27 +-
.../continuous/CacheContinuousQueryHandler.java | 4 +-
.../CacheContinuousQueryListener.java | 4 +-
.../continuous/CacheContinuousQueryManager.java | 6 +-
.../processors/query/GridQueryProcessor.java | 102 +-
.../internal/util/GridBoundedPriorityQueue.java | 68 ++
.../cache/VisorCacheQueryDetailMetrics.java | 167 +++
...sorCacheQueryDetailMetricsCollectorTask.java | 146 +++
.../VisorCacheResetQueryDetailMetricsTask.java | 71 ++
.../cache/VisorCacheResetQueryMetricsTask.java | 8 +-
.../internal/visor/util/VisorTaskUtils.java | 26 +-
.../resources/META-INF/classnames.properties | 2 +-
.../CacheAtomicSingleMessageCountSelfTest.java | 259 +++++
.../GridCacheAtomicMessageCountSelfTest.java | 24 +-
.../processors/cache/GridCacheTestEntryEx.java | 4 +-
.../IgniteCacheAtomicStopBusySelfTest.java | 10 +-
.../IgniteCacheP2pUnmarshallingErrorTest.java | 2 +-
...niteCacheClientNodeChangingTopologyTest.java | 22 +-
...eAtomicInvalidPartitionHandlingSelfTest.java | 2 +-
.../utils/GridBoundedPriorityQueueSelfTest.java | 114 ++
.../multijvm/IgniteCacheProcessProxy.java | 16 +
.../testsuites/IgniteLangSelfTestSuite.java | 4 +-
.../hadoop/fs/v1/IgniteHadoopFileSystem.java | 2 +-
.../hadoop/fs/v2/IgniteHadoopFileSystem.java | 2 +-
.../hadoop/delegate/HadoopDelegateUtils.java | 4 +-
...doopIgfsSecondaryFileSystemDelegateImpl.java | 3 +-
...opClientProtocolMultipleServersSelfTest.java | 24 +
...KerberosHadoopFileSystemFactorySelfTest.java | 3 +-
.../igfs/HadoopFIleSystemFactorySelfTest.java | 2 +-
...adoopIgfsSecondaryFileSystemTestAdapter.java | 3 +-
...oopSecondaryFileSystemConfigurationTest.java | 4 +-
...CacheAbstractQueryDetailMetricsSelfTest.java | 572 +++++++++
.../CacheAbstractQueryMetricsSelfTest.java | 305 +++--
.../CacheLocalQueryDetailMetricsSelfTest.java | 33 +
...edQueryDetailMetricsDistributedSelfTest.java | 33 +
...titionedQueryDetailMetricsLocalSelfTest.java | 33 +
...edQueryDetailMetricsDistributedSelfTest.java | 33 +
...plicatedQueryDetailMetricsLocalSelfTest.java | 33 +
.../IgniteCacheQuerySelfTestSuite2.java | 12 +
.../commands/cache/VisorCacheCommand.scala | 7 +-
pom.xml | 1 +
84 files changed, 7482 insertions(+), 2125 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/47fbba8f/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite2.java
----------------------------------------------------------------------
[22/50] [abbrv] ignite git commit: ignite-4154 Optimize amount of
data stored in discovery history Discovery history optimizations: - remove
discarded message for discovery pending messages - remove duplicated data
from TcpDiscoveryNodeAddedMessage.oldNo
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
index a4ff04b..90d6242 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
@@ -22,14 +22,19 @@ import java.nio.ByteBuffer;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
+import java.util.UUID;
+
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.GridDirectMap;
import org.apache.ignite.internal.GridDirectTransient;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
import org.apache.ignite.plugin.extensions.communication.MessageReader;
import org.apache.ignite.plugin.extensions.communication.MessageWriter;
import org.jetbrains.annotations.NotNull;
@@ -48,6 +53,10 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
private Map<Integer, GridDhtPartitionFullMap> parts;
/** */
+ @GridDirectMap(keyType = Integer.class, valueType = Integer.class)
+ private Map<Integer, Integer> dupPartsData;
+
+ /** */
private byte[] partsBytes;
/** Partitions update counters. */
@@ -61,6 +70,10 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
/** Topology version. */
private AffinityTopologyVersion topVer;
+ /** */
+ @GridDirectTransient
+ private transient boolean compress;
+
/**
* Required by {@link Externalizable}.
*/
@@ -84,6 +97,13 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
}
/**
+ * @param compress {@code True} if it is possible to use compression for message.
+ */
+ public void compress(boolean compress) {
+ this.compress = compress;
+ }
+
+ /**
* @return Local partitions.
*/
public Map<Integer, GridDhtPartitionFullMap> partitions() {
@@ -92,14 +112,34 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
/**
* @param cacheId Cache ID.
+ * @return {@code True} if message contains full map for given cache.
+ */
+ public boolean containsCache(int cacheId) {
+ return parts != null && parts.containsKey(cacheId);
+ }
+
+ /**
+ * @param cacheId Cache ID.
* @param fullMap Full partitions map.
+ * @param dupDataCache Optional ID of cache with the same partition state map.
*/
- public void addFullPartitionsMap(int cacheId, GridDhtPartitionFullMap fullMap) {
+ public void addFullPartitionsMap(int cacheId, GridDhtPartitionFullMap fullMap, @Nullable Integer dupDataCache) {
if (parts == null)
parts = new HashMap<>();
- if (!parts.containsKey(cacheId))
+ if (!parts.containsKey(cacheId)) {
parts.put(cacheId, fullMap);
+
+ if (dupDataCache != null) {
+ assert compress;
+ assert parts.containsKey(dupDataCache);
+
+ if (dupPartsData == null)
+ dupPartsData = new HashMap<>();
+
+ dupPartsData.put(cacheId, dupDataCache);
+ }
+ }
}
/**
@@ -132,11 +172,38 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
@Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
super.prepareMarshal(ctx);
- if (parts != null && partsBytes == null)
- partsBytes = U.marshal(ctx, parts);
+ boolean marshal = (parts != null && partsBytes == null) || (partCntrs != null && partCntrsBytes == null);
+
+ if (marshal) {
+ byte[] partsBytes0 = null;
+ byte[] partCntrsBytes0 = null;
+
+ if (parts != null && partsBytes == null)
+ partsBytes0 = U.marshal(ctx, parts);
- if (partCntrs != null && partCntrsBytes == null)
- partCntrsBytes = U.marshal(ctx, partCntrs);
+ if (partCntrs != null && partCntrsBytes == null)
+ partCntrsBytes0 = U.marshal(ctx, partCntrs);
+
+ if (compress) {
+ assert !compressed();
+
+ try {
+ byte[] partsBytesZip = U.zip(partsBytes0);
+ byte[] partCntrsBytesZip = U.zip(partCntrsBytes0);
+
+ partsBytes0 = partsBytesZip;
+ partCntrsBytes0 = partCntrsBytesZip;
+
+ compressed(true);
+ }
+ catch (IgniteCheckedException e) {
+ U.error(ctx.logger(getClass()), "Failed to compress partitions data: " + e, e);
+ }
+ }
+
+ partsBytes = partsBytes0;
+ partCntrsBytes = partCntrsBytes0;
+ }
}
/**
@@ -157,14 +224,49 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
@Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
super.finishUnmarshal(ctx, ldr);
- if (partsBytes != null && parts == null)
- parts = U.unmarshal(ctx, partsBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
+ if (partsBytes != null && parts == null) {
+ if (compressed())
+ parts = U.unmarshalZip(ctx.marshaller(), partsBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
+ else
+ parts = U.unmarshal(ctx, partsBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
+
+ if (dupPartsData != null) {
+ assert parts != null;
+
+ for (Map.Entry<Integer, Integer> e : dupPartsData.entrySet()) {
+ GridDhtPartitionFullMap map1 = parts.get(e.getKey());
+ GridDhtPartitionFullMap map2 = parts.get(e.getValue());
+
+ assert map1 != null : e.getKey();
+ assert map2 != null : e.getValue();
+ assert map1.size() == map2.size();
+
+ for (Map.Entry<UUID, GridDhtPartitionMap2> e0 : map2.entrySet()) {
+ GridDhtPartitionMap2 partMap1 = map1.get(e0.getKey());
+
+ assert partMap1 != null && partMap1.map().isEmpty() : partMap1;
+ assert !partMap1.hasMovingPartitions() : partMap1;
+
+ GridDhtPartitionMap2 partMap2 = e0.getValue();
+
+ assert partMap2 != null;
+
+ for (Map.Entry<Integer, GridDhtPartitionState> stateEntry : partMap2.entrySet())
+ partMap1.put(stateEntry.getKey(), stateEntry.getValue());
+ }
+ }
+ }
+ }
if (parts == null)
parts = new HashMap<>();
- if (partCntrsBytes != null && partCntrs == null)
- partCntrs = U.unmarshal(ctx, partCntrsBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
+ if (partCntrsBytes != null && partCntrs == null) {
+ if (compressed())
+ partCntrs = U.unmarshalZip(ctx.marshaller(), partCntrsBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
+ else
+ partCntrs = U.unmarshal(ctx, partCntrsBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
+ }
if (partCntrs == null)
partCntrs = new HashMap<>();
@@ -185,19 +287,25 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
}
switch (writer.state()) {
- case 5:
+ case 6:
+ if (!writer.writeMap("dupPartsData", dupPartsData, MessageCollectionItemType.INT, MessageCollectionItemType.INT))
+ return false;
+
+ writer.incrementState();
+
+ case 7:
if (!writer.writeByteArray("partCntrsBytes", partCntrsBytes))
return false;
writer.incrementState();
- case 6:
+ case 8:
if (!writer.writeByteArray("partsBytes", partsBytes))
return false;
writer.incrementState();
- case 7:
+ case 9:
if (!writer.writeMessage("topVer", topVer))
return false;
@@ -219,7 +327,15 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
return false;
switch (reader.state()) {
- case 5:
+ case 6:
+ dupPartsData = reader.readMap("dupPartsData", MessageCollectionItemType.INT, MessageCollectionItemType.INT, false);
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 7:
partCntrsBytes = reader.readByteArray("partCntrsBytes");
if (!reader.isLastRead())
@@ -227,7 +343,7 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
reader.incrementState();
- case 6:
+ case 8:
partsBytes = reader.readByteArray("partsBytes");
if (!reader.isLastRead())
@@ -235,7 +351,7 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
reader.incrementState();
- case 7:
+ case 9:
topVer = reader.readMessage("topVer");
if (!reader.isLastRead())
@@ -255,7 +371,7 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
/** {@inheritDoc} */
@Override public byte fieldsCount() {
- return 8;
+ return 10;
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
index e4356b1..bf08f0a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
@@ -23,12 +23,16 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.GridDirectMap;
import org.apache.ignite.internal.GridDirectTransient;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
import org.apache.ignite.plugin.extensions.communication.MessageReader;
import org.apache.ignite.plugin.extensions.communication.MessageWriter;
import org.jetbrains.annotations.Nullable;
@@ -45,6 +49,10 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
@GridDirectTransient
private Map<Integer, GridDhtPartitionMap2> parts;
+ /** */
+ @GridDirectMap(keyType = Integer.class, valueType = Integer.class)
+ private Map<Integer, Integer> dupPartsData;
+
/** Serialized partitions. */
private byte[] partsBytes;
@@ -59,6 +67,10 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
/** */
private boolean client;
+ /** */
+ @GridDirectTransient
+ private transient boolean compress;
+
/**
* Required by {@link Externalizable}.
*/
@@ -70,13 +82,16 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
* @param exchId Exchange ID.
* @param client Client message flag.
* @param lastVer Last version.
+ * @param compress {@code True} if it is possible to use compression for message.
*/
public GridDhtPartitionsSingleMessage(GridDhtPartitionExchangeId exchId,
boolean client,
- @Nullable GridCacheVersion lastVer) {
+ @Nullable GridCacheVersion lastVer,
+ boolean compress) {
super(exchId, lastVer);
this.client = client;
+ this.compress = compress;
}
/**
@@ -87,16 +102,26 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
}
/**
- * Adds partition map to this message.
- *
* @param cacheId Cache ID to add local partition for.
* @param locMap Local partition map.
+ * @param dupDataCache Optional ID of cache with the same partition state map.
*/
- public void addLocalPartitionMap(int cacheId, GridDhtPartitionMap2 locMap) {
+ public void addLocalPartitionMap(int cacheId, GridDhtPartitionMap2 locMap, @Nullable Integer dupDataCache) {
if (parts == null)
parts = new HashMap<>();
parts.put(cacheId, locMap);
+
+ if (dupDataCache != null) {
+ assert compress;
+ assert F.isEmpty(locMap.map());
+ assert parts.containsKey(dupDataCache);
+
+ if (dupPartsData == null)
+ dupPartsData = new HashMap<>();
+
+ dupPartsData.put(cacheId, dupDataCache);
+ }
}
/**
@@ -136,22 +161,77 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
@Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
super.prepareMarshal(ctx);
- if (partsBytes == null && parts != null)
- partsBytes = U.marshal(ctx, parts);
+ boolean marshal = (parts != null && partsBytes == null) || (partCntrs != null && partCntrsBytes == null);
+
+ if (marshal) {
+ byte[] partsBytes0 = null;
+ byte[] partCntrsBytes0 = null;
+
+ if (parts != null && partsBytes == null)
+ partsBytes0 = U.marshal(ctx, parts);
- if (partCntrsBytes == null && partCntrs != null)
- partCntrsBytes = U.marshal(ctx, partCntrs);
+ if (partCntrs != null && partCntrsBytes == null)
+ partCntrsBytes0 = U.marshal(ctx, partCntrs);
+
+ if (compress) {
+ assert !compressed();
+
+ try {
+ byte[] partsBytesZip = U.zip(partsBytes0);
+ byte[] partCntrsBytesZip = U.zip(partCntrsBytes0);
+
+ partsBytes0 = partsBytesZip;
+ partCntrsBytes0 = partCntrsBytesZip;
+
+ compressed(true);
+ }
+ catch (IgniteCheckedException e) {
+ U.error(ctx.logger(getClass()), "Failed to compress partitions data: " + e, e);
+ }
+ }
+
+ partsBytes = partsBytes0;
+ partCntrsBytes = partCntrsBytes0;
+ }
}
/** {@inheritDoc} */
@Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
super.finishUnmarshal(ctx, ldr);
- if (partsBytes != null && parts == null)
- parts = U.unmarshal(ctx, partsBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
+ if (partsBytes != null && parts == null) {
+ if (compressed())
+ parts = U.unmarshalZip(ctx.marshaller(), partsBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
+ else
+ parts = U.unmarshal(ctx, partsBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
+ }
+
+ if (partCntrsBytes != null && partCntrs == null) {
+ if (compressed())
+ partCntrs = U.unmarshalZip(ctx.marshaller(), partCntrsBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
+ else
+ partCntrs = U.unmarshal(ctx, partCntrsBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
+ }
+
+ if (dupPartsData != null) {
+ assert parts != null;
+
+ for (Map.Entry<Integer, Integer> e : dupPartsData.entrySet()) {
+ GridDhtPartitionMap2 map1 = parts.get(e.getKey());
- if (partCntrsBytes != null && partCntrs == null)
- partCntrs = U.unmarshal(ctx, partCntrsBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
+ assert map1 != null : e.getKey();
+ assert F.isEmpty(map1.map());
+ assert !map1.hasMovingPartitions();
+
+ GridDhtPartitionMap2 map2 = parts.get(e.getValue());
+
+ assert map2 != null : e.getValue();
+ assert map2.map() != null;
+
+ for (Map.Entry<Integer, GridDhtPartitionState> e0 : map2.map().entrySet())
+ map1.put(e0.getKey(), e0.getValue());
+ }
+ }
}
/** {@inheritDoc} */
@@ -169,19 +249,25 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
}
switch (writer.state()) {
- case 5:
+ case 6:
if (!writer.writeBoolean("client", client))
return false;
writer.incrementState();
- case 6:
+ case 7:
+ if (!writer.writeMap("dupPartsData", dupPartsData, MessageCollectionItemType.INT, MessageCollectionItemType.INT))
+ return false;
+
+ writer.incrementState();
+
+ case 8:
if (!writer.writeByteArray("partCntrsBytes", partCntrsBytes))
return false;
writer.incrementState();
- case 7:
+ case 9:
if (!writer.writeByteArray("partsBytes", partsBytes))
return false;
@@ -203,7 +289,7 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
return false;
switch (reader.state()) {
- case 5:
+ case 6:
client = reader.readBoolean("client");
if (!reader.isLastRead())
@@ -211,7 +297,15 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
reader.incrementState();
- case 6:
+ case 7:
+ dupPartsData = reader.readMap("dupPartsData", MessageCollectionItemType.INT, MessageCollectionItemType.INT, false);
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 8:
partCntrsBytes = reader.readByteArray("partCntrsBytes");
if (!reader.isLastRead())
@@ -219,7 +313,7 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
reader.incrementState();
- case 7:
+ case 9:
partsBytes = reader.readByteArray("partsBytes");
if (!reader.isLastRead())
@@ -239,7 +333,7 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
/** {@inheritDoc} */
@Override public byte fieldsCount() {
- return 8;
+ return 10;
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleRequest.java
index a4106af..850b6d8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleRequest.java
@@ -81,11 +81,11 @@ public class GridDhtPartitionsSingleRequest extends GridDhtPartitionsAbstractMes
/** {@inheritDoc} */
@Override public byte fieldsCount() {
- return 5;
+ return 6;
}
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(GridDhtPartitionsSingleRequest.class, this, super.toString());
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
index 09aec81..d6865c1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
@@ -35,8 +35,8 @@ import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.NodeStoppingException;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
import org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener;
+import org.apache.ignite.internal.processors.affinity.AffinityAssignment;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.affinity.GridAffinityAssignment;
import org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
@@ -600,7 +600,7 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
log.debug("Affinity is ready for topology version, will send response [topVer=" + topVer +
", node=" + node + ']');
- GridAffinityAssignment assignment = cctx.affinity().assignment(topVer);
+ AffinityAssignment assignment = cctx.affinity().assignment(topVer);
boolean newAffMode = node.version().compareTo(CacheAffinitySharedManager.LATE_AFF_ASSIGN_SINCE) >= 0;
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
index 3a559e7..9fd9b6d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
@@ -239,7 +239,7 @@ public class GridContinuousProcessor extends GridProcessorAdapter {
GridCacheContext cctx = interCache != null ? interCache.context() : null;
if (cctx != null && cntrsPerNode != null && !cctx.isLocal() && cctx.affinityNode())
- cntrsPerNode.put(ctx.localNodeId(), cctx.topology().updateCounters());
+ cntrsPerNode.put(ctx.localNodeId(), cctx.topology().updateCounters(false));
routine.handler().updateCounters(topVer, cntrsPerNode, cntrs);
}
@@ -1049,7 +1049,7 @@ public class GridContinuousProcessor extends GridProcessorAdapter {
GridCacheAdapter cache = ctx.cache().internalCache(hnd0.cacheName());
if (cache != null && !cache.isLocal() && cache.context().userCache())
- req.addUpdateCounters(ctx.localNodeId(), cache.context().topology().updateCounters());
+ req.addUpdateCounters(ctx.localNodeId(), cache.context().topology().updateCounters(false));
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
index 7b011dd..e0f4a2d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
@@ -19,6 +19,8 @@ package org.apache.ignite.internal.util;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.Externalizable;
@@ -128,6 +130,8 @@ import java.util.logging.Logger;
import java.util.regex.Pattern;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
+import java.util.zip.ZipInputStream;
+import java.util.zip.ZipOutputStream;
import javax.management.DynamicMBean;
import javax.management.JMException;
import javax.management.MBeanServer;
@@ -9693,6 +9697,32 @@ public abstract class IgniteUtils {
}
/**
+ * @param marsh Marshaller.
+ * @param zipBytes Zip-compressed bytes.
+ * @param clsLdr Class loader to use.
+ * @return Unmarshalled object.
+ * @throws IgniteCheckedException
+ */
+ public static <T> T unmarshalZip(Marshaller marsh, byte[] zipBytes, @Nullable ClassLoader clsLdr) throws IgniteCheckedException {
+ assert marsh != null;
+ assert zipBytes != null;
+
+ try {
+ ZipInputStream in = new ZipInputStream(new ByteArrayInputStream(zipBytes));
+
+ in.getNextEntry();
+
+ return marsh.unmarshal(in, clsLdr);
+ }
+ catch (IgniteCheckedException e) {
+ throw e;
+ }
+ catch (Exception e) {
+ throw new IgniteCheckedException(e);
+ }
+ }
+
+ /**
* Unmarshals object from the input stream using given class loader.
* This method should not close given input stream.
* <p/>
@@ -9907,4 +9937,38 @@ public abstract class IgniteUtils {
if (oldName != curName)
LOC_IGNITE_NAME.set(oldName);
}
+
+ /**
+ * @param bytes Byte array to compress.
+ * @return Compressed bytes.
+ * @throws IgniteCheckedException If failed.
+ */
+ public static byte[] zip(@Nullable byte[] bytes) throws IgniteCheckedException {
+ try {
+ if (bytes == null)
+ return null;
+
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+
+ try (ZipOutputStream zos = new ZipOutputStream(bos)) {
+ ZipEntry entry = new ZipEntry("");
+
+ try {
+ entry.setSize(bytes.length);
+
+ zos.putNextEntry(entry);
+
+ zos.write(bytes);
+ }
+ finally {
+ zos.closeEntry();
+ }
+ }
+
+ return bos.toByteArray();
+ }
+ catch (Exception e) {
+ throw new IgniteCheckedException(e);
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
index f929121..733d204 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
@@ -1049,7 +1049,7 @@ class ClientImpl extends TcpDiscoveryImpl {
/** {@inheritDoc} */
@Override protected void body() throws InterruptedException {
- TcpDiscoveryAbstractMessage msg = null;
+ TcpDiscoveryAbstractMessage msg;
while (!Thread.currentThread().isInterrupted()) {
Socket sock;
@@ -1063,8 +1063,7 @@ class ClientImpl extends TcpDiscoveryImpl {
continue;
}
- if (msg == null)
- msg = queue.poll();
+ msg = queue.poll();
if (msg == null) {
mux.wait();
@@ -1121,19 +1120,13 @@ class ClientImpl extends TcpDiscoveryImpl {
}
}
}
- catch (IOException e) {
+ catch (InterruptedException e) {
if (log.isDebugEnabled())
- U.error(log, "Failed to send node left message (will stop anyway) " +
- "[sock=" + sock + ", msg=" + msg + ']', e);
-
- U.closeQuiet(sock);
+ log.debug("Client socket writer interrupted.");
- synchronized (mux) {
- if (sock == this.sock)
- this.sock = null; // Connection has dead.
- }
+ return;
}
- catch (IgniteCheckedException e) {
+ catch (Exception e) {
if (spi.getSpiContext().isStopping()) {
if (log.isDebugEnabled())
log.debug("Failed to send message, node is stopping [msg=" + msg + ", err=" + e + ']');
@@ -1141,7 +1134,12 @@ class ClientImpl extends TcpDiscoveryImpl {
else
U.error(log, "Failed to send message: " + msg, e);
- msg = null;
+ U.closeQuiet(sock);
+
+ synchronized (mux) {
+ if (sock == this.sock)
+ this.sock = null; // Connection has dead.
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index 0de787d..8814745 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -133,7 +133,7 @@ import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentHashMap8;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_BINARY_MARSHALLER_USE_STRING_SERIALIZATION_VER_2;
-import static org.apache.ignite.IgniteSystemProperties.IGNITE_DISCOVERY_HISTORY_SIZE;
+import static org.apache.ignite.IgniteSystemProperties.IGNITE_DISCOVERY_CLIENT_RECONNECT_HISTORY_SIZE;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_OPTIMIZED_MARSHALLER_USE_DEFAULT_SUID;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_SERVICES_COMPATIBILITY_MODE;
import static org.apache.ignite.IgniteSystemProperties.getInteger;
@@ -167,7 +167,7 @@ import static org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryStatusChe
*/
class ServerImpl extends TcpDiscoveryImpl {
/** */
- private static final int ENSURED_MSG_HIST_SIZE = getInteger(IGNITE_DISCOVERY_HISTORY_SIZE, 1024);
+ private static final int ENSURED_MSG_HIST_SIZE = getInteger(IGNITE_DISCOVERY_CLIENT_RECONNECT_HISTORY_SIZE, 512);
/** */
private static final IgniteProductVersion CUSTOM_MSG_ALLOW_JOINING_FOR_VERIFIED_SINCE =
@@ -1479,7 +1479,7 @@ class ServerImpl extends TcpDiscoveryImpl {
private void prepareNodeAddedMessage(
TcpDiscoveryAbstractMessage msg,
UUID destNodeId,
- @Nullable Collection<TcpDiscoveryAbstractMessage> msgs,
+ @Nullable Collection<PendingMessage> msgs,
@Nullable IgniteUuid discardMsgId,
@Nullable IgniteUuid discardCustomMsgId
) {
@@ -1506,7 +1506,19 @@ class ServerImpl extends TcpDiscoveryImpl {
}
nodeAddedMsg.topology(topToSnd);
- nodeAddedMsg.messages(msgs, discardMsgId, discardCustomMsgId);
+
+ Collection<TcpDiscoveryAbstractMessage> msgs0 = null;
+
+ if (msgs != null) {
+ msgs0 = new ArrayList<>(msgs.size());
+
+ for (PendingMessage pendingMsg : msgs) {
+ if (pendingMsg.msg != null)
+ msgs0.add(pendingMsg.msg);
+ }
+ }
+
+ nodeAddedMsg.messages(msgs0, discardMsgId, discardCustomMsgId);
Map<Long, Collection<ClusterNode>> hist;
@@ -1892,7 +1904,10 @@ class ServerImpl extends TcpDiscoveryImpl {
assert spi.ensured(msg) && msg.verified() : msg;
if (msg instanceof TcpDiscoveryNodeAddedMessage) {
- TcpDiscoveryNodeAddedMessage addedMsg = (TcpDiscoveryNodeAddedMessage)msg;
+ TcpDiscoveryNodeAddedMessage addedMsg =
+ new TcpDiscoveryNodeAddedMessage((TcpDiscoveryNodeAddedMessage)msg);
+
+ msg = addedMsg;
TcpDiscoveryNode node = addedMsg.node();
@@ -1910,12 +1925,109 @@ class ServerImpl extends TcpDiscoveryImpl {
addedMsg.clientTopology(top);
}
+
+ // Do not need this data for client reconnect.
+ addedMsg.oldNodesDiscoveryData(null);
+ }
+ else if (msg instanceof TcpDiscoveryNodeAddFinishedMessage) {
+ TcpDiscoveryNodeAddFinishedMessage addFinishMsg = (TcpDiscoveryNodeAddFinishedMessage)msg;
+
+ if (addFinishMsg.clientDiscoData() != null) {
+ addFinishMsg = new TcpDiscoveryNodeAddFinishedMessage(addFinishMsg);
+
+ msg = addFinishMsg;
+
+ Map<UUID, Map<Integer, byte[]>> discoData = addFinishMsg.clientDiscoData();
+
+ Set<UUID> replaced = null;
+
+ for (TcpDiscoveryAbstractMessage msg0 : msgs) {
+ if (msg0 instanceof TcpDiscoveryNodeAddFinishedMessage) {
+ Map<UUID, Map<Integer, byte[]>> existingDiscoData =
+ ((TcpDiscoveryNodeAddFinishedMessage)msg0).clientDiscoData();
+
+ // Check if already stored message contains the same data to do not store copies multiple times.
+ if (existingDiscoData != null) {
+ for (Map.Entry<UUID, Map<Integer, byte[]>> e : discoData.entrySet()) {
+ UUID nodeId = e.getKey();
+
+ if (F.contains(replaced, nodeId))
+ continue;
+
+ Map<Integer, byte[]> existingData = existingDiscoData.get(e.getKey());
+
+ if (existingData != null && mapsEqual(e.getValue(), existingData)) {
+ e.setValue(existingData);
+
+ if (replaced == null)
+ replaced = new HashSet<>();
+
+ boolean add = replaced.add(nodeId);
+
+ assert add;
+
+ if (replaced.size() == discoData.size())
+ break;
+ }
+ }
+
+ if (replaced != null && replaced.size() == discoData.size())
+ break;
+ }
+ }
+ }
+ }
}
+ else if (msg instanceof TcpDiscoveryNodeLeftMessage)
+ clearClientAddFinished(msg.creatorNodeId());
+ else if (msg instanceof TcpDiscoveryNodeFailedMessage)
+ clearClientAddFinished(((TcpDiscoveryNodeFailedMessage)msg).failedNodeId());
msgs.add(msg);
}
/**
+ * @param clientId Client node ID.
+ */
+ private void clearClientAddFinished(UUID clientId) {
+ for (TcpDiscoveryAbstractMessage msg : msgs) {
+ if (msg instanceof TcpDiscoveryNodeAddFinishedMessage) {
+ TcpDiscoveryNodeAddFinishedMessage addFinishMsg = (TcpDiscoveryNodeAddFinishedMessage)msg;
+
+ if (addFinishMsg.clientDiscoData() != null && clientId.equals(addFinishMsg.nodeId())) {
+ addFinishMsg.clientDiscoData(null);
+ addFinishMsg.clientNodeAttributes(null);
+
+ break;
+ }
+ }
+ }
+ }
+
+ /**
+ * @param m1 Map 1.
+ * @param m2 Map 2.
+ * @return {@code True} if maps contain the same data.
+ */
+ private boolean mapsEqual(Map<Integer, byte[]> m1, Map<Integer, byte[]> m2) {
+ if (m1 == m2)
+ return true;
+
+ if (m1.size() == m2.size()) {
+ for (Map.Entry<Integer, byte[]> e : m1.entrySet()) {
+ byte[] data = m2.get(e.getKey());
+
+ if (!Arrays.equals(e.getValue(), data))
+ return false;
+ }
+
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
* Gets messages starting from provided ID (exclusive). If such
* message is not found, {@code null} is returned (this indicates
* a failure condition when it was already removed from queue).
@@ -2009,6 +2121,37 @@ class ServerImpl extends TcpDiscoveryImpl {
}
/**
+ *
+ */
+ private static class PendingMessage {
+ /** */
+ TcpDiscoveryAbstractMessage msg;
+
+ /** */
+ final boolean customMsg;
+
+ /** */
+ final IgniteUuid id;
+
+ /**
+ * @param msg Message.
+ */
+ PendingMessage(TcpDiscoveryAbstractMessage msg) {
+ assert msg != null && msg.id() != null : msg;
+
+ this.msg = msg;
+
+ id = msg.id();
+ customMsg = msg instanceof TcpDiscoveryCustomEventMessage;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(PendingMessage.class, this);
+ }
+ }
+
+ /**
* Pending messages container.
*/
private static class PendingMessages implements Iterable<TcpDiscoveryAbstractMessage> {
@@ -2016,7 +2159,7 @@ class ServerImpl extends TcpDiscoveryImpl {
private static final int MAX = 1024;
/** Pending messages. */
- private final Queue<TcpDiscoveryAbstractMessage> msgs = new ArrayDeque<>(MAX * 2);
+ private final Queue<PendingMessage> msgs = new ArrayDeque<>(MAX * 2);
/** Processed custom message IDs. */
private Set<IgniteUuid> procCustomMsgs = new GridBoundedLinkedHashSet<>(MAX * 2);
@@ -2024,7 +2167,7 @@ class ServerImpl extends TcpDiscoveryImpl {
/** Discarded message ID. */
private IgniteUuid discardId;
- /** Discarded message ID. */
+ /** Discarded custom message ID. */
private IgniteUuid customDiscardId;
/**
@@ -2034,14 +2177,14 @@ class ServerImpl extends TcpDiscoveryImpl {
* @param msg Message to add.
*/
void add(TcpDiscoveryAbstractMessage msg) {
- msgs.add(msg);
+ msgs.add(new PendingMessage(msg));
while (msgs.size() > MAX) {
- TcpDiscoveryAbstractMessage polled = msgs.poll();
+ PendingMessage polled = msgs.poll();
assert polled != null;
- if (polled.id().equals(discardId))
+ if (polled.id.equals(discardId))
break;
}
}
@@ -2051,6 +2194,7 @@ class ServerImpl extends TcpDiscoveryImpl {
*
* @param msgs Message.
* @param discardId Discarded message ID.
+ * @param customDiscardId Discarded custom event message ID.
*/
void reset(
@Nullable Collection<TcpDiscoveryAbstractMessage> msgs,
@@ -2059,8 +2203,10 @@ class ServerImpl extends TcpDiscoveryImpl {
) {
this.msgs.clear();
- if (msgs != null)
- this.msgs.addAll(msgs);
+ if (msgs != null) {
+ for (TcpDiscoveryAbstractMessage msg : msgs)
+ this.msgs.add(new PendingMessage(msg));
+ }
this.discardId = discardId;
this.customDiscardId = customDiscardId;
@@ -2070,12 +2216,52 @@ class ServerImpl extends TcpDiscoveryImpl {
* Discards message with provided ID and all before it.
*
* @param id Discarded message ID.
+ * @param custom {@code True} if discard for {@link TcpDiscoveryCustomEventMessage}.
*/
void discard(IgniteUuid id, boolean custom) {
if (custom)
customDiscardId = id;
else
discardId = id;
+
+ cleanup();
+ }
+
+ /**
+ *
+ */
+ void cleanup() {
+ Iterator<PendingMessage> msgIt = msgs.iterator();
+
+ boolean skipMsg = discardId != null;
+ boolean skipCustomMsg = customDiscardId != null;
+
+ while (msgIt.hasNext()) {
+ PendingMessage msg = msgIt.next();
+
+ if (msg.customMsg) {
+ if (skipCustomMsg) {
+ assert customDiscardId != null;
+
+ if (F.eq(customDiscardId, msg.id)) {
+ msg.msg = null;
+
+ return;
+ }
+ }
+ }
+ else {
+ if (skipMsg) {
+ assert discardId != null;
+
+ if (F.eq(discardId, msg.id)) {
+ msg.msg = null;
+
+ return;
+ }
+ }
+ }
+ }
}
/**
@@ -2098,7 +2284,7 @@ class ServerImpl extends TcpDiscoveryImpl {
private boolean skipCustomMsg = customDiscardId != null;
/** Internal iterator. */
- private Iterator<TcpDiscoveryAbstractMessage> msgIt = msgs.iterator();
+ private Iterator<PendingMessage> msgIt = msgs.iterator();
/** Next message. */
private TcpDiscoveryAbstractMessage next;
@@ -2136,13 +2322,13 @@ class ServerImpl extends TcpDiscoveryImpl {
next = null;
while (msgIt.hasNext()) {
- TcpDiscoveryAbstractMessage msg0 = msgIt.next();
+ PendingMessage msg0 = msgIt.next();
- if (msg0 instanceof TcpDiscoveryCustomEventMessage) {
+ if (msg0.customMsg) {
if (skipCustomMsg) {
assert customDiscardId != null;
- if (F.eq(customDiscardId, msg0.id()))
+ if (F.eq(customDiscardId, msg0.id))
skipCustomMsg = false;
continue;
@@ -2152,14 +2338,17 @@ class ServerImpl extends TcpDiscoveryImpl {
if (skipMsg) {
assert discardId != null;
- if (F.eq(discardId, msg0.id()))
+ if (F.eq(discardId, msg0.id))
skipMsg = false;
continue;
}
}
- next = msg0;
+ if (msg0.msg == null)
+ continue;
+
+ next = msg0.msg;
break;
}
@@ -2985,9 +3174,9 @@ class ServerImpl extends TcpDiscoveryImpl {
if (pendingMsgs.msgs.isEmpty())
return false;
- for (TcpDiscoveryAbstractMessage pendingMsg : pendingMsgs.msgs) {
- if (pendingMsg instanceof TcpDiscoveryNodeAddedMessage) {
- TcpDiscoveryNodeAddedMessage addMsg = (TcpDiscoveryNodeAddedMessage)pendingMsg;
+ for (PendingMessage pendingMsg : pendingMsgs.msgs) {
+ if (pendingMsg.msg instanceof TcpDiscoveryNodeAddedMessage) {
+ TcpDiscoveryNodeAddedMessage addMsg = (TcpDiscoveryNodeAddedMessage)pendingMsg.msg;
if (addMsg.node().id().equals(nodeId) && addMsg.id().compareTo(pendingMsgs.discardId) > 0)
return true;
@@ -3901,8 +4090,7 @@ class ServerImpl extends TcpDiscoveryImpl {
Map<Integer, byte[]> data = msg.newNodeDiscoveryData();
if (data != null)
- spi.onExchange(node.id(), node.id(), data,
- U.resolveClassLoader(spi.ignite().configuration()));
+ spi.onExchange(node.id(), node.id(), data, U.resolveClassLoader(spi.ignite().configuration()));
msg.addDiscoveryData(locNodeId, spi.collectExchangeData(node.id()));
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddFinishedMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddFinishedMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddFinishedMessage.java
index 1b99a56..80f4565 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddFinishedMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddFinishedMessage.java
@@ -59,6 +59,17 @@ public class TcpDiscoveryNodeAddFinishedMessage extends TcpDiscoveryAbstractMess
}
/**
+ * @param msg Message.
+ */
+ public TcpDiscoveryNodeAddFinishedMessage(TcpDiscoveryNodeAddFinishedMessage msg) {
+ super(msg);
+
+ nodeId = msg.nodeId;
+ clientDiscoData = msg.clientDiscoData;
+ clientNodeAttrs = msg.clientNodeAttrs;
+ }
+
+ /**
* Gets ID of the node added.
*
* @return ID of the node added.
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddedMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddedMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddedMessage.java
index 6f8e14e..bd52c04 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddedMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddedMessage.java
@@ -17,7 +17,9 @@
package org.apache.ignite.spi.discovery.tcp.messages;
+import java.util.Arrays;
import java.util.Collection;
+import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.UUID;
@@ -234,14 +236,41 @@ public class TcpDiscoveryNodeAddedMessage extends TcpDiscoveryAbstractMessage {
}
/**
+ * @param oldNodesDiscoData Discovery data from old nodes.
+ */
+ public void oldNodesDiscoveryData(Map<UUID, Map<Integer, byte[]>> oldNodesDiscoData) {
+ this.oldNodesDiscoData = oldNodesDiscoData;
+ }
+
+ /**
* @param nodeId Node ID.
* @param discoData Discovery data to add.
*/
public void addDiscoveryData(UUID nodeId, Map<Integer, byte[]> discoData) {
// Old nodes disco data may be null if message
// makes more than 1 pass due to stopping of the nodes in topology.
- if (oldNodesDiscoData != null)
- oldNodesDiscoData.put(nodeId, discoData);
+ if (oldNodesDiscoData != null) {
+ for (Map.Entry<UUID, Map<Integer, byte[]>> existingDataEntry : oldNodesDiscoData.entrySet()) {
+ Map<Integer, byte[]> existingData = existingDataEntry.getValue();
+
+ Iterator<Map.Entry<Integer, byte[]>> it = discoData.entrySet().iterator();
+
+ while (it.hasNext()) {
+ Map.Entry<Integer, byte[]> discoDataEntry = it.next();
+
+ byte[] curData = existingData.get(discoDataEntry.getKey());
+
+ if (Arrays.equals(curData, discoDataEntry.getValue()))
+ it.remove();
+ }
+
+ if (discoData.isEmpty())
+ break;
+ }
+
+ if (!discoData.isEmpty())
+ oldNodesDiscoData.put(nodeId, discoData);
+ }
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/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
new file mode 100644
index 0000000..ed186ac
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheExchangeMessageDuplicatedStateTest.java
@@ -0,0 +1,393 @@
+/*
+ * 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 java.util.Map;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.cache.affinity.fair.FairAffinityFunction;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
+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.GridDhtPartitionFullMap;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap2;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsFullMessage;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsSingleMessage;
+import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ *
+ */
+public class CacheExchangeMessageDuplicatedStateTest extends GridCommonAbstractTest {
+ /** */
+ private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+ /** */
+ private static final String AFF1_CACHE1 = "a1c1";
+
+ /** */
+ private static final String AFF1_CACHE2 = "a1c2";
+
+ /** */
+ private static final String AFF2_CACHE1 = "a2c1";
+
+ /** */
+ private static final String AFF2_CACHE2 = "a2c2";
+
+ /** */
+ private static final String AFF3_CACHE1 = "a3c1";
+
+ /** */
+ private static final String AFF4_FILTER_CACHE1 = "a4c1";
+
+ /** */
+ private static final String AFF4_FILTER_CACHE2 = "a4c2";
+
+ /** */
+ private static final String AFF5_FILTER_CACHE1 = "a5c1";
+
+ /** */
+ private boolean client;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
+
+ cfg.setClientMode(client);
+
+ TestRecordingCommunicationSpi commSpi = new TestRecordingCommunicationSpi();
+
+ commSpi.record(GridDhtPartitionsSingleMessage.class, GridDhtPartitionsFullMessage.class);
+
+ cfg.setCommunicationSpi(commSpi);
+
+ List<CacheConfiguration> ccfgs = new ArrayList<>();
+
+ {
+ CacheConfiguration ccfg = new CacheConfiguration();
+ ccfg.setName(AFF1_CACHE1);
+ ccfg.setAffinity(new RendezvousAffinityFunction());
+ ccfgs.add(ccfg);
+ }
+ {
+ CacheConfiguration ccfg = new CacheConfiguration();
+ ccfg.setName(AFF1_CACHE2);
+ ccfg.setAffinity(new RendezvousAffinityFunction());
+ ccfgs.add(ccfg);
+ }
+ {
+ CacheConfiguration ccfg = new CacheConfiguration();
+ ccfg.setName(AFF2_CACHE1);
+ ccfg.setAffinity(new FairAffinityFunction());
+ ccfgs.add(ccfg);
+ }
+ {
+ CacheConfiguration ccfg = new CacheConfiguration();
+ ccfg.setName(AFF2_CACHE2);
+ ccfg.setAffinity(new FairAffinityFunction());
+ ccfgs.add(ccfg);
+ }
+ {
+ CacheConfiguration ccfg = new CacheConfiguration();
+ ccfg.setName(AFF3_CACHE1);
+ ccfg.setBackups(3);
+
+ RendezvousAffinityFunction aff = new RendezvousAffinityFunction(false, 64);
+ ccfg.setAffinity(aff);
+
+ ccfgs.add(ccfg);
+ }
+ {
+ CacheConfiguration ccfg = new CacheConfiguration();
+ ccfg.setName(AFF4_FILTER_CACHE1);
+ ccfg.setNodeFilter(new TestNodeFilter());
+ ccfg.setAffinity(new RendezvousAffinityFunction());
+ ccfgs.add(ccfg);
+ }
+ {
+ CacheConfiguration ccfg = new CacheConfiguration();
+ ccfg.setName(AFF4_FILTER_CACHE2);
+ ccfg.setNodeFilter(new TestNodeFilter());
+ ccfg.setAffinity(new RendezvousAffinityFunction());
+ ccfgs.add(ccfg);
+ }
+ {
+ CacheConfiguration ccfg = new CacheConfiguration();
+ ccfg.setName(AFF5_FILTER_CACHE1);
+ ccfg.setNodeFilter(new TestNodeFilter());
+ ccfg.setAffinity(new FairAffinityFunction());
+ ccfgs.add(ccfg);
+ }
+
+ cfg.setCacheConfiguration(ccfgs.toArray(new CacheConfiguration[ccfgs.size()]));
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ super.beforeTestsStarted();
+
+ startGrid(0);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ stopAllGrids();
+
+ super.afterTestsStopped();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testExchangeMessages() throws Exception {
+ ignite(0);
+
+ startGrid(1);
+
+ awaitPartitionMapExchange();
+
+ checkMessages(0, true);
+
+ startGrid(2);
+
+ awaitPartitionMapExchange();
+
+ checkMessages(0, true);
+
+ client = true;
+
+ startGrid(3);
+
+ awaitPartitionMapExchange();
+
+ checkMessages(0, false);
+
+ stopGrid(0);
+
+ awaitPartitionMapExchange();
+
+ checkMessages(1, true);
+ }
+
+ /**
+ * @param crdIdx Coordinator node index.
+ * @param checkSingle {@code True} if need check single messages.
+ */
+ private void checkMessages(int crdIdx, boolean checkSingle) {
+ checkFullMessages(crdIdx);
+
+ if (checkSingle)
+ checkSingleMessages(crdIdx);
+ }
+
+ /**
+ * @param crdIdx Coordinator node index.
+ */
+ private void checkFullMessages(int crdIdx) {
+ TestRecordingCommunicationSpi commSpi0 =
+ (TestRecordingCommunicationSpi)ignite(crdIdx).configuration().getCommunicationSpi();
+
+ List<Object> msgs = commSpi0.recordedMessages(false);
+
+ assertTrue(msgs.size() > 0);
+
+ for (Object msg : msgs) {
+ assertTrue("Unexpected messages: " + msg, msg instanceof GridDhtPartitionsFullMessage);
+
+ checkFullMessage((GridDhtPartitionsFullMessage)msg);
+ }
+ }
+
+ /**
+ * @param crdIdx Coordinator node index.
+ */
+ private void checkSingleMessages(int crdIdx) {
+ int cnt = 0;
+
+ for (Ignite ignite : Ignition.allGrids()) {
+ if (getTestGridName(crdIdx).equals(ignite.name()) || ignite.configuration().isClientMode())
+ continue;
+
+ TestRecordingCommunicationSpi commSpi0 =
+ (TestRecordingCommunicationSpi)ignite.configuration().getCommunicationSpi();
+
+ List<Object> msgs = commSpi0.recordedMessages(false);
+
+ assertTrue(msgs.size() > 0);
+
+ for (Object msg : msgs) {
+ assertTrue("Unexpected messages: " + msg, msg instanceof GridDhtPartitionsSingleMessage);
+
+ checkSingleMessage((GridDhtPartitionsSingleMessage)msg);
+ }
+
+ cnt++;
+ }
+
+ assertTrue(cnt > 0);
+ }
+
+ /**
+ * @param msg Message.
+ */
+ private void checkFullMessage(GridDhtPartitionsFullMessage msg) {
+ Map<Integer, Integer> dupPartsData = GridTestUtils.getFieldValue(msg, "dupPartsData");
+
+ assertNotNull(dupPartsData);
+
+ checkFullMessage(AFF1_CACHE1, AFF1_CACHE2, dupPartsData, msg);
+ checkFullMessage(AFF2_CACHE1, AFF2_CACHE2, dupPartsData, msg);
+ checkFullMessage(AFF4_FILTER_CACHE1, AFF4_FILTER_CACHE2, dupPartsData, msg);
+
+ assertFalse(dupPartsData.containsKey(CU.cacheId(AFF3_CACHE1)));
+ assertFalse(dupPartsData.containsKey(CU.cacheId(AFF5_FILTER_CACHE1)));
+
+ Map<Integer, Map<Integer, Long>> partCntrs = GridTestUtils.getFieldValue(msg, "partCntrs");
+
+ if (partCntrs != null) {
+ for (Map<Integer, Long> cntrs : partCntrs.values())
+ assertTrue(cntrs.isEmpty());
+ }
+ }
+
+ /**
+ * @param msg Message.
+ */
+ private void checkSingleMessage(GridDhtPartitionsSingleMessage msg) {
+ Map<Integer, Integer> dupPartsData = GridTestUtils.getFieldValue(msg, "dupPartsData");
+
+ assertNotNull(dupPartsData);
+
+ checkSingleMessage(AFF1_CACHE1, AFF1_CACHE2, dupPartsData, msg);
+ checkSingleMessage(AFF2_CACHE1, AFF2_CACHE2, dupPartsData, msg);
+ checkSingleMessage(AFF4_FILTER_CACHE1, AFF4_FILTER_CACHE2, dupPartsData, msg);
+
+ assertFalse(dupPartsData.containsKey(CU.cacheId(AFF3_CACHE1)));
+ assertFalse(dupPartsData.containsKey(CU.cacheId(AFF5_FILTER_CACHE1)));
+
+ Map<Integer, Map<Integer, Long>> partCntrs = GridTestUtils.getFieldValue(msg, "partCntrs");
+
+ if (partCntrs != null) {
+ for (Map<Integer, Long> cntrs : partCntrs.values())
+ assertTrue(cntrs.isEmpty());
+ }
+ }
+
+ /**
+ * @param cache1 Cache 1.
+ * @param cache2 Cache 2.
+ * @param dupPartsData Duplicated data map.
+ * @param msg Message.
+ */
+ private void checkFullMessage(String cache1,
+ String cache2,
+ Map<Integer, Integer> dupPartsData,
+ GridDhtPartitionsFullMessage msg)
+ {
+ Integer cacheId;
+ Integer dupCacheId;
+
+ if (dupPartsData.containsKey(CU.cacheId(cache1))) {
+ cacheId = CU.cacheId(cache1);
+ dupCacheId = CU.cacheId(cache2);
+ }
+ else {
+ cacheId = CU.cacheId(cache2);
+ dupCacheId = CU.cacheId(cache1);
+ }
+
+ assertTrue(dupPartsData.containsKey(cacheId));
+ assertEquals(dupCacheId, dupPartsData.get(cacheId));
+ assertFalse(dupPartsData.containsKey(dupCacheId));
+
+ Map<Integer, GridDhtPartitionFullMap> parts = msg.partitions();
+
+ GridDhtPartitionFullMap emptyFullMap = parts.get(cacheId);
+
+ for (GridDhtPartitionMap2 map : emptyFullMap.values())
+ assertEquals(0, map.map().size());
+
+ GridDhtPartitionFullMap fullMap = parts.get(dupCacheId);
+
+ for (GridDhtPartitionMap2 map : fullMap.values())
+ assertFalse(map.map().isEmpty());
+ }
+
+ /**
+ * @param cache1 Cache 1.
+ * @param cache2 Cache 2.
+ * @param dupPartsData Duplicated data map.
+ * @param msg Message.
+ */
+ private void checkSingleMessage(String cache1,
+ String cache2,
+ Map<Integer, Integer> dupPartsData,
+ GridDhtPartitionsSingleMessage msg)
+ {
+ Integer cacheId;
+ Integer dupCacheId;
+
+ if (dupPartsData.containsKey(CU.cacheId(cache1))) {
+ cacheId = CU.cacheId(cache1);
+ dupCacheId = CU.cacheId(cache2);
+ }
+ else {
+ cacheId = CU.cacheId(cache2);
+ dupCacheId = CU.cacheId(cache1);
+ }
+
+ assertTrue(dupPartsData.containsKey(cacheId));
+ assertEquals(dupCacheId, dupPartsData.get(cacheId));
+ assertFalse(dupPartsData.containsKey(dupCacheId));
+
+ Map<Integer, GridDhtPartitionMap2> parts = msg.partitions();
+
+ GridDhtPartitionMap2 emptyMap = parts.get(cacheId);
+
+ assertEquals(0, emptyMap.map().size());
+
+ GridDhtPartitionMap2 map = parts.get(dupCacheId);
+
+ assertFalse(map.map().isEmpty());
+ }
+
+ /**
+ *
+ */
+ private static class TestNodeFilter implements IgnitePredicate<ClusterNode> {
+ /** {@inheritDoc} */
+ @Override public boolean apply(ClusterNode node) {
+ // Do not start cache on coordinator.
+ return node.order() > 1;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePeekModesAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePeekModesAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePeekModesAbstractTest.java
index 5dc059b..6c577c6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePeekModesAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePeekModesAbstractTest.java
@@ -630,7 +630,7 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra
if (cacheMode() == LOCAL)
return;
- awaitPartitionMapExchange(true, true);
+ awaitPartitionMapExchange(true, true, null);
checkEmpty();
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheGetRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheGetRestartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheGetRestartTest.java
index 71d1182..3b0c2fa 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheGetRestartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheGetRestartTest.java
@@ -33,6 +33,7 @@ import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
@@ -72,6 +73,8 @@ public class IgniteCacheGetRestartTest extends GridCommonAbstractTest {
((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
+ ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
+
Boolean clientMode = client.get();
if (clientMode != null) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRabalancingDelayedPartitionMapExchangeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRabalancingDelayedPartitionMapExchangeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRabalancingDelayedPartitionMapExchangeSelfTest.java
index 2c47a1c..7b57d5f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRabalancingDelayedPartitionMapExchangeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRabalancingDelayedPartitionMapExchangeSelfTest.java
@@ -115,21 +115,21 @@ public class GridCacheRabalancingDelayedPartitionMapExchangeSelfTest extends Gri
startGrid(2);
startGrid(3);
- awaitPartitionMapExchange(true, true);
+ awaitPartitionMapExchange(true, true, null);
for (int i = 0; i < 2; i++) {
stopGrid(3);
- awaitPartitionMapExchange(true, true);
+ awaitPartitionMapExchange(true, true, null);
startGrid(3);
- awaitPartitionMapExchange(true, true);
+ awaitPartitionMapExchange(true, true, null);
}
startGrid(4);
- awaitPartitionMapExchange(true, true);
+ awaitPartitionMapExchange(true, true, null);
assert rs.isEmpty();
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java
index 5716d59..de38952 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java
@@ -240,7 +240,7 @@ public class GridCacheRebalancingSyncSelfTest extends GridCommonAbstractTest {
waitForRebalancing(0, new AffinityTopologyVersion(2, waitMinorVer));
waitForRebalancing(1, new AffinityTopologyVersion(2, waitMinorVer));
- awaitPartitionMapExchange(true, true);
+ awaitPartitionMapExchange(true, true, null);
checkPartitionMapExchangeFinished();
@@ -250,7 +250,7 @@ public class GridCacheRebalancingSyncSelfTest extends GridCommonAbstractTest {
waitForRebalancing(1, 3);
- awaitPartitionMapExchange(true, true);
+ awaitPartitionMapExchange(true, true, null);
checkPartitionMapExchangeFinished();
@@ -261,7 +261,7 @@ public class GridCacheRebalancingSyncSelfTest extends GridCommonAbstractTest {
waitForRebalancing(1, new AffinityTopologyVersion(4, waitMinorVer));
waitForRebalancing(2, new AffinityTopologyVersion(4, waitMinorVer));
- awaitPartitionMapExchange(true, true);
+ awaitPartitionMapExchange(true, true, null);
checkPartitionMapExchangeFinished();
@@ -271,7 +271,7 @@ public class GridCacheRebalancingSyncSelfTest extends GridCommonAbstractTest {
waitForRebalancing(1, 5);
- awaitPartitionMapExchange(true, true);
+ awaitPartitionMapExchange(true, true, null);
checkPartitionMapExchangeFinished();
@@ -339,7 +339,7 @@ public class GridCacheRebalancingSyncSelfTest extends GridCommonAbstractTest {
concurrentStartFinished = true;
- awaitPartitionMapExchange(true, true);
+ awaitPartitionMapExchange(true, true, null);
checkSupplyContextMapIsEmpty();
@@ -607,7 +607,7 @@ public class GridCacheRebalancingSyncSelfTest extends GridCommonAbstractTest {
waitForRebalancing(3, 5, 1);
waitForRebalancing(4, 5, 1);
- awaitPartitionMapExchange(true, true);
+ awaitPartitionMapExchange(true, true, null);
checkSupplyContextMapIsEmpty();
@@ -631,7 +631,7 @@ public class GridCacheRebalancingSyncSelfTest extends GridCommonAbstractTest {
waitForRebalancing(3, 6);
waitForRebalancing(4, 6);
- awaitPartitionMapExchange(true, true);
+ awaitPartitionMapExchange(true, true, null);
checkSupplyContextMapIsEmpty();
@@ -641,7 +641,7 @@ public class GridCacheRebalancingSyncSelfTest extends GridCommonAbstractTest {
waitForRebalancing(3, 7);
waitForRebalancing(4, 7);
- awaitPartitionMapExchange(true, true);
+ awaitPartitionMapExchange(true, true, null);
checkSupplyContextMapIsEmpty();
@@ -650,7 +650,7 @@ public class GridCacheRebalancingSyncSelfTest extends GridCommonAbstractTest {
waitForRebalancing(3, 8);
waitForRebalancing(4, 8);
- awaitPartitionMapExchange(true, true);
+ awaitPartitionMapExchange(true, true, null);
checkPartitionMapExchangeFinished();
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheSyncReplicatedPreloadSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheSyncReplicatedPreloadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheSyncReplicatedPreloadSelfTest.java
index 87d02a5..cde6b8d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheSyncReplicatedPreloadSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheSyncReplicatedPreloadSelfTest.java
@@ -41,9 +41,6 @@ public class GridCacheSyncReplicatedPreloadSelfTest extends GridCommonAbstractTe
/** */
private TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
- /** */
- private static final boolean DISCO_DEBUG_MODE = false;
-
/**
* Constructs test.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheSyncRebalanceModeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheSyncRebalanceModeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheSyncRebalanceModeSelfTest.java
index 9b0637e..f3942d5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheSyncRebalanceModeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheSyncRebalanceModeSelfTest.java
@@ -34,7 +34,9 @@ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
public class IgniteCacheSyncRebalanceModeSelfTest extends GridCommonAbstractTest {
/** Entry count. */
public static final int CNT = 100_000;
- public static final String STATIC_CACHE_NAME = "static";
+
+ /** */
+ private static final String STATIC_CACHE_NAME = "static";
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
index 1b7fe2b..d2cb710 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
@@ -537,7 +537,7 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
Affinity<Object> aff = grid(i).affinity(null);
- Map<Integer, Long> act = grid(i).cachex(null).context().topology().updateCounters();
+ Map<Integer, Long> act = grid(i).cachex(null).context().topology().updateCounters(false);
for (Map.Entry<Integer, Long> e : updCntrs.entrySet()) {
if (aff.mapPartitionToPrimaryAndBackups(e.getKey()).contains(grid(i).localNode()))
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/IgniteNoCustomEventsOnNodeStart.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/IgniteNoCustomEventsOnNodeStart.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/IgniteNoCustomEventsOnNodeStart.java
index 5ecc27a..1259faf 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/IgniteNoCustomEventsOnNodeStart.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/IgniteNoCustomEventsOnNodeStart.java
@@ -68,6 +68,13 @@ public class IgniteNoCustomEventsOnNodeStart extends GridCommonAbstractTest {
assertFalse(failed);
}
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+
+ super.afterTest();
+ }
+
/**
*
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
index 1ce98a5..043208c 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
@@ -49,6 +49,7 @@ import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.DiscoveryEvent;
import org.apache.ignite.events.Event;
import org.apache.ignite.events.EventType;
+import org.apache.ignite.internal.GridComponent;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteKernal;
@@ -114,6 +115,12 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
/** */
private GridStringLogger strLog;
+ /** */
+ private CacheConfiguration[] ccfgs;
+
+ /** */
+ private boolean client;
+
/**
* @throws Exception If fails.
*/
@@ -152,7 +159,10 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
cfg.setDiscoverySpi(spi);
- cfg.setCacheConfiguration();
+ if (ccfgs != null)
+ cfg.setCacheConfiguration(ccfgs);
+ else
+ cfg.setCacheConfiguration();
cfg.setIncludeEventTypes(EVT_TASK_FAILED, EVT_TASK_FINISHED, EVT_JOB_MAPPED);
@@ -194,9 +204,8 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
}
else if (gridName.contains("testPingInterruptedOnNodeFailedPingingNode"))
cfg.setFailureDetectionTimeout(30_000);
- else if (gridName.contains("testNoRingMessageWorkerAbnormalFailureNormalNode")) {
+ else if (gridName.contains("testNoRingMessageWorkerAbnormalFailureNormalNode"))
cfg.setFailureDetectionTimeout(3_000);
- }
else if (gridName.contains("testNoRingMessageWorkerAbnormalFailureSegmentedNode")) {
cfg.setFailureDetectionTimeout(6_000);
@@ -205,6 +214,8 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
else if (gridName.contains("testNodeShutdownOnRingMessageWorkerFailureFailedNode"))
cfg.setGridLogger(strLog = new GridStringLogger());
+ cfg.setClientMode(client);
+
return cfg;
}
@@ -1961,6 +1972,63 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
}
/**
+ * @throws Exception If failed.
+ */
+ public void testDuplicatedDiscoveryDataRemoved() throws Exception {
+ try {
+ TestDiscoveryDataDuplicateSpi.checkNodeAdded = false;
+ TestDiscoveryDataDuplicateSpi.checkClientNodeAddFinished = false;
+ TestDiscoveryDataDuplicateSpi.fail = false;
+
+ ccfgs = new CacheConfiguration[5];
+
+ for (int i = 0; i < ccfgs.length; i++) {
+ CacheConfiguration ccfg = new CacheConfiguration();
+
+ ccfg.setName(i == 0 ? null : ("static-cache-" + i));
+
+ ccfgs[i] = ccfg;
+ }
+
+ TestDiscoveryDataDuplicateSpi spi = new TestDiscoveryDataDuplicateSpi();
+
+ nodeSpi.set(spi);
+
+ startGrid(0);
+
+ for (int i = 0; i < 5; i++) {
+ nodeSpi.set(new TestDiscoveryDataDuplicateSpi());
+
+ startGrid(i + 1);
+ }
+
+ client = true;
+
+ Ignite clientNode = startGrid(6);
+
+ assertTrue(clientNode.configuration().isClientMode());
+
+ CacheConfiguration ccfg = new CacheConfiguration();
+ ccfg.setName("c1");
+
+ clientNode.createCache(ccfg);
+
+ client = false;
+
+ nodeSpi.set(new TestDiscoveryDataDuplicateSpi());
+
+ startGrid(7);
+
+ assertTrue(TestDiscoveryDataDuplicateSpi.checkNodeAdded);
+ assertTrue(TestDiscoveryDataDuplicateSpi.checkClientNodeAddFinished);
+ assertFalse(TestDiscoveryDataDuplicateSpi.fail);
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
* @param nodeName Node name.
* @throws Exception If failed.
*/
@@ -2015,6 +2083,66 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
}
}
+ /**
+ *
+ */
+ private static class TestDiscoveryDataDuplicateSpi extends TcpDiscoverySpi {
+ /** */
+ static volatile boolean fail;
+
+ /** */
+ static volatile boolean checkNodeAdded;
+
+ /** */
+ static volatile boolean checkClientNodeAddFinished;
+
+ /** {@inheritDoc} */
+ @Override protected void writeToSocket(Socket sock, OutputStream out,
+ TcpDiscoveryAbstractMessage msg,
+ long timeout) throws IOException, IgniteCheckedException {
+ if (msg instanceof TcpDiscoveryNodeAddedMessage) {
+ Map<UUID, Map<Integer, byte[]>> discoData = ((TcpDiscoveryNodeAddedMessage)msg).oldNodesDiscoveryData();
+
+ checkDiscoData(discoData, msg);
+ }
+ else if (msg instanceof TcpDiscoveryNodeAddFinishedMessage) {
+ Map<UUID, Map<Integer, byte[]>> discoData = ((TcpDiscoveryNodeAddFinishedMessage)msg).clientDiscoData();
+
+ checkDiscoData(discoData, msg);
+ }
+
+ super.writeToSocket(sock, out, msg, timeout);
+ }
+
+ /**
+ * @param discoData Discovery data.
+ * @param msg Message.
+ */
+ private void checkDiscoData(Map<UUID, Map<Integer, byte[]>> discoData, TcpDiscoveryAbstractMessage msg) {
+ if (discoData != null && discoData.size() > 1) {
+ int cnt = 0;
+
+ for (Map.Entry<UUID, Map<Integer, byte[]>> e : discoData.entrySet()) {
+ Map<Integer, byte[]> map = e.getValue();
+
+ if (map.containsKey(GridComponent.DiscoveryDataExchangeType.CACHE_PROC.ordinal()))
+ cnt++;
+ }
+
+ if (cnt > 1) {
+ fail = true;
+
+ log.error("Expect cache data only from one node, but actually: " + cnt);
+ }
+
+ if (msg instanceof TcpDiscoveryNodeAddedMessage)
+ checkNodeAdded = true;
+ else if (msg instanceof TcpDiscoveryNodeAddFinishedMessage)
+ checkClientNodeAddFinished = true;
+ }
+ }
+ }
+
/**
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
index 87509a4..22fa36d 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
@@ -428,21 +428,42 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
*/
@SuppressWarnings("BusyWait")
protected void awaitPartitionMapExchange() throws InterruptedException {
- awaitPartitionMapExchange(false, false);
+ awaitPartitionMapExchange(false, false, null);
}
/**
* @param waitEvicts If {@code true} will wait for evictions finished.
* @param waitNode2PartUpdate If {@code true} will wait for nodes node2part info update finished.
+ * @param nodes Optional nodes.
* @throws InterruptedException If interrupted.
*/
@SuppressWarnings("BusyWait")
- protected void awaitPartitionMapExchange(boolean waitEvicts, boolean waitNode2PartUpdate) throws InterruptedException {
+ protected void awaitPartitionMapExchange(boolean waitEvicts,
+ boolean waitNode2PartUpdate,
+ @Nullable Collection<ClusterNode> nodes)
+ throws InterruptedException {
long timeout = 30_000;
+ long startTime = -1;
+
+ Set<String> names = new HashSet<>();
+
for (Ignite g : G.allGrids()) {
+ if (nodes != null && !nodes.contains(g.cluster().localNode()))
+ continue;
+
IgniteKernal g0 = (IgniteKernal)g;
+ names.add(g0.configuration().getGridName());
+
+ if (startTime != -1) {
+ if (startTime != g0.context().discovery().gridStartTime())
+ fail("Found nodes from different clusters, probable some test does not stop nodes " +
+ "[allNodes=" + names + ']');
+ }
+ else
+ startTime = g0.context().discovery().gridStartTime();
+
for (IgniteCacheProxy<?, ?> c : g0.context().cache().jcaches()) {
CacheConfiguration cfg = c.context().config();
[06/50] [abbrv] ignite git commit: ignite-4044 always authenticate
local node
Posted by sb...@apache.org.
ignite-4044 always authenticate local node
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/bac0cba7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/bac0cba7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/bac0cba7
Branch: refs/heads/master
Commit: bac0cba7fddd412dfbff98163afbc15d81d5e0d4
Parents: cdae2ab
Author: Dmitriy Govorukhin <dg...@gridgain.com>
Authored: Thu Nov 10 09:02:41 2016 +0300
Committer: Dmitriy Govorukhin <dg...@gridgain.com>
Committed: Thu Nov 10 09:02:41 2016 +0300
----------------------------------------------------------------------
.../ignite/spi/discovery/tcp/ServerImpl.java | 112 +++++++++++++++----
1 file changed, 89 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/bac0cba7/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index 55e5c89..0de787d 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -815,33 +815,24 @@ class ServerImpl extends TcpDiscoveryImpl {
SecurityCredentials locCred = (SecurityCredentials)locNode.getAttributes()
.get(IgniteNodeAttributes.ATTR_SECURITY_CREDENTIALS);
+ boolean auth = false;
+
+ if (spi.nodeAuth != null && spi.nodeAuth.isGlobalNodeAuthentication()) {
+ localAuthentication(locCred);
+
+ auth = true;
+ }
+
// Marshal credentials for backward compatibility and security.
- marshalCredentials(locNode);
+ marshalCredentials(locNode, locCred);
while (true) {
if (!sendJoinRequestMessage()) {
if (log.isDebugEnabled())
log.debug("Join request message has not been sent (local node is the first in the topology).");
- if (spi.nodeAuth != null) {
- // Authenticate local node.
- try {
- SecurityContext subj = spi.nodeAuth.authenticateNode(locNode, locCred);
-
- if (subj == null)
- throw new IgniteSpiException("Authentication failed for local node: " + locNode.id());
-
- Map<String, Object> attrs = new HashMap<>(locNode.attributes());
-
- attrs.put(IgniteNodeAttributes.ATTR_SECURITY_SUBJECT, U.marshal(spi.marshaller(), subj));
- attrs.remove(IgniteNodeAttributes.ATTR_SECURITY_CREDENTIALS);
-
- locNode.setAttributes(attrs);
- }
- catch (IgniteException | IgniteCheckedException e) {
- throw new IgniteSpiException("Failed to authenticate local node (will shutdown local node).", e);
- }
- }
+ if (!auth && spi.nodeAuth != null)
+ localAuthentication(locCred);
locNode.order(1);
locNode.internalOrder(1);
@@ -920,6 +911,8 @@ class ServerImpl extends TcpDiscoveryImpl {
}
}
+ locNode.attributes().remove(IgniteNodeAttributes.ATTR_SECURITY_CREDENTIALS);
+
assert locNode.order() != 0;
assert locNode.internalOrder() != 0;
@@ -928,6 +921,33 @@ class ServerImpl extends TcpDiscoveryImpl {
}
/**
+ * Authenticate local node.
+ *
+ * @param locCred Local security credentials for authentication.
+ * @throws IgniteSpiException If any error occurs.
+ */
+ private void localAuthentication(SecurityCredentials locCred){
+ assert spi.nodeAuth != null;
+ assert locCred != null;
+
+ try {
+ SecurityContext subj = spi.nodeAuth.authenticateNode(locNode, locCred);
+
+ if (subj == null)
+ throw new IgniteSpiException("Authentication failed for local node: " + locNode.id());
+
+ Map<String, Object> attrs = new HashMap<>(locNode.attributes());
+
+ attrs.put(IgniteNodeAttributes.ATTR_SECURITY_SUBJECT, U.marshal(spi.marshaller(), subj));
+
+ locNode.setAttributes(attrs);
+
+ } catch (IgniteException | IgniteCheckedException e) {
+ throw new IgniteSpiException("Failed to authenticate local node (will shutdown local node).", e);
+ }
+ }
+
+ /**
* Tries to send join request message to a random node presenting in topology.
* Address is provided by {@link org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder} and message is
* sent to first node connection succeeded to.
@@ -1241,15 +1261,15 @@ class ServerImpl extends TcpDiscoveryImpl {
* Marshalls credentials with discovery SPI marshaller (will replace attribute value).
*
* @param node Node to marshall credentials for.
+ * @param cred Credentials for marshall.
* @throws IgniteSpiException If marshalling failed.
*/
- private void marshalCredentials(TcpDiscoveryNode node) throws IgniteSpiException {
+ private void marshalCredentials(TcpDiscoveryNode node, SecurityCredentials cred) throws IgniteSpiException {
try {
// Use security-unsafe getter.
Map<String, Object> attrs = new HashMap<>(node.getAttributes());
- attrs.put(IgniteNodeAttributes.ATTR_SECURITY_CREDENTIALS,
- U.marshal(spi.marshaller(), attrs.get(IgniteNodeAttributes.ATTR_SECURITY_CREDENTIALS)));
+ attrs.put(IgniteNodeAttributes.ATTR_SECURITY_CREDENTIALS, spi.marshaller().marshal(cred));
node.setAttributes(attrs);
}
@@ -3906,6 +3926,52 @@ class ServerImpl extends TcpDiscoveryImpl {
if (top != null && !top.isEmpty()) {
spi.gridStartTime = msg.gridStartTime();
+ if (spi.nodeAuth != null && spi.nodeAuth.isGlobalNodeAuthentication()) {
+ TcpDiscoveryAbstractMessage authFail =
+ new TcpDiscoveryAuthFailedMessage(locNodeId, spi.locHost);
+
+ try {
+ ClassLoader cl = U.resolveClassLoader(spi.ignite().configuration());
+
+ byte[] rmSubj = node.attribute(IgniteNodeAttributes.ATTR_SECURITY_SUBJECT);
+ byte[] locSubj = locNode.attribute(IgniteNodeAttributes.ATTR_SECURITY_SUBJECT);
+
+ SecurityContext rmCrd = spi.marshaller().unmarshal(rmSubj, cl);
+ SecurityContext locCrd = spi.marshaller().unmarshal(locSubj, cl);
+
+ if (!permissionsEqual(locCrd.subject().permissions(),
+ rmCrd.subject().permissions())) {
+ // Node has not pass authentication.
+ LT.warn(log,
+ null,
+ "Failed to authenticate local node " +
+ "(local authentication result is different from rest of topology) " +
+ "[nodeId=" + node.id() + ", addrs=" + U.addressesAsString(node) + ']',
+ "Authentication failed [nodeId=" + U.id8(node.id()) +
+ ", addrs=" + U.addressesAsString(node) + ']');
+
+ joinRes.set(authFail);
+
+ spiState = AUTH_FAILED;
+
+ mux.notifyAll();
+
+ return;
+ }
+ }
+ catch (IgniteCheckedException e) {
+ U.error(log, "Failed to verify node permissions consistency (will drop the node): " + node, e);
+
+ joinRes.set(authFail);
+
+ spiState = AUTH_FAILED;
+
+ mux.notifyAll();
+
+ return;
+ }
+ }
+
for (TcpDiscoveryNode n : top) {
assert n.internalOrder() < node.internalOrder() :
"Invalid node [topNode=" + n + ", added=" + node + ']';
[46/50] [abbrv] ignite git commit: IGNITE-4239: test cleanup
Posted by sb...@apache.org.
IGNITE-4239: test cleanup
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ba99df15
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ba99df15
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ba99df15
Branch: refs/heads/master
Commit: ba99df1554fbd1de2b2367b6ce011a024cd199bd
Parents: 861fab9
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Tue Nov 22 15:07:20 2016 +0500
Committer: tledkov-gridgain <tl...@gridgain.com>
Committed: Tue Nov 22 15:07:20 2016 +0500
----------------------------------------------------------------------
.../processors/compute/PublicThreadpoolStarvationTest.java | 6 ------
1 file changed, 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ba99df15/modules/core/src/test/java/org/apache/ignite/internal/processors/compute/PublicThreadpoolStarvationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/compute/PublicThreadpoolStarvationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/compute/PublicThreadpoolStarvationTest.java
index e587310..dec32c6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/compute/PublicThreadpoolStarvationTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/compute/PublicThreadpoolStarvationTest.java
@@ -116,12 +116,6 @@ public class PublicThreadpoolStarvationTest extends GridCacheAbstractSelfTest {
public void testCacheSizeOnPublicThreadpoolStarvation() throws Exception {
grid(0).compute().run(new IgniteRunnable() {
@Override public void run() {
- try {
- Thread.sleep(500);
- }
- catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- }
grid(0).cache(CACHE_NAME).size();
}
});
[49/50] [abbrv] ignite git commit: Merge remote-tracking branch
'remotes/community/ignite-1.7.4'
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/community/ignite-1.7.4'
# Conflicts:
# modules/core/src/main/java/org/apache/ignite/internal/util/GridLogThrottle.java
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/12d830de
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/12d830de
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/12d830de
Branch: refs/heads/master
Commit: 12d830de4688464d5240f4df60b3ab638c2551d6
Parents: 47fbba8 c34d274
Author: sboikov <sb...@gridgain.com>
Authored: Tue Nov 22 14:38:59 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Nov 22 14:38:59 2016 +0300
----------------------------------------------------------------------
bin/ignite.bat | 5 +
.../org/apache/ignite/IgniteDataStreamer.java | 2 +-
.../apache/ignite/IgniteSystemProperties.java | 13 +
.../internal/ComputeTaskInternalFuture.java | 11 +
.../internal/binary/BinaryClassDescriptor.java | 37 +-
.../ignite/internal/binary/BinaryContext.java | 13 +-
.../internal/binary/BinaryObjectExImpl.java | 57 +-
.../internal/binary/BinaryObjectImpl.java | 23 +
.../binary/BinaryObjectOffheapImpl.java | 24 +-
.../ignite/internal/binary/BinaryUtils.java | 4 +
.../binary/builder/BinaryObjectBuilderImpl.java | 6 +-
.../processors/affinity/AffinityAssignment.java | 88 +++
.../affinity/GridAffinityAssignment.java | 8 +-
.../affinity/GridAffinityAssignmentCache.java | 35 +-
.../affinity/GridAffinityProcessor.java | 89 ++-
.../processors/affinity/GridAffinityUtils.java | 8 +-
.../affinity/HistoryAffinityAssignment.java | 169 ++++++
.../cache/CacheAffinitySharedManager.java | 57 +-
.../cache/DynamicCacheChangeBatch.java | 7 +
.../processors/cache/GridCacheAdapter.java | 11 +-
.../cache/GridCacheAffinityManager.java | 6 +-
.../processors/cache/GridCacheMapEntry.java | 5 +-
.../processors/cache/GridCacheMvccManager.java | 77 +++
.../GridCachePartitionExchangeManager.java | 299 +++++++--
.../processors/cache/GridCacheProcessor.java | 5 +-
.../cache/GridCacheSharedContext.java | 1 +
.../processors/cache/GridCacheUtils.java | 67 --
.../dht/GridClientPartitionTopology.java | 33 +-
.../dht/GridDhtPartitionTopology.java | 3 +-
.../dht/GridDhtPartitionTopologyImpl.java | 31 +-
.../GridDhtAtomicAbstractUpdateFuture.java | 19 +-
.../dht/atomic/GridDhtAtomicCache.java | 2 +-
.../atomic/GridDhtAtomicSingleUpdateFuture.java | 30 +-
.../dht/atomic/GridDhtAtomicUpdateFuture.java | 10 +-
.../GridNearAtomicAbstractUpdateRequest.java | 5 -
.../atomic/GridNearAtomicFullUpdateRequest.java | 5 -
.../GridNearAtomicSingleUpdateRequest.java | 9 -
.../dht/preloader/GridDhtPartitionFullMap.java | 18 +
.../dht/preloader/GridDhtPartitionMap2.java | 53 +-
.../GridDhtPartitionsAbstractMessage.java | 40 +-
.../GridDhtPartitionsExchangeFuture.java | 84 +--
.../preloader/GridDhtPartitionsFullMessage.java | 150 ++++-
.../GridDhtPartitionsSingleMessage.java | 132 +++-
.../GridDhtPartitionsSingleRequest.java | 4 +-
.../dht/preloader/GridDhtPreloader.java | 22 +-
.../query/GridCacheQueryMetricsAdapter.java | 2 +-
.../continuous/GridContinuousProcessor.java | 4 +-
.../datastreamer/DataStreamProcessor.java | 104 +++-
.../datastreamer/DataStreamerImpl.java | 607 ++++++++++++++-----
.../internal/processors/igfs/IgfsProcessor.java | 15 +
.../ignite/internal/util/GridLogThrottle.java | 45 +-
.../ignite/internal/util/IgniteUtils.java | 111 +++-
.../internal/util/future/GridFutureAdapter.java | 12 +-
.../util/offheap/unsafe/GridUnsafeMemory.java | 33 +-
.../visor/misc/VisorResolveHostNameTask.java | 4 +-
.../security/SecurityBasicPermissionSet.java | 107 ++++
.../security/SecurityPermissionSetBuilder.java | 222 +++++++
.../ignite/spi/discovery/tcp/ClientImpl.java | 38 +-
.../ignite/spi/discovery/tcp/ServerImpl.java | 510 +++++++++++++---
.../spi/discovery/tcp/TcpDiscoveryImpl.java | 59 +-
.../messages/TcpDiscoveryAbstractMessage.java | 7 +
.../messages/TcpDiscoveryClientAckResponse.java | 5 +
.../TcpDiscoveryClientHeartbeatMessage.java | 7 +-
.../TcpDiscoveryConnectionCheckMessage.java | 5 +
.../messages/TcpDiscoveryHeartbeatMessage.java | 5 +
.../TcpDiscoveryNodeAddFinishedMessage.java | 11 +
.../messages/TcpDiscoveryNodeAddedMessage.java | 33 +-
.../binary/BinaryMarshallerSelfTest.java | 343 ++++++++++-
...CacheExchangeMessageDuplicatedStateTest.java | 393 ++++++++++++
.../cache/IgniteCacheDynamicStopSelfTest.java | 48 +-
.../cache/IgniteCachePeekModesAbstractTest.java | 2 +-
...CacheLoadingConcurrentGridStartSelfTest.java | 255 +++++++-
...ncurrentGridStartSelfTestAllowOverwrite.java | 30 +
.../distributed/IgniteCacheGetRestartTest.java | 3 +
...cingDelayedPartitionMapExchangeSelfTest.java | 8 +-
.../GridCacheRebalancingSyncSelfTest.java | 18 +-
.../GridCacheSyncReplicatedPreloadSelfTest.java | 3 -
.../IgniteCacheSyncRebalanceModeSelfTest.java | 2 +-
...ContinuousQueryFailoverAbstractSelfTest.java | 2 +-
...ComputeJobExecutionErrorToLogManualTest.java | 88 +++
.../compute/PublicThreadpoolStarvationTest.java | 123 ++++
.../IgniteNoCustomEventsOnNodeStart.java | 7 +
.../DataStreamProcessorSelfTest.java | 4 +-
.../datastreamer/DataStreamerImplSelfTest.java | 170 ++++--
.../DataStreamerMultiThreadedSelfTest.java | 2 -
.../datastreamer/DataStreamerTimeoutTest.java | 92 ++-
.../igfs/IgfsProcessorValidationSelfTest.java | 30 +
...IpcEndpointRegistrationAbstractSelfTest.java | 76 ++-
...dpointRegistrationOnLinuxAndMacSelfTest.java | 11 +-
.../SecurityPermissionSetBuilderTest.java | 110 ++++
.../spi/discovery/tcp/TcpDiscoverySelfTest.java | 134 +++-
.../junits/common/GridCommonAbstractTest.java | 25 +-
.../ignite/testsuites/IgniteBasicTestSuite.java | 3 +
.../testsuites/IgniteCacheTestSuite2.java | 5 +
.../testsuites/IgniteComputeGridTestSuite.java | 2 +
...opClientProtocolMultipleServersSelfTest.java | 102 ++--
.../query/h2/twostep/GridMergeIndex.java | 49 +-
.../cache/IgniteCacheOffheapEvictQueryTest.java | 7 +
.../IgniteCacheQueryMultiThreadedSelfTest.java | 59 ++
...lientQueryReplicatedNodeRestartSelfTest.java | 7 +
...butedQueryStopOnCancelOrTimeoutSelfTest.java | 7 +
.../query/IgniteSqlSplitterSelfTest.java | 2 +
.../query/h2/sql/GridQueryParsingTest.java | 11 +-
modules/platforms/cpp/DEVNOTES.txt | 23 +-
modules/platforms/cpp/README.txt | 10 +-
modules/platforms/cpp/binary/Makefile.am | 4 +-
.../cpp/binary/project/vs/binary.vcxproj | 2 -
.../cpp/common/project/vs/common.vcxproj | 1 -
modules/platforms/cpp/core/Makefile.am | 4 +-
.../platforms/cpp/core/project/vs/core.vcxproj | 2 -
modules/platforms/cpp/examples/README.txt | 9 +-
.../cpp/examples/odbc-example/Makefile.am | 4 +-
.../cpp/examples/putget-example/Makefile.am | 4 +-
.../cpp/examples/query-example/Makefile.am | 4 +-
modules/platforms/cpp/ignite/Makefile.am | 4 +-
.../cpp/ignite/project/vs/ignite.vcxproj | 4 +-
modules/platforms/cpp/jni/Makefile.am | 4 +-
.../platforms/cpp/jni/project/vs/jni.vcxproj | 1 -
.../platforms/cpp/odbc-test/include/test_type.h | 42 +-
.../cpp/odbc-test/src/api_robustness_test.cpp | 108 ++++
.../cpp/odbc-test/src/queries_test.cpp | 153 ++++-
.../cpp/odbc-test/src/sql_outer_join_test.cpp | 2 +-
modules/platforms/cpp/odbc/Makefile.am | 4 +-
modules/platforms/cpp/odbc/README.txt | 23 +-
.../platforms/cpp/odbc/include/ignite/odbc.h | 12 +-
.../ignite/odbc/diagnostic/diagnosable.h | 7 +
.../odbc/diagnostic/diagnosable_adapter.h | 10 +
.../ignite/odbc/diagnostic/diagnostic_record.h | 19 +
.../odbc/diagnostic/diagnostic_record_storage.h | 16 +
.../cpp/odbc/include/ignite/odbc/statement.h | 42 ++
.../cpp/odbc/install/ignite-odbc-amd64.wxs | 114 ++++
.../cpp/odbc/install/ignite-odbc-x86.wxs | 114 ++++
.../odbc/os/win/src/system/socket_client.cpp | 4 +-
.../platforms/cpp/odbc/project/vs/odbc.vcxproj | 4 +-
.../odbc/src/app/application_data_buffer.cpp | 34 +-
.../odbc/src/diagnostic/diagnostic_record.cpp | 16 +-
.../diagnostic/diagnostic_record_storage.cpp | 18 +
modules/platforms/cpp/odbc/src/entry_points.cpp | 26 +-
modules/platforms/cpp/odbc/src/odbc.cpp | 175 ++----
modules/platforms/cpp/odbc/src/statement.cpp | 151 +++++
.../Dataload/DataStreamerTestTopologyChange.cs | 27 +-
.../Apache.Ignite.Core/Impl/PlatformTarget.cs | 2 +-
.../src/test/config/incorrect-store-cache.xml | 2 +
.../src/test/config/jdbc-pojo-store-builtin.xml | 3 +
.../src/test/config/jdbc-pojo-store-obj.xml | 3 +
modules/spring/src/test/config/node.xml | 2 +
modules/spring/src/test/config/node1.xml | 2 +
.../test/config/pojo-incorrect-store-cache.xml | 2 +
modules/spring/src/test/config/store-cache.xml | 2 +
modules/spring/src/test/config/store-cache1.xml | 2 +
.../IgniteStartFromStreamConfigurationTest.java | 18 +-
pom.xml | 8 +
152 files changed, 6055 insertions(+), 1148 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/12d830de/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/12d830de/modules/core/src/main/java/org/apache/ignite/internal/util/GridLogThrottle.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/util/GridLogThrottle.java
index c4a107a,c8ba865..7f30dd7
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/GridLogThrottle.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/GridLogThrottle.java
@@@ -79,38 -93,57 +93,54 @@@ public class GridLogThrottle
* Logs warning if needed.
*
* @param log Logger.
- * @param e Error (optional).
* @param msg Message.
*/
- public static void warn(@Nullable IgniteLogger log, @Nullable Throwable e, String msg) {
+ public static void warn(@Nullable IgniteLogger log, String msg) {
assert !F.isEmpty(msg);
- log(log, null, msg, null, LogLevel.WARN, false);
- log(log, e, msg, null, LogLevel.WARN, false, false);
++ log(log, null, msg, null, LogLevel.WARN, false, false);
}
/**
* Logs warning if needed.
*
* @param log Logger.
+ * @param e Error (optional).
+ * @param msg Message.
+ * @param quite Print warning anyway.
+ * @param byMsg Errors group by message, not by tuple(error, msg).
+ */
+ public static void warn(@Nullable IgniteLogger log, @Nullable Throwable e, String msg, boolean quite, boolean byMsg) {
+ assert !F.isEmpty(msg);
+
+ log(log, e, msg, null, LogLevel.WARN, quite, byMsg);
+ }
+
+
+ /**
+ * Logs warning if needed.
+ *
+ * @param log Logger.
- * @param e Error (optional).
* @param msg Message.
- * @param quite Print warning anyway.
+ * @param quiet Print warning anyway.
*/
- public static void warn(@Nullable IgniteLogger log, @Nullable Throwable e, String msg, boolean quite) {
+ public static void warn(@Nullable IgniteLogger log, String msg, boolean quiet) {
assert !F.isEmpty(msg);
- log(log, null, msg, null, LogLevel.WARN, quiet);
- log(log, e, msg, null, LogLevel.WARN, quite, false);
++ log(log, null, msg, null, LogLevel.WARN, quiet, false);
}
/**
* Logs warning if needed.
*
* @param log Logger.
- * @param e Error (optional).
* @param longMsg Long message (or just message).
- * @param shortMsg Short message for quite logging.
+ * @param shortMsg Short message for quiet logging.
*/
- public static void warn(@Nullable IgniteLogger log, @Nullable Throwable e, String longMsg, @Nullable String shortMsg) {
+ public static void warn(@Nullable IgniteLogger log, String longMsg, @Nullable String shortMsg) {
assert !F.isEmpty(longMsg);
- log(log, null, longMsg, shortMsg, LogLevel.WARN, false);
- log(log, e, longMsg, shortMsg, LogLevel.WARN, false, false);
++ log(log, null, longMsg, shortMsg, LogLevel.WARN, false, false);
}
/**
@@@ -118,12 -151,12 +148,12 @@@
*
* @param log Logger.
* @param msg Message.
- * @param quite Print info anyway.
+ * @param quiet Print info anyway.
*/
- public static void info(@Nullable IgniteLogger log, String msg, boolean quite) {
+ public static void info(@Nullable IgniteLogger log, String msg, boolean quiet) {
assert !F.isEmpty(msg);
- log(log, null, msg, null, LogLevel.INFO, quiet);
- log(log, null, msg, null, LogLevel.INFO, quite, false);
++ log(log, null, msg, null, LogLevel.INFO, quiet, false);
}
/**
@@@ -151,12 -182,13 +181,13 @@@
* @param log Logger.
* @param e Error (optional).
* @param longMsg Long message (or just message).
- * @param shortMsg Short message for quite logging.
+ * @param shortMsg Short message for quiet logging.
* @param level Level where messages should appear.
+ * @param byMsg Errors group by message, not by tuple(error, msg).
*/
@SuppressWarnings({"RedundantTypeArguments"})
- private static void log(@Nullable IgniteLogger log, @Nullable Throwable e, String longMsg, @Nullable String shortMsg,
- LogLevel level, boolean quiet, boolean byMsg) {
+ private static void log(@Nullable IgniteLogger log, @Nullable Throwable e, String longMsg,
- @Nullable String shortMsg, LogLevel level, boolean quiet) {
++ @Nullable String shortMsg, LogLevel level, boolean quiet, boolean byMsg) {
assert !F.isEmpty(longMsg);
IgniteBiTuple<Class<? extends Throwable>, String> tup =
http://git-wip-us.apache.org/repos/asf/ignite/blob/12d830de/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/12d830de/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/12d830de/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/12d830de/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/12d830de/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/12d830de/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
----------------------------------------------------------------------
diff --cc modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
index 3dca5e1,6ab0885..c6281df
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
@@@ -144,8 -143,9 +145,10 @@@ public class IgniteBasicTestSuite exten
suite.addTestSuite(NotStringSystemPropertyTest.class);
suite.addTestSuite(MarshallerContextLockingSelfTest.class);
+ suite.addTestSuite(MarshallerContextSelfTest.class);
+ suite.addTestSuite(SecurityPermissionSetBuilderTest.class);
+
return suite;
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/12d830de/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/12d830de/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapEvictQueryTest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/12d830de/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest.java
----------------------------------------------------------------------
[09/50] [abbrv] ignite git commit: IGNITE-500
CacheLoadingConcurrentGridStartSelfTest fails (DataStreamer data loss at
unstable topology in !allowOverwrite mode fixed)
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7499828/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerMultiThreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerMultiThreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerMultiThreadedSelfTest.java
index c1251ae..3d3f146 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerMultiThreadedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerMultiThreadedSelfTest.java
@@ -125,8 +125,6 @@ public class DataStreamerMultiThreadedSelfTest extends GridCommonAbstractTest {
ignite.getOrCreateCache(cacheConfiguration());
try (final DataStreamerImpl dataLdr = (DataStreamerImpl)ignite.dataStreamer(null)) {
- dataLdr.maxRemapCount(0);
-
Random rnd = new Random();
long endTime = U.currentTimeMillis() + 15_000;
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7499828/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerTimeoutTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerTimeoutTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerTimeoutTest.java
index 4e981b7..766aa84 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerTimeoutTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerTimeoutTest.java
@@ -17,11 +17,13 @@
package org.apache.ignite.internal.processors.datastreamer;
import java.util.Collection;
+import java.util.concurrent.atomic.AtomicInteger;
+import javax.cache.CacheException;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteDataStreamer;
-import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteDataStreamerTimeoutException;
+import org.apache.ignite.IgniteException;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
@@ -36,7 +38,6 @@ import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
* Test timeout for Data streamer.
*/
public class DataStreamerTimeoutTest extends GridCommonAbstractTest {
-
/** Cache name. */
public static final String CACHE_NAME = "cacheName";
@@ -46,6 +47,9 @@ public class DataStreamerTimeoutTest extends GridCommonAbstractTest {
/** Amount of entries. */
public static final int ENTRY_AMOUNT = 100;
+ /** Fail on. */
+ private static volatile int failOn;
+
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
@@ -76,6 +80,8 @@ public class DataStreamerTimeoutTest extends GridCommonAbstractTest {
* @throws Exception If fail.
*/
public void testTimeoutOnCloseMethod() throws Exception {
+ failOn = 1;
+
Ignite ignite = startGrid(1);
boolean thrown = false;
@@ -85,12 +91,10 @@ public class DataStreamerTimeoutTest extends GridCommonAbstractTest {
ldr.receiver(new TestDataReceiver());
ldr.perNodeBufferSize(ENTRY_AMOUNT);
- for (int i=0; i < ENTRY_AMOUNT; i++)
+ for (int i = 0; i < ENTRY_AMOUNT; i++)
ldr.addData(i, i);
-
}
- catch (IgniteDataStreamerTimeoutException e) {
- assertEquals(e.getMessage(), "Data streamer exceeded timeout on flush.");
+ catch (CacheException | IgniteDataStreamerTimeoutException e) {
thrown = true;
}
finally {
@@ -102,40 +106,68 @@ public class DataStreamerTimeoutTest extends GridCommonAbstractTest {
/**
* Test timeout on {@code DataStreamer.close()} method
+ *
* @throws Exception If fail.
*/
- public void testTimeoutOnAddDataMethod() throws Exception {
- Ignite ignite = startGrid(1);
+ public void testTimeoutOnAddData() throws Exception {
+ failOn = 1;
- boolean thrown = false;
+ int processed = timeoutOnAddData();
- IgniteDataStreamer ldr = ignite.dataStreamer(CACHE_NAME);
+ assertTrue(processed == (failOn + 1) || processed == failOn);
- try {
- ldr.timeout(TIMEOUT);
- ldr.receiver(new TestDataReceiver());
- ldr.perNodeBufferSize(ENTRY_AMOUNT/2);
- ldr.perNodeParallelOperations(1);
+ failOn = ENTRY_AMOUNT / 2;
- try {
- for (int i=0; i < ENTRY_AMOUNT; i++)
- ldr.addData(i, i);
- }
- catch (IgniteDataStreamerTimeoutException e) {
- assertEquals(e.getMessage(), "Data streamer exceeded timeout when starts parallel operation.");
+ processed = timeoutOnAddData();
+
+ assertTrue(processed == (failOn + 1) || processed == failOn);
+ failOn = ENTRY_AMOUNT;
+
+ processed = timeoutOnAddData();
+
+ assertTrue(processed == (failOn + 1) || processed == failOn);
+ }
+
+ /**
+ *
+ */
+ private int timeoutOnAddData() throws Exception {
+ boolean thrown = false;
+ int processed = 0;
+
+ try {
+ Ignite ignite = startGrid(1);
+
+ try (IgniteDataStreamer ldr = ignite.dataStreamer(CACHE_NAME)) {
+ ldr.timeout(TIMEOUT);
+ ldr.receiver(new TestDataReceiver());
+ ldr.perNodeBufferSize(1);
+ ldr.perNodeParallelOperations(1);
+ ((DataStreamerImpl)ldr).maxRemapCount(0);
+
+ try {
+ for (int i = 0; i < ENTRY_AMOUNT; i++) {
+ ldr.addData(i, i);
+
+ processed++;
+ }
+ }
+ catch (IllegalStateException e) {
+ // No-op.
+ }
+ }
+ catch (CacheException | IgniteDataStreamerTimeoutException e) {
thrown = true;
}
-
}
finally {
- if (thrown)
- ldr.close(true);
-
stopAllGrids();
}
assertTrue(thrown);
+
+ return processed;
}
/**
@@ -143,16 +175,14 @@ public class DataStreamerTimeoutTest extends GridCommonAbstractTest {
*/
private static class TestDataReceiver implements StreamReceiver {
- /** Is first. */
- boolean isFirst = true;
+ /** Count. */
+ private final AtomicInteger cnt = new AtomicInteger();
/** {@inheritDoc} */
- @Override public void receive(IgniteCache cache, Collection collection) throws IgniteException {
+ @Override public void receive(IgniteCache cache, Collection col) throws IgniteException {
try {
- if (isFirst)
+ if (cnt.incrementAndGet() == failOn)
U.sleep(2 * TIMEOUT);
-
- isFirst = false;
}
catch (IgniteInterruptedCheckedException e) {
throw new IgniteException(e);
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7499828/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
index dc412a9..0663903 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
@@ -39,6 +39,7 @@ import org.apache.ignite.internal.processors.cache.IgniteCacheIncrementTxTest;
import org.apache.ignite.internal.processors.cache.IgniteCachePartitionMapUpdateTest;
import org.apache.ignite.internal.processors.cache.IgniteDynamicCacheAndNodeStop;
import org.apache.ignite.internal.processors.cache.distributed.CacheLoadingConcurrentGridStartSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.CacheLoadingConcurrentGridStartSelfTestAllowOverwrite;
import org.apache.ignite.internal.processors.cache.distributed.CacheLockReleaseNodeLeaveTest;
import org.apache.ignite.internal.processors.cache.distributed.GridCachePartitionNotLoadedEventSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.GridCachePartitionedNearDisabledTxMultiThreadedSelfTest;
@@ -214,6 +215,7 @@ public class IgniteCacheTestSuite2 extends TestSuite {
suite.addTest(new TestSuite(FairAffinityFunctionBackupFilterSelfTest.class));
suite.addTest(new TestSuite(GridCachePartitionedPreloadLifecycleSelfTest.class));
suite.addTest(new TestSuite(CacheLoadingConcurrentGridStartSelfTest.class));
+ suite.addTest(new TestSuite(CacheLoadingConcurrentGridStartSelfTestAllowOverwrite.class));
suite.addTest(new TestSuite(GridCacheDhtPreloadDelayedSelfTest.class));
suite.addTest(new TestSuite(GridPartitionedBackupLoadSelfTest.class));
suite.addTest(new TestSuite(GridCachePartitionedLoadCacheSelfTest.class));
[35/50] [abbrv] ignite git commit: IGNITE-3074 Optimize DHT atomic
update future
Posted by sb...@apache.org.
IGNITE-3074 Optimize DHT atomic update future
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/88f38ac6
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/88f38ac6
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/88f38ac6
Branch: refs/heads/master
Commit: 88f38ac6305578946f2881b12d2d557bd561f67d
Parents: a24a394
Author: Konstantin Dudkov <kd...@ya.ru>
Authored: Mon Nov 21 15:11:09 2016 +0300
Committer: Konstantin Dudkov <kd...@ya.ru>
Committed: Mon Nov 21 15:11:09 2016 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheEntryEx.java | 4 +-
.../processors/cache/GridCacheMapEntry.java | 4 +-
.../GridDhtAtomicAbstractUpdateFuture.java | 461 +++++++++++++++++++
.../dht/atomic/GridDhtAtomicCache.java | 33 +-
.../atomic/GridDhtAtomicSingleUpdateFuture.java | 121 +++++
.../dht/atomic/GridDhtAtomicUpdateFuture.java | 393 +---------------
.../atomic/GridNearAtomicFullUpdateRequest.java | 24 +-
.../GridNearAtomicSingleUpdateFuture.java | 4 +-
.../continuous/CacheContinuousQueryHandler.java | 4 +-
.../CacheContinuousQueryListener.java | 4 +-
.../continuous/CacheContinuousQueryManager.java | 6 +-
.../processors/cache/GridCacheTestEntryEx.java | 4 +-
12 files changed, 638 insertions(+), 424 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/88f38ac6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
index ef6a244..176fe77 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
@@ -27,7 +27,7 @@ import org.apache.ignite.cache.eviction.EvictableEntry;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.distributed.GridDistributedLockCancelledException;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateFuture;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicAbstractUpdateFuture;
import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
import org.apache.ignite.internal.processors.cache.transactions.IgniteTxKey;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
@@ -504,7 +504,7 @@ public interface GridCacheEntryEx {
String taskName,
@Nullable CacheObject prevVal,
@Nullable Long updateCntr,
- @Nullable GridDhtAtomicUpdateFuture fut
+ @Nullable GridDhtAtomicAbstractUpdateFuture fut
) throws IgniteCheckedException, GridCacheEntryRemovedException;
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/88f38ac6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index 5996672..2bcf360 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -43,7 +43,7 @@ import org.apache.ignite.internal.managers.deployment.GridDeploymentInfoBean;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheEntry;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateFuture;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicAbstractUpdateFuture;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheEntry;
import org.apache.ignite.internal.processors.cache.extras.GridCacheEntryExtras;
import org.apache.ignite.internal.processors.cache.extras.GridCacheMvccEntryExtras;
@@ -1951,7 +1951,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
final String taskName,
@Nullable final CacheObject prevVal,
@Nullable final Long updateCntr,
- @Nullable GridDhtAtomicUpdateFuture fut
+ @Nullable GridDhtAtomicAbstractUpdateFuture fut
) throws IgniteCheckedException, GridCacheEntryRemovedException, GridClosureException {
assert cctx.atomic();
http://git-wip-us.apache.org/repos/asf/ignite/blob/88f38ac6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateFuture.java
new file mode 100644
index 0000000..3bbc348
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateFuture.java
@@ -0,0 +1,461 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.atomic.AtomicReference;
+import javax.cache.processor.EntryProcessor;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.GridCacheAtomicFuture;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheEntry;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.future.GridFutureAdapter;
+import org.apache.ignite.internal.util.tostring.GridToStringExclude;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.CI1;
+import org.apache.ignite.internal.util.typedef.CI2;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteUuid;
+import org.jetbrains.annotations.Nullable;
+
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/**
+ * DHT atomic cache backup update future.
+ */
+public abstract class GridDhtAtomicAbstractUpdateFuture extends GridFutureAdapter<Void>
+ implements GridCacheAtomicFuture<Void> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Logger. */
+ protected static IgniteLogger log;
+
+ /** Logger reference. */
+ private static final AtomicReference<IgniteLogger> logRef = new AtomicReference<>();
+
+ /** Logger. */
+ protected static IgniteLogger msgLog;
+
+ /** Write version. */
+ protected final GridCacheVersion writeVer;
+
+ /** Cache context. */
+ protected final GridCacheContext cctx;
+
+ /** Future version. */
+ protected final GridCacheVersion futVer;
+
+ /** Completion callback. */
+ @GridToStringExclude
+ private final CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse> completionCb;
+
+ /** Update request. */
+ private final GridNearAtomicAbstractUpdateRequest updateReq;
+
+ /** Update response. */
+ final GridNearAtomicUpdateResponse updateRes;
+
+ /** Force transform backup flag. */
+ private boolean forceTransformBackups;
+
+ /** Mappings. */
+ @GridToStringInclude
+ protected Map<UUID, GridDhtAtomicUpdateRequest> mappings;
+
+ /** Continuous query closures. */
+ private Collection<CI1<Boolean>> cntQryClsrs;
+
+ /** */
+ private final boolean waitForExchange;
+
+ /** Response count. */
+ private volatile int resCnt;
+
+ /**
+ * @param cctx Cache context.
+ * @param completionCb Callback to invoke when future is completed.
+ * @param writeVer Write version.
+ * @param updateReq Update request.
+ * @param updateRes Update response.
+ */
+ protected GridDhtAtomicAbstractUpdateFuture(
+ GridCacheContext cctx,
+ CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
+ GridCacheVersion writeVer,
+ GridNearAtomicAbstractUpdateRequest updateReq,
+ GridNearAtomicUpdateResponse updateRes) {
+ this.cctx = cctx;
+
+ futVer = cctx.versions().next(updateReq.topologyVersion());
+ this.updateReq = updateReq;
+ this.completionCb = completionCb;
+ this.updateRes = updateRes;
+ this.writeVer = writeVer;
+
+ waitForExchange = !(updateReq.topologyLocked() || (updateReq.fastMap() && !updateReq.clientRequest()));
+
+ if (log == null) {
+ msgLog = cctx.shared().atomicMessageLogger();
+ log = U.logger(cctx.kernalContext(), logRef, GridDhtAtomicUpdateFuture.class);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public final IgniteInternalFuture<Void> completeFuture(AffinityTopologyVersion topVer) {
+ if (waitForExchange && updateReq.topologyVersion().compareTo(topVer) < 0)
+ return this;
+
+ return null;
+ }
+
+ /**
+ * @param clsr Continuous query closure.
+ */
+ public final void addContinuousQueryClosure(CI1<Boolean> clsr) {
+ assert !isDone() : this;
+
+ if (cntQryClsrs == null)
+ cntQryClsrs = new ArrayList<>(10);
+
+ cntQryClsrs.add(clsr);
+ }
+
+ /**
+ * @param entry Entry to map.
+ * @param val Value to write.
+ * @param entryProcessor Entry processor.
+ * @param ttl TTL (optional).
+ * @param conflictExpireTime Conflict expire time (optional).
+ * @param conflictVer Conflict version (optional).
+ * @param addPrevVal If {@code true} sends previous value to backups.
+ * @param prevVal Previous value.
+ * @param updateCntr Partition update counter.
+ */
+ @SuppressWarnings("ForLoopReplaceableByForEach")
+ final void addWriteEntry(GridDhtCacheEntry entry,
+ @Nullable CacheObject val,
+ EntryProcessor<Object, Object, Object> entryProcessor,
+ long ttl,
+ long conflictExpireTime,
+ @Nullable GridCacheVersion conflictVer,
+ boolean addPrevVal,
+ @Nullable CacheObject prevVal,
+ long updateCntr) {
+ AffinityTopologyVersion topVer = updateReq.topologyVersion();
+
+ List<ClusterNode> dhtNodes = cctx.dht().topology().nodes(entry.partition(), topVer);
+
+ if (log.isDebugEnabled())
+ log.debug("Mapping entry to DHT nodes [nodes=" + U.nodeIds(dhtNodes) + ", entry=" + entry + ']');
+
+ CacheWriteSynchronizationMode syncMode = updateReq.writeSynchronizationMode();
+
+ addDhtKey(entry.key(), dhtNodes);
+
+ for (int i = 0; i < dhtNodes.size(); i++) {
+ ClusterNode node = dhtNodes.get(i);
+
+ UUID nodeId = node.id();
+
+ if (!nodeId.equals(cctx.localNodeId())) {
+ GridDhtAtomicUpdateRequest updateReq = mappings.get(nodeId);
+
+ if (updateReq == null) {
+ updateReq = new GridDhtAtomicUpdateRequest(
+ cctx.cacheId(),
+ nodeId,
+ futVer,
+ writeVer,
+ syncMode,
+ topVer,
+ forceTransformBackups,
+ this.updateReq.subjectId(),
+ this.updateReq.taskNameHash(),
+ forceTransformBackups ? this.updateReq.invokeArguments() : null,
+ cctx.deploymentEnabled(),
+ this.updateReq.keepBinary(),
+ this.updateReq.skipStore());
+
+ mappings.put(nodeId, updateReq);
+ }
+
+ updateReq.addWriteValue(entry.key(),
+ val,
+ entryProcessor,
+ ttl,
+ conflictExpireTime,
+ conflictVer,
+ addPrevVal,
+ entry.partition(),
+ prevVal,
+ updateCntr);
+ }
+ }
+ }
+
+ /**
+ * @param key Key.
+ * @param dhtNodes DHT nodes.
+ */
+ protected abstract void addDhtKey(KeyCacheObject key, List<ClusterNode> dhtNodes);
+
+ /**
+ * @param key Key.
+ * @param readers Near cache readers.
+ */
+ protected abstract void addNearKey(KeyCacheObject key, Collection<UUID> readers);
+
+ /**
+ * @param readers Entry readers.
+ * @param entry Entry.
+ * @param val Value.
+ * @param entryProcessor Entry processor..
+ * @param ttl TTL for near cache update (optional).
+ * @param expireTime Expire time for near cache update (optional).
+ */
+ final void addNearWriteEntries(Collection<UUID> readers,
+ GridDhtCacheEntry entry,
+ @Nullable CacheObject val,
+ EntryProcessor<Object, Object, Object> entryProcessor,
+ long ttl,
+ long expireTime) {
+ CacheWriteSynchronizationMode syncMode = updateReq.writeSynchronizationMode();
+
+ addNearKey(entry.key(), readers);
+
+ AffinityTopologyVersion topVer = updateReq.topologyVersion();
+
+ for (UUID nodeId : readers) {
+ GridDhtAtomicUpdateRequest updateReq = mappings.get(nodeId);
+
+ if (updateReq == null) {
+ ClusterNode node = cctx.discovery().node(nodeId);
+
+ // Node left the grid.
+ if (node == null)
+ continue;
+
+ updateReq = new GridDhtAtomicUpdateRequest(
+ cctx.cacheId(),
+ nodeId,
+ futVer,
+ writeVer,
+ syncMode,
+ topVer,
+ forceTransformBackups,
+ this.updateReq.subjectId(),
+ this.updateReq.taskNameHash(),
+ forceTransformBackups ? this.updateReq.invokeArguments() : null,
+ cctx.deploymentEnabled(),
+ this.updateReq.keepBinary(),
+ this.updateReq.skipStore());
+
+ mappings.put(nodeId, updateReq);
+ }
+
+ addNearReaderEntry(entry);
+
+ updateReq.addNearWriteValue(entry.key(),
+ val,
+ entryProcessor,
+ ttl,
+ expireTime);
+ }
+ }
+
+ /**
+ * adds new nearReader.
+ *
+ * @param entry GridDhtCacheEntry.
+ */
+ protected abstract void addNearReaderEntry(GridDhtCacheEntry entry);
+
+ /**
+ * @return Write version.
+ */
+ final GridCacheVersion writeVersion() {
+ return writeVer;
+ }
+
+ /** {@inheritDoc} */
+ @Override public final IgniteUuid futureId() {
+ return futVer.asGridUuid();
+ }
+
+ /** {@inheritDoc} */
+ @Override public final GridCacheVersion version() {
+ return futVer;
+ }
+
+ /** {@inheritDoc} */
+ @Override public final boolean onNodeLeft(UUID nodeId) {
+ boolean res = registerResponse(nodeId);
+
+ if (res && msgLog.isDebugEnabled()) {
+ msgLog.debug("DTH update fut, node left [futId=" + futVer + ", writeVer=" + writeVer +
+ ", node=" + nodeId + ']');
+ }
+
+ return res;
+ }
+
+ /**
+ * @param nodeId Node ID.
+ * @return {@code True} if request found.
+ */
+ final boolean registerResponse(UUID nodeId) {
+ int resCnt0;
+
+ GridDhtAtomicUpdateRequest req = mappings != null ? mappings.get(nodeId) : null;
+
+ if (req != null) {
+ synchronized (this) {
+ if (req.onResponse()) {
+ resCnt0 = resCnt;
+
+ resCnt0 += 1;
+
+ resCnt = resCnt0;
+ }
+ else
+ return false;
+ }
+
+ if (resCnt0 == mappings.size())
+ onDone();
+
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Sends requests to remote nodes.
+ */
+ final void map() {
+ if (!F.isEmpty(mappings)) {
+ for (GridDhtAtomicUpdateRequest req : mappings.values()) {
+ try {
+ cctx.io().send(req.nodeId(), req, cctx.ioPolicy());
+
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("DTH update fut, sent request [futId=" + futVer +
+ ", writeVer=" + writeVer + ", node=" + req.nodeId() + ']');
+ }
+ }
+ catch (ClusterTopologyCheckedException ignored) {
+ if (msgLog.isDebugEnabled()) {
+ msgLog.debug("DTH update fut, failed to send request, node left [futId=" + futVer +
+ ", writeVer=" + writeVer + ", node=" + req.nodeId() + ']');
+ }
+
+ registerResponse(req.nodeId());
+ }
+ catch (IgniteCheckedException e) {
+ U.error(msgLog, "Failed to send request [futId=" + futVer +
+ ", writeVer=" + writeVer + ", node=" + req.nodeId() + ']');
+
+ registerResponse(req.nodeId());
+ }
+ }
+ }
+ else
+ onDone();
+
+ // Send response right away if no ACKs from backup is required.
+ // Backups will send ACKs anyway, future will be completed after all backups have replied.
+ if (updateReq.writeSynchronizationMode() != FULL_SYNC)
+ completionCb.apply(updateReq, updateRes);
+ }
+
+ /**
+ * Deferred update response.
+ *
+ * @param nodeId Backup node ID.
+ */
+ public final void onResult(UUID nodeId) {
+ if (log.isDebugEnabled())
+ log.debug("Received deferred DHT atomic update future result [nodeId=" + nodeId + ']');
+
+ registerResponse(nodeId);
+ }
+
+ /**
+ * Callback for backup update response.
+ *
+ * @param nodeId Backup node ID.
+ * @param updateRes Update response.
+ */
+ public abstract void onResult(UUID nodeId, GridDhtAtomicUpdateResponse updateRes);
+
+ /**
+ * @param updateRes Response.
+ * @param err Error.
+ */
+ protected abstract void addFailedKeys(GridNearAtomicUpdateResponse updateRes, Throwable err);
+
+ /** {@inheritDoc} */
+ @Override public final boolean onDone(@Nullable Void res, @Nullable Throwable err) {
+ if (super.onDone(res, err)) {
+ cctx.mvcc().removeAtomicFuture(version());
+
+ boolean suc = err == null;
+
+ if (!suc)
+ addFailedKeys(updateRes, err);
+
+ if (cntQryClsrs != null) {
+ for (CI1<Boolean> clsr : cntQryClsrs)
+ clsr.apply(suc);
+ }
+
+ if (updateReq.writeSynchronizationMode() == FULL_SYNC)
+ completionCb.apply(updateReq, updateRes);
+
+ return true;
+ }
+
+ return false;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean trackable() {
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void markNotTrackable() {
+ // No-op.
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/88f38ac6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index f7d1973..d7eb062 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -1685,7 +1685,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
assert !req.returnValue() || (req.operation() == TRANSFORM || req.size() == 1);
- GridDhtAtomicUpdateFuture dhtFut = null;
+ GridDhtAtomicAbstractUpdateFuture dhtFut = null;
boolean remap = false;
@@ -1908,7 +1908,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
final GridNearAtomicUpdateResponse res,
final List<GridDhtCacheEntry> locked,
final GridCacheVersion ver,
- @Nullable GridDhtAtomicUpdateFuture dhtFut,
+ @Nullable GridDhtAtomicAbstractUpdateFuture dhtFut,
final CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
final boolean replicate,
final String taskName,
@@ -2331,7 +2331,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
GridNearAtomicUpdateResponse res,
List<GridDhtCacheEntry> locked,
GridCacheVersion ver,
- @Nullable GridDhtAtomicUpdateFuture dhtFut,
+ @Nullable GridDhtAtomicAbstractUpdateFuture dhtFut,
CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
boolean replicate,
String taskName,
@@ -2552,7 +2552,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
* @return Deleted entries.
*/
@SuppressWarnings("ForLoopReplaceableByForEach")
- @Nullable private GridDhtAtomicUpdateFuture updatePartialBatch(
+ @Nullable private GridDhtAtomicAbstractUpdateFuture updatePartialBatch(
final boolean hasNear,
final int firstEntryIdx,
final List<GridDhtCacheEntry> entries,
@@ -2562,7 +2562,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
@Nullable final Map<KeyCacheObject, CacheObject> putMap,
@Nullable final Collection<KeyCacheObject> rmvKeys,
@Nullable final Map<KeyCacheObject, EntryProcessor<Object, Object, Object>> entryProcessorMap,
- @Nullable GridDhtAtomicUpdateFuture dhtFut,
+ @Nullable GridDhtAtomicAbstractUpdateFuture dhtFut,
final CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
final GridNearAtomicAbstractUpdateRequest req,
final GridNearAtomicUpdateResponse res,
@@ -3036,7 +3036,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
* @param force If {@code true} then creates future without optimizations checks.
* @return Backup update future or {@code null} if there are no backups.
*/
- @Nullable private GridDhtAtomicUpdateFuture createDhtFuture(
+ @Nullable private GridDhtAtomicAbstractUpdateFuture createDhtFuture(
GridCacheVersion writeVer,
GridNearAtomicAbstractUpdateRequest updateReq,
GridNearAtomicUpdateResponse updateRes,
@@ -3064,7 +3064,10 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
}
}
- return new GridDhtAtomicUpdateFuture(ctx, completionCb, writeVer, updateReq, updateRes);
+ if (updateReq.size() == 1)
+ return new GridDhtAtomicSingleUpdateFuture(ctx, completionCb, writeVer, updateReq, updateRes);
+ else
+ return new GridDhtAtomicUpdateFuture(ctx, completionCb, writeVer, updateReq, updateRes);
}
/**
@@ -3256,7 +3259,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
*/
@SuppressWarnings("unchecked")
private void processDhtAtomicUpdateResponse(UUID nodeId, GridDhtAtomicUpdateResponse res) {
- GridDhtAtomicUpdateFuture updateFut = (GridDhtAtomicUpdateFuture)ctx.mvcc().atomicFuture(res.futureVersion());
+ GridDhtAtomicAbstractUpdateFuture updateFut = (GridDhtAtomicAbstractUpdateFuture)ctx.mvcc().atomicFuture(res.futureVersion());
if (updateFut != null) {
if (msgLog.isDebugEnabled()) {
@@ -3279,7 +3282,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
@SuppressWarnings("unchecked")
private void processDhtAtomicDeferredUpdateResponse(UUID nodeId, GridDhtAtomicDeferredUpdateResponse res) {
for (GridCacheVersion ver : res.futureVersions()) {
- GridDhtAtomicUpdateFuture updateFut = (GridDhtAtomicUpdateFuture)ctx.mvcc().atomicFuture(ver);
+ GridDhtAtomicAbstractUpdateFuture updateFut = (GridDhtAtomicAbstractUpdateFuture)ctx.mvcc().atomicFuture(ver);
if (updateFut != null) {
if (msgLog.isDebugEnabled()) {
@@ -3335,7 +3338,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
private final Collection<IgniteBiTuple<GridDhtCacheEntry, GridCacheVersion>> deleted;
/** */
- private final GridDhtAtomicUpdateFuture dhtFut;
+ private final GridDhtAtomicAbstractUpdateFuture dhtFut;
/**
* @param retVal Return value.
@@ -3344,7 +3347,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
*/
private UpdateSingleResult(GridCacheReturn retVal,
Collection<IgniteBiTuple<GridDhtCacheEntry, GridCacheVersion>> deleted,
- GridDhtAtomicUpdateFuture dhtFut) {
+ GridDhtAtomicAbstractUpdateFuture dhtFut) {
this.retVal = retVal;
this.deleted = deleted;
this.dhtFut = dhtFut;
@@ -3367,7 +3370,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
/**
* @return DHT future.
*/
- public GridDhtAtomicUpdateFuture dhtFuture() {
+ public GridDhtAtomicAbstractUpdateFuture dhtFuture() {
return dhtFut;
}
}
@@ -3380,7 +3383,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
private Collection<IgniteBiTuple<GridDhtCacheEntry, GridCacheVersion>> deleted;
/** */
- private GridDhtAtomicUpdateFuture dhtFut;
+ private GridDhtAtomicAbstractUpdateFuture dhtFut;
/** */
private boolean readersOnly;
@@ -3414,7 +3417,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
/**
* @return DHT future.
*/
- public GridDhtAtomicUpdateFuture dhtFuture() {
+ public GridDhtAtomicAbstractUpdateFuture dhtFuture() {
return dhtFut;
}
@@ -3435,7 +3438,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
/**
* @param dhtFut DHT future.
*/
- private void dhtFuture(@Nullable GridDhtAtomicUpdateFuture dhtFut) {
+ private void dhtFuture(@Nullable GridDhtAtomicAbstractUpdateFuture dhtFut) {
this.dhtFut = dhtFut;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/88f38ac6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateFuture.java
new file mode 100644
index 0000000..f83a7b7
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateFuture.java
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.UUID;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedException;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheEntry;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.typedef.CI2;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+
+/**
+ *
+ */
+class GridDhtAtomicSingleUpdateFuture extends GridDhtAtomicAbstractUpdateFuture {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Future keys. */
+ private KeyCacheObject key;
+
+ /** Entries with readers. */
+ private GridDhtCacheEntry nearReaderEntry;
+
+ /**
+ * @param cctx Cache context.
+ * @param completionCb Callback to invoke when future is completed.
+ * @param writeVer Write version.
+ * @param updateReq Update request.
+ * @param updateRes Update response.
+ */
+ GridDhtAtomicSingleUpdateFuture(
+ GridCacheContext cctx,
+ CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
+ GridCacheVersion writeVer,
+ GridNearAtomicAbstractUpdateRequest updateReq,
+ GridNearAtomicUpdateResponse updateRes
+ ) {
+ super(cctx, completionCb, writeVer, updateReq, updateRes);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void addDhtKey(KeyCacheObject key, List<ClusterNode> dhtNodes) {
+ assert this.key == null || this.key.equals(key) : this.key;
+
+ if (mappings == null)
+ mappings = U.newHashMap(dhtNodes.size());
+
+ this.key = key;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void addNearKey(KeyCacheObject key, Collection<UUID> readers) {
+ assert this.key == null || this.key.equals(key) : this.key;
+
+ if (mappings == null)
+ mappings = U.newHashMap(readers.size());
+
+ this.key = key;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void addNearReaderEntry(GridDhtCacheEntry entry) {
+ nearReaderEntry = entry;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onResult(UUID nodeId, GridDhtAtomicUpdateResponse updateRes) {
+ if (log.isDebugEnabled())
+ log.debug("Received DHT atomic update future result [nodeId=" + nodeId + ", updateRes=" + updateRes + ']');
+
+ if (updateRes.error() != null)
+ this.updateRes.addFailedKeys(updateRes.failedKeys(), updateRes.error());
+
+ if (!F.isEmpty(updateRes.nearEvicted())) {
+ try {
+ assert nearReaderEntry != null;
+
+ nearReaderEntry.removeReader(nodeId, updateRes.messageId());
+ }
+ catch (GridCacheEntryRemovedException e) {
+ if (log.isDebugEnabled())
+ log.debug("Entry with evicted reader was removed [entry=" + nearReaderEntry + ", err=" + e + ']');
+ }
+ }
+
+ registerResponse(nodeId);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void addFailedKeys(GridNearAtomicUpdateResponse updateRes, Throwable err) {
+ updateRes.addFailedKey(key, err);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridDhtAtomicSingleUpdateFuture.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/88f38ac6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
index c2ad8b8..864aadd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
@@ -23,92 +23,30 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
-import java.util.concurrent.atomic.AtomicReference;
-import javax.cache.processor.EntryProcessor;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.internal.IgniteInternalFuture;
-import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
-import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.CacheObject;
-import org.apache.ignite.internal.processors.cache.GridCacheAtomicFuture;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedException;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheEntry;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.internal.util.future.GridFutureAdapter;
-import org.apache.ignite.internal.util.tostring.GridToStringExclude;
-import org.apache.ignite.internal.util.tostring.GridToStringInclude;
-import org.apache.ignite.internal.util.typedef.CI1;
import org.apache.ignite.internal.util.typedef.CI2;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgniteUuid;
-import org.jetbrains.annotations.Nullable;
-
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
/**
* DHT atomic cache backup update future.
*/
-public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void>
- implements GridCacheAtomicFuture<Void> {
+class GridDhtAtomicUpdateFuture extends GridDhtAtomicAbstractUpdateFuture {
/** */
private static final long serialVersionUID = 0L;
- /** Logger reference. */
- private static final AtomicReference<IgniteLogger> logRef = new AtomicReference<>();
-
- /** Logger. */
- private static IgniteLogger log;
-
- /** Logger. */
- private static IgniteLogger msgLog;
-
- /** Cache context. */
- private final GridCacheContext cctx;
-
- /** Future version. */
- private final GridCacheVersion futVer;
-
- /** Write version. */
- private final GridCacheVersion writeVer;
-
- /** Force transform backup flag. */
- private boolean forceTransformBackups;
-
- /** Completion callback. */
- @GridToStringExclude
- private final CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse> completionCb;
-
- /** Mappings. */
- @GridToStringInclude
- private final Map<UUID, GridDhtAtomicUpdateRequest> mappings;
-
- /** Entries with readers. */
- private Map<KeyCacheObject, GridDhtCacheEntry> nearReadersEntries;
-
- /** Update request. */
- private final GridNearAtomicAbstractUpdateRequest updateReq;
-
- /** Update response. */
- private final GridNearAtomicUpdateResponse updateRes;
-
/** Future keys. */
private final Collection<KeyCacheObject> keys;
- /** Continuous query closures. */
- private Collection<CI1<Boolean>> cntQryClsrs;
-
- /** */
- private final boolean waitForExchange;
+ /** Entries with readers. */
+ private Map<KeyCacheObject, GridDhtCacheEntry> nearReadersEntries;
- /** Response count. */
- private volatile int resCnt;
/**
* @param cctx Cache context.
@@ -117,328 +55,39 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void>
* @param updateReq Update request.
* @param updateRes Update response.
*/
- public GridDhtAtomicUpdateFuture(
+ GridDhtAtomicUpdateFuture(
GridCacheContext cctx,
CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
GridCacheVersion writeVer,
GridNearAtomicAbstractUpdateRequest updateReq,
GridNearAtomicUpdateResponse updateRes
) {
- this.cctx = cctx;
- this.writeVer = writeVer;
-
- futVer = cctx.versions().next(updateReq.topologyVersion());
- this.updateReq = updateReq;
- this.completionCb = completionCb;
- this.updateRes = updateRes;
-
- if (log == null) {
- msgLog = cctx.shared().atomicMessageLogger();
- log = U.logger(cctx.kernalContext(), logRef, GridDhtAtomicUpdateFuture.class);
- }
+ super(cctx, completionCb, writeVer, updateReq, updateRes);
keys = new ArrayList<>(updateReq.size());
mappings = U.newHashMap(updateReq.size());
-
- waitForExchange = !(updateReq.topologyLocked() || (updateReq.fastMap() && !updateReq.clientRequest()));
- }
-
- /**
- * @return Write version.
- */
- GridCacheVersion writeVersion() {
- return writeVer;
- }
-
- /** {@inheritDoc} */
- @Override public IgniteUuid futureId() {
- return futVer.asGridUuid();
}
/** {@inheritDoc} */
- @Override public GridCacheVersion version() {
- return futVer;
+ @Override protected void addDhtKey(KeyCacheObject key, List<ClusterNode> dhtNodes) {
+ keys.add(key);
}
/** {@inheritDoc} */
- @Override public boolean onNodeLeft(UUID nodeId) {
- boolean res = registerResponse(nodeId);
-
- if (res && msgLog.isDebugEnabled()) {
- msgLog.debug("DTH update fut, node left [futId=" + futVer + ", writeVer=" + writeVer +
- ", node=" + nodeId + ']');
- }
-
- return res;
- }
-
- /**
- * @param nodeId Node ID.
- * @return {@code True} if request found.
- */
- private boolean registerResponse(UUID nodeId) {
- int resCnt0;
-
- GridDhtAtomicUpdateRequest req = mappings.get(nodeId);
-
- if (req != null) {
- synchronized (this) {
- if (req.onResponse()) {
- resCnt0 = resCnt;
-
- resCnt0 += 1;
-
- resCnt = resCnt0;
- }
- else
- return false;
- }
-
- if (resCnt0 == mappings.size())
- onDone();
-
- return true;
- }
-
- return false;
+ @Override protected void addNearKey(KeyCacheObject key, Collection<UUID> readers) {
+ keys.add(key);
}
/** {@inheritDoc} */
- @Override public boolean trackable() {
- return true;
- }
+ @Override protected void addNearReaderEntry(GridDhtCacheEntry entry) {
+ if (nearReadersEntries == null)
+ nearReadersEntries = new HashMap<>();
- /** {@inheritDoc} */
- @Override public void markNotTrackable() {
- // No-op.
+ nearReadersEntries.put(entry.key(), entry);
}
/** {@inheritDoc} */
- @Override public IgniteInternalFuture<Void> completeFuture(AffinityTopologyVersion topVer) {
- if (waitForExchange && updateReq.topologyVersion().compareTo(topVer) < 0)
- return this;
-
- return null;
- }
-
- /**
- * @param entry Entry to map.
- * @param val Value to write.
- * @param entryProcessor Entry processor.
- * @param ttl TTL (optional).
- * @param conflictExpireTime Conflict expire time (optional).
- * @param conflictVer Conflict version (optional).
- * @param addPrevVal If {@code true} sends previous value to backups.
- * @param prevVal Previous value.
- * @param updateCntr Partition update counter.
- */
- @SuppressWarnings("ForLoopReplaceableByForEach")
- public void addWriteEntry(GridDhtCacheEntry entry,
- @Nullable CacheObject val,
- EntryProcessor<Object, Object, Object> entryProcessor,
- long ttl,
- long conflictExpireTime,
- @Nullable GridCacheVersion conflictVer,
- boolean addPrevVal,
- @Nullable CacheObject prevVal,
- long updateCntr) {
- AffinityTopologyVersion topVer = updateReq.topologyVersion();
-
- List<ClusterNode> dhtNodes = cctx.dht().topology().nodes(entry.partition(), topVer);
-
- if (log.isDebugEnabled())
- log.debug("Mapping entry to DHT nodes [nodes=" + U.nodeIds(dhtNodes) + ", entry=" + entry + ']');
-
- CacheWriteSynchronizationMode syncMode = updateReq.writeSynchronizationMode();
-
- keys.add(entry.key());
-
- for (int i = 0; i < dhtNodes.size(); i++) {
- ClusterNode node = dhtNodes.get(i);
-
- UUID nodeId = node.id();
-
- if (!nodeId.equals(cctx.localNodeId())) {
- GridDhtAtomicUpdateRequest updateReq = mappings.get(nodeId);
-
- if (updateReq == null) {
- updateReq = new GridDhtAtomicUpdateRequest(
- cctx.cacheId(),
- nodeId,
- futVer,
- writeVer,
- syncMode,
- topVer,
- forceTransformBackups,
- this.updateReq.subjectId(),
- this.updateReq.taskNameHash(),
- forceTransformBackups ? this.updateReq.invokeArguments() : null,
- cctx.deploymentEnabled(),
- this.updateReq.keepBinary(),
- this.updateReq.skipStore());
-
- mappings.put(nodeId, updateReq);
- }
-
- updateReq.addWriteValue(entry.key(),
- val,
- entryProcessor,
- ttl,
- conflictExpireTime,
- conflictVer,
- addPrevVal,
- entry.partition(),
- prevVal,
- updateCntr);
- }
- }
- }
-
- /**
- * @param readers Entry readers.
- * @param entry Entry.
- * @param val Value.
- * @param entryProcessor Entry processor..
- * @param ttl TTL for near cache update (optional).
- * @param expireTime Expire time for near cache update (optional).
- */
- public void addNearWriteEntries(Iterable<UUID> readers,
- GridDhtCacheEntry entry,
- @Nullable CacheObject val,
- EntryProcessor<Object, Object, Object> entryProcessor,
- long ttl,
- long expireTime) {
- CacheWriteSynchronizationMode syncMode = updateReq.writeSynchronizationMode();
-
- keys.add(entry.key());
-
- AffinityTopologyVersion topVer = updateReq.topologyVersion();
-
- for (UUID nodeId : readers) {
- GridDhtAtomicUpdateRequest updateReq = mappings.get(nodeId);
-
- if (updateReq == null) {
- ClusterNode node = cctx.discovery().node(nodeId);
-
- // Node left the grid.
- if (node == null)
- continue;
-
- updateReq = new GridDhtAtomicUpdateRequest(
- cctx.cacheId(),
- nodeId,
- futVer,
- writeVer,
- syncMode,
- topVer,
- forceTransformBackups,
- this.updateReq.subjectId(),
- this.updateReq.taskNameHash(),
- forceTransformBackups ? this.updateReq.invokeArguments() : null,
- cctx.deploymentEnabled(),
- this.updateReq.keepBinary(),
- this.updateReq.skipStore());
-
- mappings.put(nodeId, updateReq);
- }
-
- if (nearReadersEntries == null)
- nearReadersEntries = new HashMap<>();
-
- nearReadersEntries.put(entry.key(), entry);
-
- updateReq.addNearWriteValue(entry.key(),
- val,
- entryProcessor,
- ttl,
- expireTime);
- }
- }
-
- /**
- * @param clsr Continuous query closure.
- */
- public void addContinuousQueryClosure(CI1<Boolean> clsr){
- assert !isDone() : this;
-
- if (cntQryClsrs == null)
- cntQryClsrs = new ArrayList<>(10);
-
- cntQryClsrs.add(clsr);
- }
-
- /** {@inheritDoc} */
- @Override public boolean onDone(@Nullable Void res, @Nullable Throwable err) {
- if (super.onDone(res, err)) {
- cctx.mvcc().removeAtomicFuture(version());
-
- boolean suc = err == null;
-
- if (!suc) {
- for (KeyCacheObject key : keys)
- updateRes.addFailedKey(key, err);
- }
-
- if (cntQryClsrs != null) {
- for (CI1<Boolean> clsr : cntQryClsrs)
- clsr.apply(suc);
- }
-
- if (updateReq.writeSynchronizationMode() == FULL_SYNC)
- completionCb.apply(updateReq, updateRes);
-
- return true;
- }
-
- return false;
- }
-
- /**
- * Sends requests to remote nodes.
- */
- public void map() {
- if (!mappings.isEmpty()) {
- for (GridDhtAtomicUpdateRequest req : mappings.values()) {
- try {
- cctx.io().send(req.nodeId(), req, cctx.ioPolicy());
-
- if (msgLog.isDebugEnabled()) {
- msgLog.debug("DTH update fut, sent request [futId=" + futVer +
- ", writeVer=" + writeVer + ", node=" + req.nodeId() + ']');
- }
- }
- catch (ClusterTopologyCheckedException ignored) {
- if (msgLog.isDebugEnabled()) {
- msgLog.debug("DTH update fut, failed to send request, node left [futId=" + futVer +
- ", writeVer=" + writeVer + ", node=" + req.nodeId() + ']');
- }
-
- registerResponse(req.nodeId());
- }
- catch (IgniteCheckedException e) {
- U.error(msgLog, "Failed to send request [futId=" + futVer +
- ", writeVer=" + writeVer + ", node=" + req.nodeId() + ']');
-
- registerResponse(req.nodeId());
- }
- }
- }
- else
- onDone();
-
- // Send response right away if no ACKs from backup is required.
- // Backups will send ACKs anyway, future will be completed after all backups have replied.
- if (updateReq.writeSynchronizationMode() != FULL_SYNC)
- completionCb.apply(updateReq, updateRes);
- }
-
- /**
- * Callback for backup update response.
- *
- * @param nodeId Backup node ID.
- * @param updateRes Update response.
- */
- public void onResult(UUID nodeId, GridDhtAtomicUpdateResponse updateRes) {
+ @Override public void onResult(UUID nodeId, GridDhtAtomicUpdateResponse updateRes) {
if (log.isDebugEnabled())
log.debug("Received DHT atomic update future result [nodeId=" + nodeId + ", updateRes=" + updateRes + ']');
@@ -462,16 +111,10 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void>
registerResponse(nodeId);
}
- /**
- * Deferred update response.
- *
- * @param nodeId Backup node ID.
- */
- public void onResult(UUID nodeId) {
- if (log.isDebugEnabled())
- log.debug("Received deferred DHT atomic update future result [nodeId=" + nodeId + ']');
-
- registerResponse(nodeId);
+ /** {@inheritDoc} */
+ @Override protected void addFailedKeys(GridNearAtomicUpdateResponse updateRes, Throwable err) {
+ for (KeyCacheObject key : keys)
+ updateRes.addFailedKey(key, err);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/88f38ac6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
index e2314f8..b733d7b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
@@ -487,44 +487,32 @@ public class GridNearAtomicFullUpdateRequest extends GridNearAtomicAbstractUpdat
return invokeArgs;
}
- /**
- * @return Flag indicating whether this is fast-map udpate.
- */
+ /** {@inheritDoc} */
@Override public boolean fastMap() {
return fastMap;
}
- /**
- * @return Topology locked flag.
- */
+ /** {@inheritDoc} */
@Override public boolean topologyLocked() {
return topLocked;
}
- /**
- * @return {@code True} if request sent from client node.
- */
+ /** {@inheritDoc} */
@Override public boolean clientRequest() {
return clientReq;
}
- /**
- * @return Return value flag.
- */
+ /** {@inheritDoc} */
@Override public boolean returnValue() {
return retval;
}
- /**
- * @return Skip write-through to a persistent storage.
- */
+ /** {@inheritDoc} */
@Override public boolean skipStore() {
return skipStore;
}
- /**
- * @return Keep binary flag.
- */
+ /** {@inheritDoc} */
@Override public boolean keepBinary() {
return keepBinary;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/88f38ac6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java
index eaf2f2c..bd231cf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java
@@ -667,9 +667,7 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
* @return {@code True} can use 'single' update requests.
*/
private boolean canUseSingleRequest(ClusterNode node) {
- assert node != null;
-
- return expiryPlc == null && node.version().compareToIgnoreTimestamp(SINGLE_UPDATE_REQUEST) >= 0;
+ return expiryPlc == null && node != null && node.version().compareToIgnoreTimestamp(SINGLE_UPDATE_REQUEST) >= 0;
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/88f38ac6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
index 304d031..10784fc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
@@ -59,7 +59,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
import org.apache.ignite.internal.processors.cache.GridCacheAffinityManager;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCacheDeploymentManager;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateFuture;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicAbstractUpdateFuture;
import org.apache.ignite.internal.processors.cache.query.CacheQueryType;
import org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryManager.JCacheQueryLocalListener;
import org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryManager.JCacheQueryRemoteFilter;
@@ -382,7 +382,7 @@ public class CacheContinuousQueryHandler<K, V> implements GridContinuousHandler
@Override public void onEntryUpdated(final CacheContinuousQueryEvent<K, V> evt,
boolean primary,
final boolean recordIgniteEvt,
- GridDhtAtomicUpdateFuture fut) {
+ GridDhtAtomicAbstractUpdateFuture fut) {
if (ignoreExpired && evt.getEventType() == EventType.EXPIRED)
return ;
http://git-wip-us.apache.org/repos/asf/ignite/blob/88f38ac6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryListener.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryListener.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryListener.java
index 8eca81c..84b22f9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryListener.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryListener.java
@@ -20,7 +20,7 @@ package org.apache.ignite.internal.processors.cache.query.continuous;
import java.util.Map;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateFuture;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicAbstractUpdateFuture;
import org.jetbrains.annotations.Nullable;
/**
@@ -41,7 +41,7 @@ public interface CacheContinuousQueryListener<K, V> {
* @param fut Dht atomic future.
*/
public void onEntryUpdated(CacheContinuousQueryEvent<K, V> evt, boolean primary,
- boolean recordIgniteEvt, @Nullable GridDhtAtomicUpdateFuture fut);
+ boolean recordIgniteEvt, @Nullable GridDhtAtomicAbstractUpdateFuture fut);
/**
* Listener unregistered callback.
http://git-wip-us.apache.org/repos/asf/ignite/blob/88f38ac6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
index 2863f3d..e2fbf52 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
@@ -56,7 +56,7 @@ import org.apache.ignite.internal.processors.cache.CacheObject;
import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
import org.apache.ignite.internal.processors.cache.GridCacheManagerAdapter;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateFuture;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicAbstractUpdateFuture;
import org.apache.ignite.internal.processors.continuous.GridContinuousHandler;
import org.apache.ignite.internal.processors.continuous.GridContinuousProcessor;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
@@ -245,7 +245,7 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
boolean primary,
boolean preload,
long updateCntr,
- @Nullable GridDhtAtomicUpdateFuture fut,
+ @Nullable GridDhtAtomicAbstractUpdateFuture fut,
AffinityTopologyVersion topVer
) throws IgniteCheckedException {
Map<UUID, CacheContinuousQueryListener> lsnrCol = updateListeners(internal, preload);
@@ -290,7 +290,7 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
boolean primary,
boolean preload,
long updateCntr,
- @Nullable GridDhtAtomicUpdateFuture fut,
+ @Nullable GridDhtAtomicAbstractUpdateFuture fut,
AffinityTopologyVersion topVer)
throws IgniteCheckedException
{
http://git-wip-us.apache.org/repos/asf/ignite/blob/88f38ac6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
index bf543cb..396629a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
@@ -26,7 +26,7 @@ import javax.cache.processor.EntryProcessorResult;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cache.eviction.EvictableEntry;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateFuture;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicAbstractUpdateFuture;
import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
import org.apache.ignite.internal.processors.cache.transactions.IgniteTxKey;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
@@ -542,7 +542,7 @@ public class GridCacheTestEntryEx extends GridMetadataAwareAdapter implements Gr
String taskName,
@Nullable CacheObject prevVal,
@Nullable Long updateCntr,
- @Nullable GridDhtAtomicUpdateFuture fut) throws IgniteCheckedException,
+ @Nullable GridDhtAtomicAbstractUpdateFuture fut) throws IgniteCheckedException,
GridCacheEntryRemovedException {
assert false;
[04/50] [abbrv] ignite git commit: IGNITE-3873: Added WiX script to
generate ODBC installer.
Posted by sb...@apache.org.
IGNITE-3873: Added WiX script to generate ODBC installer.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/cdae2ab7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/cdae2ab7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/cdae2ab7
Branch: refs/heads/master
Commit: cdae2ab76d403aef9a0bd209fc7497dc6cfdfc08
Parents: ac660dc
Author: Igor Sapego <is...@gridgain.com>
Authored: Wed Nov 9 16:25:30 2016 +0300
Committer: Igor Sapego <is...@gridgain.com>
Committed: Wed Nov 9 16:25:30 2016 +0300
----------------------------------------------------------------------
modules/platforms/cpp/DEVNOTES.txt | 12 ++
modules/platforms/cpp/odbc/README.txt | 23 ++--
.../cpp/odbc/install/ignite-odbc-amd64.wxs | 114 +++++++++++++++++++
.../cpp/odbc/install/ignite-odbc-x86.wxs | 114 +++++++++++++++++++
pom.xml | 8 ++
5 files changed, 263 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/cdae2ab7/modules/platforms/cpp/DEVNOTES.txt
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/DEVNOTES.txt b/modules/platforms/cpp/DEVNOTES.txt
index cd0a154..924b0d8 100644
--- a/modules/platforms/cpp/DEVNOTES.txt
+++ b/modules/platforms/cpp/DEVNOTES.txt
@@ -58,6 +58,18 @@ Building binaries:
* If you want to build ODBC driver then you should explicitly build it as it is disabled
in the solution file by default. In IDE it can be done by clicking on the ODBC project
with the right mouse button and choosing "Build" option.
+
+Building installers:
+ * Install WiX Toolset if you do not have it yet.
+ * Add WiX Toolset "bin" directory to your PATH environmental variable.
+ * Build ODBC drivers: Release|x64 for 64-bit version and Release|Win32 for 32-bit version.
+ * Open terminal and navigate to the directory $IGNITE_HOME/platforms/cpp/odbc/install
+ * Execute the following commands one by one to build 32-bit driver:
+ * candle.exe ignite-odbc-x86.wxs
+ * light.exe -ext WixUIExtension ignite-odbc-x86.wixobj
+ * Execute the following commands one by one to build 64-bit driver:
+ * candle.exe ignite-odbc-amd64.wxs
+ * light.exe -ext WixUIExtension ignite-odbc-amd64.wixobj
Building in later versions of Visual Studio:
* Open project\vs\ignite.sln or project\vs\ignite_86.sln in Visual Studio
http://git-wip-us.apache.org/repos/asf/ignite/blob/cdae2ab7/modules/platforms/cpp/odbc/README.txt
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/README.txt b/modules/platforms/cpp/odbc/README.txt
index 8f0c805..fe40a5c 100644
--- a/modules/platforms/cpp/odbc/README.txt
+++ b/modules/platforms/cpp/odbc/README.txt
@@ -58,14 +58,21 @@ ODBC driver you should perfrom the following steps:
Installing ODBC driver on Windows
=======================================
-For 32-bit Windows you should use 32-bit version of the driver while for the
-64-bit Windows you can use 64-bit driver as well as 32-bit.
-
-To install driver on Windows you should first choose a directory on your
-filesystem where your driver or drivers will be located. Once you have
-choosen the place you should put your driver there and ensure that all driver
-dependencies can be resolved i.e. they can be found either in the %PATH% or
-in the same directory as the driver.
+Note, that for 32-bit Windows you should use 32-bit version of the driver
+while for the 64-bit Windows you can use both 64-bit and 32-bit versions of the
+driver. You may want to use 32-bit driver on 64-bit system for 32-bit
+applications.
+
+There are two ways to install ODBC driver currently. The first one is to use
+32-bit or 64-bit installer. This is the most simple way and you are recommended
+to stick to it by default.
+
+However there is also another way to install driver manually using scripts. If
+you choose this method you should first choose a directory on your filesystem
+where your driver or drivers will be located. Once you have choosen the place
+you should put your driver there and ensure that all driver dependencies can be
+resolved i.e. they can be found either in the %PATH% or in the same directory
+as the driver.
After that you should use one of the install scripts from the directory
%IGNITE_HOME%/platforms/cpp/odbc/install. Note that most likely you will
http://git-wip-us.apache.org/repos/asf/ignite/blob/cdae2ab7/modules/platforms/cpp/odbc/install/ignite-odbc-amd64.wxs
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/install/ignite-odbc-amd64.wxs b/modules/platforms/cpp/odbc/install/ignite-odbc-amd64.wxs
new file mode 100644
index 0000000..cb6ab54
--- /dev/null
+++ b/modules/platforms/cpp/odbc/install/ignite-odbc-amd64.wxs
@@ -0,0 +1,114 @@
+<?xml version='1.0' encoding='windows-1252'?>
+
+<!--
+ 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.
+-->
+
+<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
+ <Product Name='Apache Ignite ODBC 64-bit Driver' Manufacturer='The Apache Software Foundation'
+ Id='F3E308E4-910C-4AF5-82DE-2ACF4D64830E'
+ UpgradeCode='1D7AEFDF-6CD2-4FB5-88F2-811A89832D6D'
+ Language='1033' Codepage='1252' Version='1.6.7.0'>
+
+ <Package Id='*' Keywords='Installer' Description="Apache Ignite ODBC 64-bit Driver Installer"
+ Comments='Apache, Apache Ignite, the Apache feather and the Apache Ignite logo are trademarks of The Apache Software Foundation.'
+ Platform="x64" InstallerVersion='200' Languages='1033' Compressed='yes' SummaryCodepage='1252' />
+
+ <Media Id='1' Cabinet='package.cab' EmbedCab='yes' DiskPrompt='CD-ROM #1' />
+ <Property Id='DiskPrompt' Value="Apache Ignite ODBC 64-bit Driver Installation [1]" />
+
+ <Directory Id='TARGETDIR' Name='SourceDir'>
+ <Directory Id='ProgramFiles64Folder' Name='ProgramFiles'>
+ <Directory Id='ApacheIgnite' Name='Apache Ignite'>
+ <Directory Id='INSTALLDIR' Name='ODBC Driver'>
+ <Component Id='Driver' Guid='E5F0DDF2-DD3C-4196-8A08-70921858A52F' Win64='yes'>
+ <File Id='IgniteOdbcDll' Name='ignite.odbc.dll' DiskId='1' Source='../../project/vs/x64/Release/ignite.odbc.dll' KeyPath='yes'/>
+
+ <RegistryValue Root='HKLM' Key='Software\ODBC\ODBCINST.INI\ODBC Drivers' Name='Apache Ignite' Type='string' Value='Installed'/>
+
+ <RegistryKey Id='OdbcDriverRegInfo' Root='HKLM' Key='Software\ODBC\ODBCINST.INI\Apache Ignite' ForceCreateOnInstall='yes' ForceDeleteOnUninstall='yes'>
+ <RegistryValue Type='string' Name='DriverODBCVer' Value='03.00'/>
+ <RegistryValue Type='string' Name='Driver' Value='[#IgniteOdbcDll]'/>
+ <RegistryValue Type='string' Name='Setup' Value='[#IgniteOdbcDll]'/>
+ <RegistryValue Type='integer' Name='UsageCount' Value='1'/>
+ </RegistryKey>
+
+ </Component>
+ </Directory>
+ </Directory>
+ </Directory>
+ </Directory>
+
+ <Feature Id='Complete' Title='ODBC Driver' Description='Apache Ignite ODBC Driver.' Level='1'
+ ConfigurableDirectory='INSTALLDIR' Absent='disallow' AllowAdvertise='no' InstallDefault='local'>
+ <ComponentRef Id='Driver' />
+ </Feature>
+
+ <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
+
+ <UI Id="WixUI_InstallDir">
+ <TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
+ <TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
+ <TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
+
+ <Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
+ <Property Id="WixUI_Mode" Value="InstallDir" />
+
+ <DialogRef Id="BrowseDlg" />
+ <DialogRef Id="DiskCostDlg" />
+ <DialogRef Id="ErrorDlg" />
+ <DialogRef Id="FatalError" />
+ <DialogRef Id="FilesInUse" />
+ <DialogRef Id="MsiRMFilesInUse" />
+ <DialogRef Id="PrepareDlg" />
+ <DialogRef Id="ProgressDlg" />
+ <DialogRef Id="ResumeDlg" />
+ <DialogRef Id="UserExit" />
+
+ <Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath" Order="3">1</Publish>
+ <Publish Dialog="BrowseDlg" Control="OK" Event="SpawnDialog" Value="InvalidDirDlg" Order="4"><![CDATA[WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
+
+ <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
+
+ <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg">NOT Installed</Publish>
+ <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">Installed AND PATCH</Publish>
+
+ <Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
+ <Publish Dialog="InstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
+ <Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath" Order="2">NOT WIXUI_DONTVALIDATEPATH</Publish>
+ <Publish Dialog="InstallDirDlg" Control="Next" Event="SpawnDialog" Value="InvalidDirDlg" Order="3"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
+ <Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="4">WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID="1"</Publish>
+ <Publish Dialog="InstallDirDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
+ <Publish Dialog="InstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
+
+ <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="InstallDirDlg" Order="1">NOT Installed</Publish>
+ <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed AND NOT PATCH</Publish>
+ <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">Installed AND PATCH</Publish>
+
+ <Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>
+
+ <Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
+ <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
+ <Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>
+
+ <Property Id="ARPNOMODIFY" Value="1" />
+ </UI>
+
+ <UIRef Id="WixUI_Common" />
+ <UIRef Id="WixUI_ErrorProgressText" />
+
+ </Product>
+</Wix>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/cdae2ab7/modules/platforms/cpp/odbc/install/ignite-odbc-x86.wxs
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/install/ignite-odbc-x86.wxs b/modules/platforms/cpp/odbc/install/ignite-odbc-x86.wxs
new file mode 100644
index 0000000..6ee1cdf
--- /dev/null
+++ b/modules/platforms/cpp/odbc/install/ignite-odbc-x86.wxs
@@ -0,0 +1,114 @@
+<?xml version='1.0' encoding='windows-1252'?>
+
+<!--
+ 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.
+-->
+
+<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
+ <Product Name='Apache Ignite ODBC 32-bit Driver' Manufacturer='The Apache Software Foundation'
+ Id='D39CBABA-1E21-4701-AA5C-91EDA07B383B'
+ UpgradeCode='743902A4-365C-424E-B226-5B2898A3941E'
+ Language='1033' Codepage='1252' Version='1.6.7.0'>
+
+ <Package Id='*' Keywords='Installer' Description="Apache Ignite ODBC 32-bit Driver Installer"
+ Comments='Apache, Apache Ignite, the Apache feather and the Apache Ignite logo are trademarks of The Apache Software Foundation.'
+ InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' />
+
+ <Media Id='1' Cabinet='package.cab' EmbedCab='yes' DiskPrompt='CD-ROM #1' />
+ <Property Id='DiskPrompt' Value="Apache Ignite ODBC 32-bit Driver Installation [1]" />
+
+ <Directory Id='TARGETDIR' Name='SourceDir'>
+ <Directory Id='ProgramFilesFolder' Name='ProgramFiles'>
+ <Directory Id='ApacheIgnite' Name='Apache Ignite'>
+ <Directory Id='INSTALLDIR' Name='ODBC Driver'>
+ <Component Id='Driver' Guid='4AFA26EE-C639-4EF2-A9B2-281119BB4BB5'>
+ <File Id='IgniteOdbcDll' Name='ignite.odbc.dll' DiskId='1' Source='../../project/vs/Win32/Release/ignite.odbc.dll' KeyPath='yes'/>
+
+ <RegistryValue Root='HKLM' Key='Software\ODBC\ODBCINST.INI\ODBC Drivers' Name='Apache Ignite' Type='string' Value='Installed'/>
+
+ <RegistryKey Id='OdbcDriverRegInfo' Root='HKLM' Key='Software\ODBC\ODBCINST.INI\Apache Ignite' ForceCreateOnInstall='yes' ForceDeleteOnUninstall='yes'>
+ <RegistryValue Type='string' Name='DriverODBCVer' Value='03.00'/>
+ <RegistryValue Type='string' Name='Driver' Value='[#IgniteOdbcDll]'/>
+ <RegistryValue Type='string' Name='Setup' Value='[#IgniteOdbcDll]'/>
+ <RegistryValue Type='integer' Name='UsageCount' Value='1'/>
+ </RegistryKey>
+
+ </Component>
+ </Directory>
+ </Directory>
+ </Directory>
+ </Directory>
+
+ <Feature Id='Complete' Title='ODBC Driver' Description='Apache Ignite ODBC Driver.' Level='1'
+ ConfigurableDirectory='INSTALLDIR' Absent='disallow' AllowAdvertise='no' InstallDefault='local'>
+ <ComponentRef Id='Driver' />
+ </Feature>
+
+ <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
+
+ <UI Id="WixUI_InstallDir">
+ <TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
+ <TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
+ <TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
+
+ <Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
+ <Property Id="WixUI_Mode" Value="InstallDir" />
+
+ <DialogRef Id="BrowseDlg" />
+ <DialogRef Id="DiskCostDlg" />
+ <DialogRef Id="ErrorDlg" />
+ <DialogRef Id="FatalError" />
+ <DialogRef Id="FilesInUse" />
+ <DialogRef Id="MsiRMFilesInUse" />
+ <DialogRef Id="PrepareDlg" />
+ <DialogRef Id="ProgressDlg" />
+ <DialogRef Id="ResumeDlg" />
+ <DialogRef Id="UserExit" />
+
+ <Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath" Order="3">1</Publish>
+ <Publish Dialog="BrowseDlg" Control="OK" Event="SpawnDialog" Value="InvalidDirDlg" Order="4"><![CDATA[WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
+
+ <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
+
+ <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg">NOT Installed</Publish>
+ <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">Installed AND PATCH</Publish>
+
+ <Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
+ <Publish Dialog="InstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
+ <Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath" Order="2">NOT WIXUI_DONTVALIDATEPATH</Publish>
+ <Publish Dialog="InstallDirDlg" Control="Next" Event="SpawnDialog" Value="InvalidDirDlg" Order="3"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
+ <Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="4">WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID="1"</Publish>
+ <Publish Dialog="InstallDirDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
+ <Publish Dialog="InstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
+
+ <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="InstallDirDlg" Order="1">NOT Installed</Publish>
+ <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed AND NOT PATCH</Publish>
+ <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">Installed AND PATCH</Publish>
+
+ <Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>
+
+ <Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
+ <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
+ <Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>
+
+ <Property Id="ARPNOMODIFY" Value="1" />
+ </UI>
+
+ <UIRef Id="WixUI_Common" />
+ <UIRef Id="WixUI_ErrorProgressText" />
+
+ </Product>
+</Wix>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/cdae2ab7/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 36051b4..8069e38 100644
--- a/pom.xml
+++ b/pom.xml
@@ -892,6 +892,14 @@
</replaceregexp>
<replaceregexp byline="true" encoding="UTF-8">
+ <regexp pattern="(Version=.+)\d+\.\d+\.\d+\.\d+(.+)" />
+ <substitution expression="\1${new.client.version}\2" />
+ <fileset dir="${basedir}/">
+ <include name="**/*.wxs" />
+ </fileset>
+ </replaceregexp>
+
+ <replaceregexp byline="true" encoding="UTF-8">
<regexp pattern="(define GG_VERSION_STR_WIN ")\d+\.\d+\.\d+(\.\d+)?(")" />
<substitution expression="\1${new.client.version}\3" />
<fileset dir="${basedir}/">
[28/50] [abbrv] ignite git commit: IGNITE-4163 Fixed load range
queries.
Posted by sb...@apache.org.
IGNITE-4163 Fixed load range queries.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e39888a0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e39888a0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e39888a0
Branch: refs/heads/master
Commit: e39888a08da313bec4d30f96488eccb36b4abacc
Parents: 85a4b96
Author: Vasiliy Sisko <vs...@gridgain.com>
Authored: Thu Nov 17 11:41:05 2016 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Thu Nov 17 11:41:05 2016 +0700
----------------------------------------------------------------------
.../ignite/cache/store/jdbc/CacheAbstractJdbcStore.java | 2 +-
.../ignite/cache/store/jdbc/dialect/BasicJdbcDialect.java | 4 ++--
.../apache/ignite/cache/store/jdbc/dialect/DB2Dialect.java | 8 ++++++++
.../ignite/cache/store/jdbc/dialect/OracleDialect.java | 8 ++++++++
.../ignite/cache/store/jdbc/dialect/SQLServerDialect.java | 8 ++++++++
5 files changed, 27 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e39888a0/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
index 4eb5b56..4bfd92b 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java
@@ -1982,7 +1982,7 @@ public abstract class CacheAbstractJdbcStore<K, V> implements CacheStore<K, V>,
Map<String, Integer> colIdxs = U.newHashMap(meta.getColumnCount());
for (int i = 1; i <= meta.getColumnCount(); i++)
- colIdxs.put(meta.getColumnLabel(i), i);
+ colIdxs.put(meta.getColumnLabel(i).toUpperCase(), i);
while (rs.next()) {
K1 key = buildObject(em.cacheName, em.keyType(), em.keyKind(), em.keyColumns(), em.keyCols, colIdxs, rs);
http://git-wip-us.apache.org/repos/asf/ignite/blob/e39888a0/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/BasicJdbcDialect.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/BasicJdbcDialect.java b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/BasicJdbcDialect.java
index 5fa564b..3ab112a 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/BasicJdbcDialect.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/BasicJdbcDialect.java
@@ -157,8 +157,8 @@ public class BasicJdbcDialect implements JdbcDialect {
@Override public String loadCacheSelectRangeQuery(String fullTblName, Collection<String> keyCols) {
String cols = mkString(keyCols, ",");
- return String.format("SELECT %s FROM (SELECT %s, ROWNUM() AS rn FROM %s ORDER BY %s) WHERE mod(rn, ?) = 0",
- cols, cols, fullTblName, cols);
+ return String.format("SELECT %1$s FROM (SELECT %1$s, ROW_NUMBER() OVER() AS rn FROM (SELECT %1$s FROM %2$s ORDER BY %1$s) AS tbl) AS tbl WHERE mod(rn, ?) = 0",
+ cols, fullTblName);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/e39888a0/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/DB2Dialect.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/DB2Dialect.java b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/DB2Dialect.java
index 4bae14a..551782e 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/DB2Dialect.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/DB2Dialect.java
@@ -29,6 +29,14 @@ public class DB2Dialect extends BasicJdbcDialect {
private static final long serialVersionUID = 0L;
/** {@inheritDoc} */
+ @Override public String loadCacheSelectRangeQuery(String fullTblName, Collection<String> keyCols) {
+ String cols = mkString(keyCols, ",");
+
+ return String.format("SELECT %1$s FROM (SELECT %1$s, ROW_NUMBER() OVER(ORDER BY %1$s) AS rn FROM %2$s) WHERE mod(rn, ?) = 0 ORDER BY %1$s",
+ cols, fullTblName);
+ }
+
+ /** {@inheritDoc} */
@Override public boolean hasMerge() {
return true;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e39888a0/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/OracleDialect.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/OracleDialect.java b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/OracleDialect.java
index a9efe0d..e268b24 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/OracleDialect.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/OracleDialect.java
@@ -34,6 +34,14 @@ public class OracleDialect extends BasicJdbcDialect {
}
/** {@inheritDoc} */
+ @Override public String loadCacheSelectRangeQuery(String fullTblName, Collection<String> keyCols) {
+ String cols = mkString(keyCols, ",");
+
+ return String.format("SELECT %1$s FROM (SELECT %1$s, ROWNUM AS rn FROM (SELECT %1$s FROM %2$s ORDER BY %1$s)) WHERE mod(rn, ?) = 0",
+ cols, fullTblName);
+ }
+
+ /** {@inheritDoc} */
@Override public String mergeQuery(String fullTblName, Collection<String> keyCols, Collection<String> uniqCols) {
Collection<String> cols = F.concat(false, keyCols, uniqCols);
http://git-wip-us.apache.org/repos/asf/ignite/blob/e39888a0/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/SQLServerDialect.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/SQLServerDialect.java b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/SQLServerDialect.java
index 883918f..ace1d3f 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/SQLServerDialect.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/dialect/SQLServerDialect.java
@@ -34,6 +34,14 @@ public class SQLServerDialect extends BasicJdbcDialect {
}
/** {@inheritDoc} */
+ @Override public String loadCacheSelectRangeQuery(String fullTblName, Collection<String> keyCols) {
+ String cols = mkString(keyCols, ",");
+
+ return String.format("SELECT %1$s FROM (SELECT %1$s, ROW_NUMBER() OVER(ORDER BY %1$s) AS rn FROM %2$s) tbl WHERE rn %% ? = 0 ORDER BY %1$s",
+ cols, fullTblName);
+ }
+
+ /** {@inheritDoc} */
@Override public boolean hasMerge() {
return true;
}
[20/50] [abbrv] ignite git commit: IGNITE-4053: Moved task error
output from console to logger. This closes #1160.
Posted by sb...@apache.org.
IGNITE-4053: Moved task error output from console to logger. This closes #1160.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8bb8bdda
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8bb8bdda
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8bb8bdda
Branch: refs/heads/master
Commit: 8bb8bdda2e846dcc92a2fd449e64d7594b2700ed
Parents: a70f0ba
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Fri Nov 11 15:01:14 2016 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Fri Nov 11 15:01:14 2016 +0300
----------------------------------------------------------------------
.../internal/ComputeTaskInternalFuture.java | 11 +++
.../internal/util/future/GridFutureAdapter.java | 12 ++-
...ComputeJobExecutionErrorToLogManualTest.java | 88 ++++++++++++++++++++
3 files changed, 109 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/8bb8bdda/modules/core/src/main/java/org/apache/ignite/internal/ComputeTaskInternalFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/ComputeTaskInternalFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/ComputeTaskInternalFuture.java
index d511480..d6c54d7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/ComputeTaskInternalFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/ComputeTaskInternalFuture.java
@@ -24,6 +24,7 @@ import java.util.Map;
import java.util.UUID;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
+import org.apache.ignite.IgniteLogger;
import org.apache.ignite.compute.ComputeJobSibling;
import org.apache.ignite.compute.ComputeTask;
import org.apache.ignite.compute.ComputeTaskFuture;
@@ -59,6 +60,9 @@ public class ComputeTaskInternalFuture<R> extends GridFutureAdapter<R> {
@GridToStringExclude
private ComputeFuture<R> userFut;
+ /** */
+ private transient IgniteLogger log;
+
/**
* @param ses Task session instance.
* @param ctx Kernal context.
@@ -71,6 +75,8 @@ public class ComputeTaskInternalFuture<R> extends GridFutureAdapter<R> {
this.ctx = ctx;
userFut = new ComputeFuture<>(this);
+
+ log = ctx.log(ComputeTaskInternalFuture.class);
}
/**
@@ -247,6 +253,11 @@ public class ComputeTaskInternalFuture<R> extends GridFutureAdapter<R> {
return S.toString(ComputeTaskInternalFuture.class, this, "super", super.toString());
}
+ /** {@inheritDoc} */
+ @Override public IgniteLogger logger() {
+ return log;
+ }
+
/**
*
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/8bb8bdda/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridFutureAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridFutureAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridFutureAdapter.java
index ea7a202..2cd534e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridFutureAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridFutureAdapter.java
@@ -21,6 +21,7 @@ import java.util.Arrays;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.AbstractQueuedSynchronizer;
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteLogger;
import org.apache.ignite.internal.IgniteFutureCancelledCheckedException;
import org.apache.ignite.internal.IgniteFutureTimeoutCheckedException;
import org.apache.ignite.internal.IgniteInternalFuture;
@@ -263,11 +264,11 @@ public class GridFutureAdapter<R> extends AbstractQueuedSynchronizer implements
lsnr.apply(this);
}
catch (IllegalStateException e) {
- U.error(null, "Failed to notify listener (is grid stopped?) [fut=" + this +
+ U.error(logger(), "Failed to notify listener (is grid stopped?) [fut=" + this +
", lsnr=" + lsnr + ", err=" + e.getMessage() + ']', e);
}
catch (RuntimeException | Error e) {
- U.error(null, "Failed to notify listener: " + lsnr, e);
+ U.error(logger(), "Failed to notify listener: " + lsnr, e);
throw e;
}
@@ -413,6 +414,13 @@ public class GridFutureAdapter<R> extends AbstractQueuedSynchronizer implements
return s == INIT ? "INIT" : s == CANCELLED ? "CANCELLED" : "DONE";
}
+ /**
+ * @return Logger instance.
+ */
+ @Nullable public IgniteLogger logger() {
+ return null;
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(GridFutureAdapter.class, this, "state", state());
http://git-wip-us.apache.org/repos/asf/ignite/blob/8bb8bdda/modules/core/src/test/java/org/apache/ignite/internal/processors/compute/GridComputeJobExecutionErrorToLogManualTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/compute/GridComputeJobExecutionErrorToLogManualTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/compute/GridComputeJobExecutionErrorToLogManualTest.java
new file mode 100644
index 0000000..691bc9f
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/compute/GridComputeJobExecutionErrorToLogManualTest.java
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.compute;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCompute;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.lang.IgniteFuture;
+import org.apache.ignite.lang.IgniteInClosure;
+import org.apache.ignite.lang.IgniteRunnable;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ * Manual test to reproduce IGNITE-4053
+ */
+public class GridComputeJobExecutionErrorToLogManualTest extends GridCommonAbstractTest {
+ /** */
+ private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+ /** */
+ private static final int GRID_CNT = 2;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+ disco.setIpFinder(ipFinder);
+
+ cfg.setDiscoverySpi(disco);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ startGridsMultiThreaded(GRID_CNT, true);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ stopAllGrids();
+ }
+
+ /**
+ * @throws Exception If fails.
+ */
+ public void testRuntimeException() throws Exception {
+ Ignite ignite = grid(0);
+
+ IgniteCompute async = ignite.compute().withAsync();
+ async.run(new IgniteRunnable() {
+ @Override public void run() {
+ try {
+ Thread.sleep(500);
+ }
+ catch (InterruptedException e) {
+ // No-op.
+ }
+ }
+ });
+
+ async.future().listen(new IgniteInClosure<IgniteFuture<Object>>() {
+ @Override public void apply(IgniteFuture<Object> future) {
+ throw new RuntimeException();
+ }
+ });
+ }
+}
\ No newline at end of file
[31/50] [abbrv] ignite git commit: IGNITE-3443 Implemented metrics
for queries monitoring.
Posted by sb...@apache.org.
IGNITE-3443 Implemented metrics for queries monitoring.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0234f673
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0234f673
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0234f673
Branch: refs/heads/master
Commit: 0234f67390c88dceefd6e62de98adb922b4ba9ac
Parents: 3eacc0b
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Mon Nov 21 17:40:50 2016 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Mon Nov 21 17:40:50 2016 +0700
----------------------------------------------------------------------
.../java/org/apache/ignite/IgniteCache.java | 21 +-
.../ignite/cache/query/QueryDetailMetrics.java | 98 ++++
.../apache/ignite/cache/query/QueryMetrics.java | 2 +-
.../configuration/CacheConfiguration.java | 30 +
.../processors/cache/GridCacheUtilityKey.java | 6 +-
.../processors/cache/IgniteCacheProxy.java | 59 +-
.../processors/cache/query/CacheQuery.java | 1 -
.../processors/cache/query/CacheQueryType.java | 2 +-
.../cache/query/GridCacheQueryAdapter.java | 10 -
.../GridCacheQueryDetailMetricsAdapter.java | 248 ++++++++
.../query/GridCacheQueryDetailMetricsKey.java | 82 +++
.../query/GridCacheQueryFutureAdapter.java | 2 -
.../cache/query/GridCacheQueryManager.java | 149 ++++-
.../query/GridCacheQueryMetricsAdapter.java | 27 +-
.../processors/query/GridQueryProcessor.java | 102 ++--
.../internal/util/GridBoundedPriorityQueue.java | 68 +++
.../cache/VisorCacheQueryDetailMetrics.java | 167 ++++++
...sorCacheQueryDetailMetricsCollectorTask.java | 146 +++++
.../VisorCacheResetQueryDetailMetricsTask.java | 71 +++
.../cache/VisorCacheResetQueryMetricsTask.java | 8 +-
.../internal/visor/util/VisorTaskUtils.java | 26 +-
.../resources/META-INF/classnames.properties | 75 ++-
.../utils/GridBoundedPriorityQueueSelfTest.java | 114 ++++
.../multijvm/IgniteCacheProcessProxy.java | 16 +
.../testsuites/IgniteLangSelfTestSuite.java | 4 +-
...CacheAbstractQueryDetailMetricsSelfTest.java | 572 +++++++++++++++++++
.../CacheAbstractQueryMetricsSelfTest.java | 305 ++++++----
.../CacheLocalQueryDetailMetricsSelfTest.java | 33 ++
...edQueryDetailMetricsDistributedSelfTest.java | 33 ++
...titionedQueryDetailMetricsLocalSelfTest.java | 33 ++
...edQueryDetailMetricsDistributedSelfTest.java | 33 ++
...plicatedQueryDetailMetricsLocalSelfTest.java | 33 ++
.../IgniteCacheQuerySelfTestSuite2.java | 12 +
.../commands/cache/VisorCacheCommand.scala | 7 +-
34 files changed, 2338 insertions(+), 257 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
index 2290fc5..7eb6e91 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
@@ -43,6 +43,7 @@ import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.CachePeekMode;
import org.apache.ignite.cache.query.Query;
import org.apache.ignite.cache.query.QueryCursor;
+import org.apache.ignite.cache.query.QueryDetailMetrics;
import org.apache.ignite.cache.query.QueryMetrics;
import org.apache.ignite.cache.query.ScanQuery;
import org.apache.ignite.cache.query.SpiQuery;
@@ -326,6 +327,24 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
public QueryMetrics queryMetrics();
/**
+ * Reset query metrics.
+ */
+ public void resetQueryMetrics();
+
+ /**
+ * Gets query detail metrics.
+ * Query detail metrics could be enabled via {@link CacheConfiguration#setQueryDetailMetricsSize(int)} method.
+ *
+ * @return Metrics.
+ */
+ public Collection<? extends QueryDetailMetrics> queryDetailMetrics();
+
+ /**
+ * Reset query detail metrics.
+ */
+ public void resetQueryDetailMetrics();
+
+ /**
* Attempts to evict all entries associated with keys. Note,
* that entry will be evicted only if it's not used (not
* participating in any locks or transactions).
@@ -335,7 +354,7 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
public void localEvict(Collection<? extends K> keys);
/**
- * Peeks at in-memory cached value using default optinal peek mode.
+ * Peeks at in-memory cached value using default optional peek mode.
* <p>
* This method will not load value from any persistent store or from a remote node.
* <h2 class="header">Transactions</h2>
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/java/org/apache/ignite/cache/query/QueryDetailMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/QueryDetailMetrics.java b/modules/core/src/main/java/org/apache/ignite/cache/query/QueryDetailMetrics.java
new file mode 100644
index 0000000..0b01880
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/cache/query/QueryDetailMetrics.java
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.cache.query;
+
+import org.apache.ignite.configuration.CacheConfiguration;
+
+/**
+ * Query metrics aggregated by query type and its textual representation.
+ *
+ * Query detail metrics could be enabled via {@link CacheConfiguration#setQueryDetailMetricsSize(int)} method.
+ */
+public interface QueryDetailMetrics {
+ /**
+ * @return Query type.
+ */
+ public String queryType();
+
+ /**
+ * @return Textual representation of query.
+ */
+ public String query();
+
+ /**
+ * @return Cache where query was executed.
+ */
+ public String cache();
+
+ /**
+ * Gets total number execution of query.
+ *
+ * @return Number of executions.
+ */
+ public int executions();
+
+ /**
+ * Gets number of completed execution of query.
+ *
+ * @return Number of completed executions.
+ */
+ public int completions();
+
+ /**
+ * Gets number of times a query execution failed.
+ *
+ * @return Number of times a query execution failed.
+ */
+ public int failures();
+
+ /**
+ * Gets minimum execution time of query.
+ *
+ * @return Minimum execution time of query.
+ */
+ public long minimumTime();
+
+ /**
+ * Gets maximum execution time of query.
+ *
+ * @return Maximum execution time of query.
+ */
+ public long maximumTime();
+
+ /**
+ * Gets average execution time of query.
+ *
+ * @return Average execution time of query.
+ */
+ public double averageTime();
+
+ /**
+ * Gets total time of all query executions.
+ *
+ * @return Total time of all query executions.
+ */
+ public long totalTime();
+
+ /**
+ * Gets latest query start time.
+ *
+ * @return Latest time query was stared.
+ */
+ public long lastStartTime();
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/java/org/apache/ignite/cache/query/QueryMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/QueryMetrics.java b/modules/core/src/main/java/org/apache/ignite/cache/query/QueryMetrics.java
index e376561..d0f0a50 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/query/QueryMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/query/QueryMetrics.java
@@ -59,4 +59,4 @@ public interface QueryMetrics {
* @return Total number of times a query execution failed.
*/
public int fails();
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/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 f65bf52..f9c114b 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
@@ -209,6 +209,9 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
/** Default timeout after which long query warning will be printed. */
public static final long DFLT_LONG_QRY_WARN_TIMEOUT = 3000;
+ /** Default number of queries detail metrics to collect. */
+ public static final int DFLT_QRY_DETAIL_METRICS_SIZE = 0;
+
/** Default size for onheap SQL row cache size. */
public static final int DFLT_SQL_ONHEAP_ROW_CACHE_SIZE = 10 * 1024;
@@ -361,6 +364,9 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
/** */
private long longQryWarnTimeout = DFLT_LONG_QRY_WARN_TIMEOUT;
+ /** */
+ private int qryDetailMetricsSz = DFLT_QRY_DETAIL_METRICS_SIZE;
+
/**
* Flag indicating whether data can be read from backup.
* If {@code false} always get data from primary node (never from backup).
@@ -468,6 +474,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
nodeFilter = cc.getNodeFilter();
pluginCfgs = cc.getPluginConfigurations();
qryEntities = cc.getQueryEntities() == Collections.<QueryEntity>emptyList() ? null : cc.getQueryEntities();
+ qryDetailMetricsSz = cc.getQueryDetailMetricsSize();
readFromBackup = cc.isReadFromBackup();
rebalanceBatchSize = cc.getRebalanceBatchSize();
rebalanceBatchesPrefetchCount = cc.getRebalanceBatchesPrefetchCount();
@@ -1824,6 +1831,29 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
}
/**
+ * Gets size of queries detail metrics that will be stored in memory for monitoring purposes.
+ * If {@code 0} then history will not be collected.
+ * Note, larger number may lead to higher memory consumption.
+ *
+ * @return Maximum number of query metrics that will be stored in memory.
+ */
+ public int getQueryDetailMetricsSize() {
+ return qryDetailMetricsSz;
+ }
+
+ /**
+ * Sets size of queries detail metrics that will be stored in memory for monitoring purposes.
+ *
+ * @param qryDetailMetricsSz Maximum number of latest queries metrics that will be stored in memory.
+ * @return {@code this} for chaining.
+ */
+ public CacheConfiguration<K, V> setQueryDetailMetricsSize(int qryDetailMetricsSz) {
+ this.qryDetailMetricsSz = qryDetailMetricsSz;
+
+ return this;
+ }
+
+ /**
* Gets custom name of the sql schema. If custom sql schema is not set then {@code null} will be returned and
* quoted case sensitive name will be used as sql schema.
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtilityKey.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtilityKey.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtilityKey.java
index 48b6b45..8110170 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtilityKey.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtilityKey.java
@@ -27,8 +27,8 @@ public abstract class GridCacheUtilityKey<K extends GridCacheUtilityKey> impleme
private static final long serialVersionUID = 0L;
/** {@inheritDoc} */
- @SuppressWarnings("unchecked") @Override
- public final boolean equals(Object obj) {
+ @SuppressWarnings("unchecked")
+ @Override public final boolean equals(Object obj) {
return obj == this || obj != null && obj.getClass() == getClass() && equalsx((K)obj);
}
@@ -42,4 +42,4 @@ public abstract class GridCacheUtilityKey<K extends GridCacheUtilityKey> impleme
/** {@inheritDoc} */
public abstract int hashCode();
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
index 297ec68..f87fa1d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
@@ -51,6 +51,7 @@ import org.apache.ignite.cache.CachePeekMode;
import org.apache.ignite.cache.query.ContinuousQuery;
import org.apache.ignite.cache.query.Query;
import org.apache.ignite.cache.query.QueryCursor;
+import org.apache.ignite.cache.query.QueryDetailMetrics;
import org.apache.ignite.cache.query.QueryMetrics;
import org.apache.ignite.cache.query.ScanQuery;
import org.apache.ignite.cache.query.SpiQuery;
@@ -63,10 +64,10 @@ import org.apache.ignite.internal.AsyncSupportAdapter;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
-import org.apache.ignite.internal.binary.BinaryUtils;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.query.CacheQuery;
import org.apache.ignite.internal.processors.cache.query.CacheQueryFuture;
+import org.apache.ignite.internal.processors.cache.query.GridCacheQueryType;
import org.apache.ignite.internal.processors.query.GridQueryProcessor;
import org.apache.ignite.internal.util.GridCloseableIteratorAdapter;
import org.apache.ignite.internal.util.GridEmptyIterator;
@@ -243,6 +244,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
}
+ /** {@inheritDoc} */
@Override public CacheMetrics localMetrics() {
GridCacheGateway<K, V> gate = this.gate;
@@ -270,6 +272,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
}
+ /** {@inheritDoc} */
@Override public CacheMetricsMXBean localMxBean() {
GridCacheGateway<K, V> gate = this.gate;
@@ -491,8 +494,8 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
if (grp != null)
qry.projection(grp);
- final GridCloseableIterator<R> iter = ctx.kernalContext().query().executeQuery(ctx,
- new IgniteOutClosureX<GridCloseableIterator<R>>() {
+ final GridCloseableIterator<R> iter = ctx.kernalContext().query().executeQuery(GridCacheQueryType.SCAN,
+ ctx.name(), ctx, new IgniteOutClosureX<GridCloseableIterator<R>>() {
@Override public GridCloseableIterator<R> applyx() throws IgniteCheckedException {
final GridCloseableIterator iter0 = qry.executeScanQuery();
@@ -520,7 +523,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
};
}
- }, false);
+ }, true);
return new QueryCursorImpl<>(iter);
}
@@ -547,7 +550,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
if (grp != null)
qry.projection(grp);
- fut = ctx.kernalContext().query().executeQuery(ctx,
+ fut = ctx.kernalContext().query().executeQuery(GridCacheQueryType.TEXT, p.getText(), ctx,
new IgniteOutClosureX<CacheQueryFuture<Map.Entry<K, V>>>() {
@Override public CacheQueryFuture<Map.Entry<K, V>> applyx() throws IgniteCheckedException {
return qry.execute();
@@ -560,8 +563,8 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
if (grp != null)
qry.projection(grp);
- fut = ctx.kernalContext().query().executeQuery(ctx,
- new IgniteOutClosureX<CacheQueryFuture<Cache.Entry<K, V>>>() {
+ fut = ctx.kernalContext().query().executeQuery(GridCacheQueryType.SPI, filter.getClass().getSimpleName(),
+ ctx, new IgniteOutClosureX<CacheQueryFuture<Cache.Entry<K, V>>>() {
@Override public CacheQueryFuture<Cache.Entry<K, V>> applyx() throws IgniteCheckedException {
return qry.execute(((SpiQuery)filter).getArgs());
}
@@ -887,6 +890,48 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
}
/** {@inheritDoc} */
+ @Override public void resetQueryMetrics() {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
+
+ try {
+ delegate.context().queries().resetMetrics();
+ }
+ finally {
+ onLeave(gate, prev);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public Collection<? extends QueryDetailMetrics> queryDetailMetrics() {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
+
+ try {
+ return delegate.context().queries().detailMetrics();
+ }
+ finally {
+ onLeave(gate, prev);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void resetQueryDetailMetrics() {
+ GridCacheGateway<K, V> gate = this.gate;
+
+ CacheOperationContext prev = onEnter(gate, opCtx);
+
+ try {
+ delegate.context().queries().resetDetailMetrics();
+ }
+ finally {
+ onLeave(gate, prev);
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public void localEvict(Collection<? extends K> keys) {
GridCacheGateway<K, V> gate = this.gate;
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQuery.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQuery.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQuery.java
index 3fa041b..a7dbe2a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQuery.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQuery.java
@@ -17,7 +17,6 @@
package org.apache.ignite.internal.processors.cache.query;
-import java.util.Map;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cache.affinity.AffinityKey;
import org.apache.ignite.cache.query.Query;
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueryType.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueryType.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueryType.java
index bb8bc33..fa0f3df 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueryType.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/CacheQueryType.java
@@ -44,4 +44,4 @@ public enum CacheQueryType {
/** SPI query. */
SPI
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
index f65b733..2355591 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
@@ -434,16 +434,6 @@ public class GridCacheQueryAdapter<T> implements CacheQuery<T> {
throw new IgniteCheckedException("Indexing is disabled for cache: " + cctx.cache().name());
}
- /**
- * @param res Query result.
- * @param err Error or {@code null} if query executed successfully.
- * @param startTime Start time.
- * @param duration Duration.
- */
- public void onCompleted(Object res, Throwable err, long startTime, long duration) {
- GridQueryProcessor.onCompleted(cctx, res, err, startTime, duration, log);
- }
-
/** {@inheritDoc} */
@Override public CacheQueryFuture<T> execute(@Nullable Object... args) {
return execute0(null, args);
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryDetailMetricsAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryDetailMetricsAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryDetailMetricsAdapter.java
new file mode 100644
index 0000000..a477360
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryDetailMetricsAdapter.java
@@ -0,0 +1,248 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.query;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.cache.query.QueryDetailMetrics;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+
+/**
+ * Adapter for {@link QueryDetailMetrics}.
+ */
+public class GridCacheQueryDetailMetricsAdapter implements QueryDetailMetrics, Externalizable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Query type to track metrics. */
+ private GridCacheQueryType qryType;
+
+ /** Textual query representation. */
+ private String qry;
+
+ /** Cache name. */
+ private String cache;
+
+ /** Number of executions. */
+ private int execs;
+
+ /** Number of completions executions. */
+ private int completions;
+
+ /** Number of failures. */
+ private int failures;
+
+ /** Minimum time of execution. */
+ private long minTime = -1;
+
+ /** Maximum time of execution. */
+ private long maxTime;
+
+ /** Sum of execution time of completions time. */
+ private long totalTime;
+
+ /** Sum of execution time of completions time. */
+ private long lastStartTime;
+
+ /** Cached metrics group key.*/
+ private GridCacheQueryDetailMetricsKey key;
+
+ /**
+ * Required by {@link Externalizable}.
+ */
+ public GridCacheQueryDetailMetricsAdapter() {
+ // No-op.
+ }
+
+ /**
+ * Constructor with metrics.
+ *
+ * @param qryType Query type.
+ * @param qry Textual query representation.
+ * @param cache Cache name where query was executed.
+ * @param startTime Duration of queue execution.
+ * @param duration Duration of queue execution.
+ * @param failed {@code True} query executed unsuccessfully {@code false} otherwise.
+ */
+ public GridCacheQueryDetailMetricsAdapter(GridCacheQueryType qryType, String qry, String cache, long startTime,
+ long duration, boolean failed) {
+ this.qryType = qryType;
+ this.qry = qryType == GridCacheQueryType.SCAN && qry == null ? cache : qry;
+ this.cache = cache;
+
+ if (failed) {
+ execs = 1;
+ failures = 1;
+ }
+ else {
+ execs = 1;
+ completions = 1;
+ totalTime = duration;
+ minTime = duration;
+ maxTime = duration;
+ }
+
+ lastStartTime = startTime;
+ }
+
+ /**
+ * Copy constructor.
+ *
+ * @param qryType Query type.
+ * @param qry Textual query representation.
+ * @param cache Cache name where query was executed.
+ */
+ public GridCacheQueryDetailMetricsAdapter(GridCacheQueryType qryType, String qry, String cache,
+ int execs, int completions, int failures, long minTime, long maxTime, long totalTime, long lastStartTime,
+ GridCacheQueryDetailMetricsKey key) {
+ this.qryType = qryType;
+ this.qry = qry;
+ this.cache = cache;
+ this.execs = execs;
+ this.completions = completions;
+ this.failures = failures;
+ this.minTime = minTime;
+ this.maxTime = maxTime;
+ this.totalTime = totalTime;
+ this.lastStartTime = lastStartTime;
+ this.key = key;
+ }
+
+ /**
+ * @return Metrics group key.
+ */
+ public GridCacheQueryDetailMetricsKey key() {
+ if (key == null)
+ key = new GridCacheQueryDetailMetricsKey(qryType, qry);
+
+ return key;
+ }
+
+ /**
+ * Aggregate metrics.
+ *
+ * @param m Other metrics to take into account.
+ * @return Aggregated metrics.
+ */
+ public GridCacheQueryDetailMetricsAdapter aggregate(QueryDetailMetrics m) {
+ return new GridCacheQueryDetailMetricsAdapter(
+ qryType,
+ qry,
+ m.cache(),
+ execs + m.executions(),
+ completions + m.completions(),
+ failures + m.failures(),
+ minTime < 0 || minTime > m.minimumTime() ? m.minimumTime() : minTime,
+ maxTime < m.maximumTime() ? m.maximumTime() : maxTime,
+ totalTime + m.totalTime(),
+ lastStartTime < m.lastStartTime() ? m.lastStartTime() : lastStartTime,
+ key
+ );
+ }
+
+ /** {@inheritDoc} */
+ @Override public String queryType() {
+ return qryType.name();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String query() {
+ return qry;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String cache() {
+ return cache;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int executions() {
+ return execs;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int completions() {
+ return completions;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int failures() {
+ return failures;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long minimumTime() {
+ return minTime < 0 ? 0 : minTime;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long maximumTime() {
+ return maxTime;
+ }
+
+ /** {@inheritDoc} */
+ @Override public double averageTime() {
+ double val = completions;
+
+ return val > 0 ? totalTime / val : 0;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long totalTime() {
+ return totalTime;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long lastStartTime() {
+ return lastStartTime;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeExternal(ObjectOutput out) throws IOException {
+ U.writeEnum(out, qryType);
+ U.writeString(out, qry);
+ U.writeString(out, cache);
+ out.writeInt(execs);
+ out.writeInt(completions);
+ out.writeLong(minTime);
+ out.writeLong(maxTime);
+ out.writeLong(totalTime);
+ out.writeLong(lastStartTime);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ qryType = GridCacheQueryType.fromOrdinal(in.readByte());
+ qry = U.readString(in);
+ cache = U.readString(in);
+ execs = in.readInt();
+ completions = in.readInt();
+ minTime = in.readLong();
+ maxTime = in.readLong();
+ totalTime = in.readLong();
+ lastStartTime = in.readLong();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(GridCacheQueryDetailMetricsAdapter.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryDetailMetricsKey.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryDetailMetricsKey.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryDetailMetricsKey.java
new file mode 100644
index 0000000..eb70cd1
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryDetailMetricsKey.java
@@ -0,0 +1,82 @@
+/*
+ * 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.query;
+
+import org.apache.ignite.internal.util.typedef.F;
+
+/**
+ * Immutable query metrics key used to group metrics.
+ */
+public class GridCacheQueryDetailMetricsKey {
+ /** Query type to track metrics. */
+ private final GridCacheQueryType qryType;
+
+ /** Textual query representation. */
+ private final String qry;
+
+ /** Pre-calculated hash code. */
+ private final int hash;
+
+ /**
+ * Constructor.
+ *
+ * @param qryType Query type.
+ * @param qry Textual query representation.
+ */
+ public GridCacheQueryDetailMetricsKey(GridCacheQueryType qryType, String qry) {
+ assert qryType != null;
+ assert qryType != GridCacheQueryType.SQL_FIELDS || qry != null;
+
+ this.qryType = qryType;
+ this.qry = qry;
+
+ hash = 31 * qryType.hashCode() + (qry != null ? qry.hashCode() : 0);
+ }
+
+ /**
+ * @return Query type.
+ */
+ public GridCacheQueryType getQueryType() {
+ return qryType;
+ }
+
+ /**
+ * @return Textual representation of query.
+ */
+ public String getQuery() {
+ return qry;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return hash;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ if (this == o)
+ return true;
+
+ if (o == null || getClass() != o.getClass())
+ return false;
+
+ GridCacheQueryDetailMetricsKey other = (GridCacheQueryDetailMetricsKey)o;
+
+ return qryType == other.qryType && F.eq(qry, other.qry);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryFutureAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryFutureAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryFutureAdapter.java
index db519f5..4b8915c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryFutureAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryFutureAdapter.java
@@ -155,8 +155,6 @@ public abstract class GridCacheQueryFutureAdapter<K, V, R> extends GridFutureAda
@Override public boolean onDone(Collection<R> res, Throwable err) {
cctx.time().removeTimeoutObject(this);
- qry.query().onCompleted(res, err, startTime(), duration());
-
return super.onDone(res, err);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
index 00a9181..ab8bd63 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
@@ -26,6 +26,7 @@ import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -46,6 +47,7 @@ import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.cache.query.QueryMetrics;
import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.events.CacheQueryExecutedEvent;
import org.apache.ignite.events.CacheQueryReadEvent;
import org.apache.ignite.events.DiscoveryEvent;
@@ -80,6 +82,7 @@ import org.apache.ignite.internal.processors.query.GridQueryIndexType;
import org.apache.ignite.internal.processors.query.GridQueryProcessor;
import org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor;
import org.apache.ignite.internal.processors.task.GridInternal;
+import org.apache.ignite.internal.util.GridBoundedPriorityQueue;
import org.apache.ignite.internal.util.GridCloseableIteratorAdapter;
import org.apache.ignite.internal.util.GridEmptyCloseableIterator;
import org.apache.ignite.internal.util.GridEmptyIterator;
@@ -134,8 +137,37 @@ import static org.apache.ignite.internal.processors.cache.query.GridCacheQueryTy
*/
@SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapter<K, V> {
+ /** Maximum number of query detail metrics to evict at once. */
+ private static final int QRY_DETAIL_METRICS_EVICTION_LIMIT = 10_000;
+
+ /** Comparator for priority queue with query detail metrics with priority to new metrics. */
+ private static final Comparator<GridCacheQueryDetailMetricsAdapter> QRY_DETAIL_METRICS_PRIORITY_NEW_CMP =
+ new Comparator<GridCacheQueryDetailMetricsAdapter>() {
+ @Override public int compare(GridCacheQueryDetailMetricsAdapter m1, GridCacheQueryDetailMetricsAdapter m2) {
+ return Long.compare(m1.lastStartTime(), m2.lastStartTime());
+ }
+ };
+
+ /** Comparator for priority queue with query detail metrics with priority to old metrics. */
+ private static final Comparator<GridCacheQueryDetailMetricsAdapter> QRY_DETAIL_METRICS_PRIORITY_OLD_CMP =
+ new Comparator<GridCacheQueryDetailMetricsAdapter>() {
+ @Override public int compare(GridCacheQueryDetailMetricsAdapter m1, GridCacheQueryDetailMetricsAdapter m2) {
+ return Long.compare(m2.lastStartTime(), m1.lastStartTime());
+ }
+ };
+
+ /** Function to merge query detail metrics. */
+ private static final ConcurrentHashMap8.BiFun QRY_DETAIL_METRICS_MERGE_FX =
+ new ConcurrentHashMap8.BiFun<GridCacheQueryDetailMetricsAdapter,
+ GridCacheQueryDetailMetricsAdapter, GridCacheQueryDetailMetricsAdapter>() {
+ @Override public GridCacheQueryDetailMetricsAdapter apply(GridCacheQueryDetailMetricsAdapter oldVal,
+ GridCacheQueryDetailMetricsAdapter newVal) {
+ return oldVal.aggregate(newVal);
+ }
+ };
+
/** */
- protected GridQueryProcessor qryProc;
+ private GridQueryProcessor qryProc;
/** */
private String space;
@@ -147,8 +179,13 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
private volatile GridCacheQueryMetricsAdapter metrics = new GridCacheQueryMetricsAdapter();
/** */
- private final ConcurrentMap<UUID, RequestFutureMap> qryIters =
- new ConcurrentHashMap8<>();
+ private int detailMetricsSz;
+
+ /** */
+ private ConcurrentHashMap8<GridCacheQueryDetailMetricsKey, GridCacheQueryDetailMetricsAdapter> detailMetrics;
+
+ /** */
+ private final ConcurrentMap<UUID, RequestFutureMap> qryIters = new ConcurrentHashMap8<>();
/** */
private final ConcurrentMap<UUID, Map<Long, GridFutureAdapter<FieldsResult>>> fieldsQryRes =
@@ -171,10 +208,18 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
/** {@inheritDoc} */
@Override public void start0() throws IgniteCheckedException {
+ CacheConfiguration ccfg = cctx.config();
+
qryProc = cctx.kernalContext().query();
space = cctx.name();
- maxIterCnt = cctx.config().getMaxQueryIteratorsCount();
+ maxIterCnt = ccfg.getMaxQueryIteratorsCount();
+
+ detailMetricsSz = ccfg.getQueryDetailMetricsSize();
+
+ if (detailMetricsSz > 0)
+ detailMetrics = new ConcurrentHashMap8<>(detailMetricsSz);
+
lsnr = new GridLocalEventListener() {
@Override public void onEvent(Event evt) {
UUID nodeId = ((DiscoveryEvent)evt).eventNode().id();
@@ -213,7 +258,7 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
cctx.events().addListener(lsnr, EVT_NODE_LEFT, EVT_NODE_FAILED);
- enabled = GridQueryProcessor.isEnabled(cctx.config());
+ enabled = GridQueryProcessor.isEnabled(ccfg);
qryTopVer = cctx.startTopologyVersion();
@@ -1691,6 +1736,8 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
long startTime = U.currentTimeMillis();
+ final String namex = cctx.namex();
+
try {
assert qry.type() == SCAN;
@@ -1699,7 +1746,6 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
final String taskName = cctx.kernalContext().task().resolveTaskName(qry.taskHash());
final IgniteBiPredicate filter = qry.scanFilter();
- final String namex = cctx.namex();
final ClusterNode locNode = cctx.localNode();
final UUID subjId = qry.subjectId();
@@ -1721,12 +1767,9 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
final GridCloseableIterator<IgniteBiTuple<K, V>> iter = scanIterator(qry, true);
- if (updStatisticsIfNeeded) {
+ if (updStatisticsIfNeeded)
needUpdStatistics = false;
- cctx.queries().onCompleted(U.currentTimeMillis() - startTime, false);
- }
-
final boolean readEvt = cctx.gridEvents().isRecordable(EVT_CACHE_QUERY_OBJECT_READ);
return new GridCloseableIteratorAdapter<Object>() {
@@ -1789,7 +1832,8 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
}
catch (Exception e) {
if (needUpdStatistics)
- cctx.queries().onCompleted(U.currentTimeMillis() - startTime, true);
+ cctx.queries().collectMetrics(GridCacheQueryType.SCAN, namex, startTime,
+ U.currentTimeMillis() - startTime, true);
throw e;
}
@@ -2071,6 +2115,52 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
}
/**
+ * Gets cache queries detailed metrics.
+ * Detail metrics could be enabled by setting non-zero value via {@link CacheConfiguration#setQueryDetailMetricsSize(int)}
+ *
+ * @return Cache queries metrics aggregated by query type and query text.
+ */
+ public Collection<GridCacheQueryDetailMetricsAdapter> detailMetrics() {
+ if (detailMetricsSz > 0) {
+ // Return no more than latest detailMetricsSz items.
+ if (detailMetrics.size() > detailMetricsSz) {
+ GridBoundedPriorityQueue<GridCacheQueryDetailMetricsAdapter> latestMetrics =
+ new GridBoundedPriorityQueue<>(detailMetricsSz, QRY_DETAIL_METRICS_PRIORITY_NEW_CMP);
+
+ latestMetrics.addAll(detailMetrics.values());
+
+ return latestMetrics;
+ }
+
+ return new ArrayList<>(detailMetrics.values());
+ }
+
+ return Collections.emptyList();
+ }
+
+ /**
+ * Evict detail metrics.
+ */
+ public void evictDetailMetrics() {
+ if (detailMetricsSz > 0) {
+ int sz = detailMetrics.size();
+
+ if (sz > detailMetricsSz) {
+ // Limit number of metrics to evict in order make eviction time predictable.
+ int evictCnt = Math.min(QRY_DETAIL_METRICS_EVICTION_LIMIT, sz - detailMetricsSz);
+
+ Queue<GridCacheQueryDetailMetricsAdapter> metricsToEvict =
+ new GridBoundedPriorityQueue<>(evictCnt, QRY_DETAIL_METRICS_PRIORITY_OLD_CMP);
+
+ metricsToEvict.addAll(detailMetrics.values());
+
+ for (GridCacheQueryDetailMetricsAdapter m : metricsToEvict)
+ detailMetrics.remove(m.key());
+ }
+ }
+ }
+
+ /**
* Resets metrics.
*/
public void resetMetrics() {
@@ -2078,18 +2168,43 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
}
/**
- * @param fail {@code true} if execution failed.
+ * Resets detail metrics.
*/
- public void onExecuted(boolean fail) {
- metrics.onQueryExecute(fail);
+ public void resetDetailMetrics() {
+ if (detailMetrics != null)
+ detailMetrics.clear();
}
/**
+ * @param qryType Query type.
+ * @param qry Query description.
+ * @param startTime Query start size.
* @param duration Execution duration.
- * @param fail {@code true} if execution failed.
+ * @param failed {@code True} if query execution failed.
*/
- public void onCompleted(long duration, boolean fail) {
- metrics.onQueryCompleted(duration, fail);
+ public void collectMetrics(GridCacheQueryType qryType, String qry, long startTime, long duration, boolean failed) {
+ metrics.update(duration, failed);
+
+ if (detailMetricsSz > 0) {
+ // Do not collect metrics for EXPLAIN queries.
+ if (qryType == SQL_FIELDS && !F.isEmpty(qry)) {
+ int off = 0;
+ int len = qry.length();
+
+ while (off < len && Character.isWhitespace(qry.charAt(off)))
+ off++;
+
+ if (qry.regionMatches(true, off, "EXPLAIN", 0, 7))
+ return;
+ }
+
+ GridCacheQueryDetailMetricsAdapter m = new GridCacheQueryDetailMetricsAdapter(qryType, qry,
+ cctx.name(), startTime, duration, failed);
+
+ GridCacheQueryDetailMetricsKey key = m.key();
+
+ detailMetrics.merge(key, m, QRY_DETAIL_METRICS_MERGE_FX);
+ }
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryMetricsAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryMetricsAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryMetricsAdapter.java
index e70ea9f..0bb578f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryMetricsAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryMetricsAdapter.java
@@ -100,32 +100,23 @@ public class GridCacheQueryMetricsAdapter implements QueryMetrics, Externalizabl
}
/**
- * Callback for query execution.
- *
- * @param fail {@code True} query executed unsuccessfully {@code false} otherwise.
- */
- public void onQueryExecute(boolean fail) {
- execs.increment();
-
- if (fail)
- fails.increment();
- }
-
- /**
- * Callback for completion of query execution.
+ * Update metrics.
*
* @param duration Duration of queue execution.
* @param fail {@code True} query executed unsuccessfully {@code false} otherwise.
*/
- public void onQueryCompleted(long duration, boolean fail) {
- minTime.setIfLess(duration);
- maxTime.setIfGreater(duration);
-
- if (fail)
+ public void update(long duration, boolean fail) {
+ if (fail) {
+ execs.increment();
fails.increment();
+ }
else {
+ execs.increment();
completed.increment();
+ minTime.setIfLess(duration);
+ maxTime.setIfGreater(duration);
+
sumTime.add(duration);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index 27c0b71..8befa0e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -70,10 +70,13 @@ import org.apache.ignite.internal.processors.cache.CacheObject;
import org.apache.ignite.internal.processors.cache.CacheObjectContext;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCacheDefaultAffinityKeyMapper;
+import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
import org.apache.ignite.internal.processors.cache.QueryCursorImpl;
import org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl;
import org.apache.ignite.internal.processors.cache.query.CacheQueryFuture;
import org.apache.ignite.internal.processors.cache.query.CacheQueryType;
+import org.apache.ignite.internal.processors.cache.query.GridCacheQueryType;
+import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor;
import org.apache.ignite.internal.util.GridSpinBusyLock;
import org.apache.ignite.internal.util.future.GridCompoundFuture;
import org.apache.ignite.internal.util.future.GridFinishedFuture;
@@ -111,6 +114,9 @@ public class GridQueryProcessor extends GridProcessorAdapter {
/** */
private static final Class<?> GEOMETRY_CLASS = U.classForName("com.vividsolutions.jts.geom.Geometry", null);
+ /** Queries detail metrics eviction frequency. */
+ private static final int QRY_DETAIL_METRICS_EVICTION_FREQ = 3_000;
+
/** */
private static Set<Class<?>> SQL_TYPES = new HashSet<>(F.<Class<?>>asList(
Integer.class,
@@ -149,6 +155,9 @@ public class GridQueryProcessor extends GridProcessorAdapter {
private final GridQueryIndexing idx;
/** */
+ private GridTimeoutProcessor.CancelableTask qryDetailMetricsEvictTask;
+
+ /** */
private static final ThreadLocal<AffinityTopologyVersion> requestTopVer = new ThreadLocal<>();
/**
@@ -177,6 +186,14 @@ public class GridQueryProcessor extends GridProcessorAdapter {
idx.start(ctx, busyLock);
}
+
+ // Schedule queries detail metrics eviction.
+ qryDetailMetricsEvictTask = ctx.timeout().schedule(new Runnable() {
+ @Override public void run() {
+ for (IgniteCacheProxy cache : ctx.cache().jcaches())
+ cache.context().queries().evictDetailMetrics();
+ }
+ }, QRY_DETAIL_METRICS_EVICTION_FREQ, QRY_DETAIL_METRICS_EVICTION_FREQ);
}
/**
@@ -478,6 +495,8 @@ public class GridQueryProcessor extends GridProcessorAdapter {
if (idx != null)
idx.stop();
+
+ U.closeQuiet(qryDetailMetricsEvictTask);
}
/** {@inheritDoc} */
@@ -754,7 +773,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
try {
final GridCacheContext<?, ?> cctx = ctx.cache().internalCache(space).context();
- return executeQuery(cctx, new IgniteOutClosureX<GridCloseableIterator<IgniteBiTuple<K, V>>>() {
+ return executeQuery(GridCacheQueryType.SQL_FIELDS, clause, cctx, new IgniteOutClosureX<GridCloseableIterator<IgniteBiTuple<K, V>>>() {
@Override public GridCloseableIterator<IgniteBiTuple<K, V>> applyx() throws IgniteCheckedException {
TypeDescriptor type = typesByName.get(new TypeName(space, resType));
@@ -782,7 +801,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
throw new IllegalStateException("Failed to execute query (grid is stopping).");
try {
- return executeQuery(cctx, new IgniteOutClosureX<QueryCursor<List<?>>>() {
+ return executeQuery(GridCacheQueryType.SQL_FIELDS, qry.getSql(), cctx, new IgniteOutClosureX<QueryCursor<List<?>>>() {
@Override public QueryCursor<List<?>> applyx() {
return idx.queryTwoStep(cctx, qry);
}
@@ -808,11 +827,11 @@ public class GridQueryProcessor extends GridProcessorAdapter {
throw new IllegalStateException("Failed to execute query (grid is stopping).");
try {
- return executeQuery(cctx, new IgniteOutClosureX<QueryCursor<Cache.Entry<K, V>>>() {
+ return executeQuery(GridCacheQueryType.SQL, qry.getSql(), cctx, new IgniteOutClosureX<QueryCursor<Cache.Entry<K, V>>>() {
@Override public QueryCursor<Cache.Entry<K, V>> applyx() throws IgniteCheckedException {
return idx.queryTwoStep(cctx, qry);
}
- }, false);
+ }, true);
}
catch (IgniteCheckedException e) {
throw new IgniteException(e);
@@ -837,8 +856,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
throw new IllegalStateException("Failed to execute query (grid is stopping).");
try {
- return executeQuery(
- cctx,
+ return executeQuery(GridCacheQueryType.SQL, qry.getSql(), cctx,
new IgniteOutClosureX<Iterator<Cache.Entry<K, V>>>() {
@Override public Iterator<Cache.Entry<K, V>> applyx() throws IgniteCheckedException {
String space = cctx.name();
@@ -887,7 +905,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
}
};
}
- }, false);
+ }, true);
}
catch (IgniteCheckedException e) {
throw new IgniteException(e);
@@ -956,7 +974,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
try {
final boolean keepBinary = cctx.keepBinary();
- return executeQuery(cctx, new IgniteOutClosureX<QueryCursor<List<?>>>() {
+ return executeQuery(GridCacheQueryType.SQL_FIELDS, qry.getSql(), cctx, new IgniteOutClosureX<QueryCursor<List<?>>>() {
@Override public QueryCursor<List<?>> applyx() throws IgniteCheckedException {
final String space = cctx.name();
final String sql = qry.getSql();
@@ -1115,20 +1133,21 @@ public class GridQueryProcessor extends GridProcessorAdapter {
try {
final GridCacheContext<?, ?> cctx = ctx.cache().internalCache(space).context();
- return executeQuery(cctx, new IgniteOutClosureX<GridCloseableIterator<IgniteBiTuple<K, V>>>() {
- @Override public GridCloseableIterator<IgniteBiTuple<K, V>> applyx() throws IgniteCheckedException {
- TypeDescriptor type = typesByName.get(new TypeName(space, resType));
+ return executeQuery(GridCacheQueryType.TEXT, clause, cctx,
+ new IgniteOutClosureX<GridCloseableIterator<IgniteBiTuple<K, V>>>() {
+ @Override public GridCloseableIterator<IgniteBiTuple<K, V>> applyx() throws IgniteCheckedException {
+ TypeDescriptor type = typesByName.get(new TypeName(space, resType));
- if (type == null || !type.registered())
- throw new CacheException("Failed to find SQL table for type: " + resType);
+ if (type == null || !type.registered())
+ throw new CacheException("Failed to find SQL table for type: " + resType);
- return idx.queryLocalText(
- space,
- clause,
- type,
- filters);
- }
- }, false);
+ return idx.queryLocalText(
+ space,
+ clause,
+ type,
+ filters);
+ }
+ }, true);
}
finally {
busyLock.leaveBusy();
@@ -1744,11 +1763,13 @@ public class GridQueryProcessor extends GridProcessorAdapter {
}
/**
+ * @param qryType Query type.
+ * @param qry Query description.
* @param cctx Cache context.
* @param clo Closure.
* @param complete Complete.
*/
- public <R> R executeQuery(GridCacheContext<?, ?> cctx, IgniteOutClosureX<R> clo, boolean complete)
+ public <R> R executeQuery(GridCacheQueryType qryType, String qry, GridCacheContext<?, ?> cctx, IgniteOutClosureX<R> clo, boolean complete)
throws IgniteCheckedException {
final long startTime = U.currentTimeMillis();
@@ -1783,30 +1804,18 @@ public class GridQueryProcessor extends GridProcessorAdapter {
throw new IgniteCheckedException(e);
}
finally {
- cctx.queries().onExecuted(err != null);
-
- if (complete && err == null)
- onCompleted(cctx, res, null, startTime, U.currentTimeMillis() - startTime, log);
- }
- }
+ boolean failed = err != null;
- /**
- * @param cctx Cctx.
- * @param res Result.
- * @param err Err.
- * @param startTime Start time.
- * @param duration Duration.
- * @param log Logger.
- */
- public static void onCompleted(GridCacheContext<?, ?> cctx, Object res, Throwable err,
- long startTime, long duration, IgniteLogger log) {
- boolean fail = err != null;
+ long duration = U.currentTimeMillis() - startTime;
- cctx.queries().onCompleted(duration, fail);
+ if (complete || failed) {
+ cctx.queries().collectMetrics(qryType, qry, startTime, duration, failed);
- if (log.isTraceEnabled())
- log.trace("Query execution completed [startTime=" + startTime +
- ", duration=" + duration + ", fail=" + fail + ", res=" + res + ']');
+ if (log.isTraceEnabled())
+ log.trace("Query execution [startTime=" + startTime + ", duration=" + duration +
+ ", fail=" + failed + ", res=" + res + ']');
+ }
+ }
}
/**
@@ -2485,6 +2494,11 @@ public class GridQueryProcessor extends GridProcessorAdapter {
* The way to index.
*/
private enum IndexType {
- ASC, DESC, TEXT
+ /** Ascending index. */
+ ASC,
+ /** Descending index. */
+ DESC,
+ /** Text index. */
+ TEXT
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/java/org/apache/ignite/internal/util/GridBoundedPriorityQueue.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/GridBoundedPriorityQueue.java b/modules/core/src/main/java/org/apache/ignite/internal/util/GridBoundedPriorityQueue.java
new file mode 100644
index 0000000..cbc521d
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/GridBoundedPriorityQueue.java
@@ -0,0 +1,68 @@
+/*
+ * 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.util;
+
+import java.util.Comparator;
+import java.util.PriorityQueue;
+import org.apache.ignite.internal.util.typedef.internal.A;
+
+/**
+ * Bounded variant of {@link PriorityQueue}.
+ *
+ * @param <E> Type of the queue element.
+ */
+public class GridBoundedPriorityQueue<E> extends PriorityQueue<E> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Queue max capacity. */
+ private final int maxCap;
+
+ /** Comparator. */
+ private final Comparator<? super E> cmp;
+
+ /**
+ * Creates a bounded priority queue with the specified maximum size.
+ * At most {@code maxCap} elements would be kept in the queue.
+ *
+ * @param maxCap Maximum size of the queue.
+ * @param cmp Comparator that orders the elements.
+ */
+ public GridBoundedPriorityQueue(int maxCap, Comparator<? super E> cmp) {
+ super(maxCap, cmp);
+
+ A.notNull(cmp, "comparator not null");
+
+ this.maxCap = maxCap;
+ this.cmp = cmp;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean offer(E e) {
+ if (size() >= maxCap) {
+ E head = peek();
+
+ if (cmp.compare(e, head) <= 0)
+ return false;
+
+ poll();
+ }
+
+ return super.offer(e);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetrics.java
new file mode 100644
index 0000000..dc46906
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetrics.java
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.visor.cache;
+
+import java.io.Serializable;
+import org.apache.ignite.cache.query.QueryDetailMetrics;
+import org.apache.ignite.internal.util.typedef.internal.S;
+
+/**
+ * Data transfer object for cache query detail metrics.
+ */
+public class VisorCacheQueryDetailMetrics implements Serializable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Query type. */
+ private String qryType;
+
+ /** Textual query representation. */
+ private String qry;
+
+ /** Cache name. */
+ private String cache;
+
+ /** Number of executions. */
+ private int execs;
+
+ /** Number of completions executions. */
+ private int completions;
+
+ /** Number of failures. */
+ private int failures;
+
+ /** Minimum time of execution. */
+ private long minTime;
+
+ /** Maximum time of execution. */
+ private long maxTime;
+
+ /** Average time of execution. */
+ private double avgTime;
+
+ /** Sum of execution time of completions time. */
+ private long totalTime;
+
+ /** Sum of execution time of completions time. */
+ private long lastStartTime;
+
+ /**
+ * @param m Cache query metrics.
+ * @return Data transfer object for given cache metrics.
+ */
+ public VisorCacheQueryDetailMetrics from(QueryDetailMetrics m) {
+ qryType = m.queryType();
+ qry = m.query();
+ cache = m.cache();
+
+ execs = m.executions();
+ completions = m.completions();
+ failures = m.failures();
+
+ minTime = m.minimumTime();
+ maxTime = m.maximumTime();
+ avgTime = m.averageTime();
+ totalTime = m.totalTime();
+ lastStartTime = m.lastStartTime();
+
+ return this;
+ }
+
+ /**
+ * @return Query type
+ */
+ public String getQueryType() {
+ return qryType;
+ }
+
+ /**
+ * @return Query type
+ */
+ public String getQuery() {
+ return qry;
+ }
+
+ /**
+ * @return Cache name where query was executed.
+ */
+ public String getCache() {
+ return cache;
+ }
+
+ /**
+ * @return Number of executions.
+ */
+ public int getExecutions() {
+ return execs;
+ }
+
+ /**
+ * @return Number of completed executions.
+ */
+ public int getCompletions() {
+ return completions;
+ }
+
+ /**
+ * @return Total number of times a query execution failed.
+ */
+ public int getFailures() {
+ return failures;
+ }
+
+ /**
+ * @return Minimum execution time of query.
+ */
+ public long getMinimumTime() {
+ return minTime;
+ }
+
+ /**
+ * @return Maximum execution time of query.
+ */
+ public long getMaximumTime() {
+ return maxTime;
+ }
+
+ /**
+ * @return Average execution time of query.
+ */
+ public double getAverageTime() {
+ return avgTime;
+ }
+
+ /**
+ * @return Total time of all query executions.
+ */
+ public long getTotalTime() {
+ return totalTime;
+ }
+
+ /**
+ * @return Latest time query was stared.
+ */
+ public long getLastStartTime() {
+ return lastStartTime;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorCacheQueryDetailMetrics.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetricsCollectorTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetricsCollectorTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetricsCollectorTask.java
new file mode 100644
index 0000000..aee5063
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheQueryDetailMetricsCollectorTask.java
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.visor.cache;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.cache.query.QueryDetailMetrics;
+import org.apache.ignite.compute.ComputeJobResult;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.processors.cache.GridCacheProcessor;
+import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
+import org.apache.ignite.internal.processors.cache.query.GridCacheQueryDetailMetricsAdapter;
+import org.apache.ignite.internal.processors.cache.query.GridCacheQueryDetailMetricsKey;
+import org.apache.ignite.internal.processors.task.GridInternal;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.visor.VisorJob;
+import org.apache.ignite.internal.visor.VisorMultiNodeTask;
+import org.jetbrains.annotations.Nullable;
+
+import static org.apache.ignite.internal.processors.cache.GridCacheUtils.isIgfsCache;
+import static org.apache.ignite.internal.processors.cache.GridCacheUtils.isSystemCache;
+
+/**
+ * Task to collect cache query metrics.
+ */
+@GridInternal
+public class VisorCacheQueryDetailMetricsCollectorTask extends VisorMultiNodeTask<Long, Collection<VisorCacheQueryDetailMetrics>,
+ Collection<? extends QueryDetailMetrics>> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** {@inheritDoc} */
+ @Override protected VisorCacheQueryDetailMetricsCollectorJob job(Long arg) {
+ return new VisorCacheQueryDetailMetricsCollectorJob(arg, debug);
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override protected Collection<VisorCacheQueryDetailMetrics> reduce0(List<ComputeJobResult> results)
+ throws IgniteException {
+ Map<GridCacheQueryDetailMetricsKey, GridCacheQueryDetailMetricsAdapter> taskRes = new HashMap<>();
+
+ for (ComputeJobResult res : results) {
+ if (res.getException() != null)
+ throw res.getException();
+
+ Collection<GridCacheQueryDetailMetricsAdapter> metrics = res.getData();
+
+ VisorCacheQueryDetailMetricsCollectorJob.aggregateMetrics(-1, taskRes, metrics);
+ }
+
+ Collection<GridCacheQueryDetailMetricsAdapter> aggMetrics = taskRes.values();
+
+ Collection<VisorCacheQueryDetailMetrics> res = new ArrayList<>(aggMetrics.size());
+
+ for (GridCacheQueryDetailMetricsAdapter m : aggMetrics)
+ res.add(new VisorCacheQueryDetailMetrics().from(m));
+
+ return res;
+ }
+
+ /**
+ * Job that will actually collect query metrics.
+ */
+ private static class VisorCacheQueryDetailMetricsCollectorJob extends VisorJob<Long, Collection<? extends QueryDetailMetrics>> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * Create job with specified argument.
+ *
+ * @param arg Last time when metrics were collected.
+ * @param debug Debug flag.
+ */
+ protected VisorCacheQueryDetailMetricsCollectorJob(@Nullable Long arg, boolean debug) {
+ super(arg, debug);
+ }
+
+ /**
+ * @param since Time when metrics were collected last time.
+ * @param res Response.
+ * @param metrics Metrics.
+ */
+ private static void aggregateMetrics(long since, Map<GridCacheQueryDetailMetricsKey,
+ GridCacheQueryDetailMetricsAdapter> res, Collection<GridCacheQueryDetailMetricsAdapter> metrics) {
+ for (GridCacheQueryDetailMetricsAdapter m : metrics) {
+ if (m.lastStartTime() > since) {
+ GridCacheQueryDetailMetricsKey key = m.key();
+
+ GridCacheQueryDetailMetricsAdapter aggMetrics = res.get(key);
+
+ res.put(key, aggMetrics == null ? m : aggMetrics.aggregate(m));
+ }
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override protected Collection<? extends QueryDetailMetrics> run(@Nullable Long arg) throws IgniteException {
+ assert arg != null;
+
+ IgniteConfiguration cfg = ignite.configuration();
+
+ GridCacheProcessor cacheProc = ignite.context().cache();
+
+ Collection<String> cacheNames = cacheProc.cacheNames();
+
+ Map<GridCacheQueryDetailMetricsKey, GridCacheQueryDetailMetricsAdapter> aggMetrics = new HashMap<>();
+
+ for (String cacheName : cacheNames) {
+ if (!isSystemCache(cacheName) && !isIgfsCache(cfg, cacheName)) {
+ IgniteInternalCache<Object, Object> cache = cacheProc.cache(cacheName);
+
+ if (cache == null || !cache.context().started())
+ continue;
+
+ aggregateMetrics(arg, aggMetrics, cache.context().queries().detailMetrics());
+ }
+ }
+
+ return new ArrayList<>(aggMetrics.values());
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorCacheQueryDetailMetricsCollectorJob.class, this);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetQueryDetailMetricsTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetQueryDetailMetricsTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetQueryDetailMetricsTask.java
new file mode 100644
index 0000000..84aae9d
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetQueryDetailMetricsTask.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.visor.cache;
+
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.internal.processors.task.GridInternal;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.visor.VisorJob;
+import org.apache.ignite.internal.visor.VisorOneNodeTask;
+
+/**
+ * Reset query detail metrics.
+ */
+@GridInternal
+public class VisorCacheResetQueryDetailMetricsTask extends VisorOneNodeTask<Void, Void> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** {@inheritDoc} */
+ @Override protected VisorCacheResetQueryDetailMetricsJob job(Void arg) {
+ return new VisorCacheResetQueryDetailMetricsJob(arg, debug);
+ }
+
+ /**
+ * Job that reset query detail metrics.
+ */
+ private static class VisorCacheResetQueryDetailMetricsJob extends VisorJob<Void, Void> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * @param arg Task argument.
+ * @param debug Debug flag.
+ */
+ private VisorCacheResetQueryDetailMetricsJob(Void arg, boolean debug) {
+ super(arg, debug);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected Void run(Void arg) {
+ for (String cacheName : ignite.cacheNames()) {
+ IgniteCache cache = ignite.cache(cacheName);
+
+ if (cache != null)
+ cache.resetQueryDetailMetrics();
+ }
+
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorCacheResetQueryDetailMetricsJob.class, this);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetQueryMetricsTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetQueryMetricsTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetQueryMetricsTask.java
index 96d9857..5ba6156 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetQueryMetricsTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetQueryMetricsTask.java
@@ -17,7 +17,7 @@
package org.apache.ignite.internal.visor.cache;
-import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
+import org.apache.ignite.IgniteCache;
import org.apache.ignite.internal.processors.task.GridInternal;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.visor.VisorJob;
@@ -53,10 +53,10 @@ public class VisorCacheResetQueryMetricsTask extends VisorOneNodeTask<String, Vo
/** {@inheritDoc} */
@Override protected Void run(String cacheName) {
- IgniteInternalCache cache = ignite.cachex(cacheName);
+ IgniteCache cache = ignite.cache(cacheName);
if (cache != null)
- cache.context().queries().resetMetrics();
+ cache.resetQueryMetrics();
return null;
}
@@ -66,4 +66,4 @@ public class VisorCacheResetQueryMetricsTask extends VisorOneNodeTask<String, Vo
return S.toString(VisorCacheResetQueryMetricsJob.class, this);
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/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 25aaab5..1e9346c 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
@@ -158,8 +158,8 @@ public class VisorTaskUtils {
* @param name Grid-style nullable name.
* @return Name with {@code null} replaced to <default>.
*/
- public static String escapeName(@Nullable String name) {
- return name == null ? DFLT_EMPTY_NAME : name;
+ public static String escapeName(@Nullable Object name) {
+ return name == null ? DFLT_EMPTY_NAME : name.toString();
}
/**
@@ -173,15 +173,6 @@ public class VisorTaskUtils {
}
/**
- * @param a First name.
- * @param b Second name.
- * @return {@code true} if both names equals.
- */
- public static boolean safeEquals(@Nullable String a, @Nullable String b) {
- return (a != null && b != null) ? a.equals(b) : (a == null && b == null);
- }
-
- /**
* Concat arrays in one.
*
* @param arrays Arrays.
@@ -637,12 +628,10 @@ public class VisorTaskUtils {
else {
int toRead = Math.min(blockSz, (int)(fSz - pos));
- byte[] buf = new byte[toRead];
-
raf = new RandomAccessFile(file, "r");
-
raf.seek(pos);
+ byte[] buf = new byte[toRead];
int cntRead = raf.read(buf, 0, toRead);
if (cntRead != toRead)
@@ -887,8 +876,6 @@ public class VisorTaskUtils {
try {
for (int i = 0; i < nodesToStart; i++) {
if (U.isMacOs()) {
- StringBuilder envs = new StringBuilder();
-
Map<String, String> macEnv = new HashMap<>(System.getenv());
if (envVars != null) {
@@ -905,6 +892,8 @@ public class VisorTaskUtils {
macEnv.put(ent.getKey(), ent.getValue());
}
+ StringBuilder envs = new StringBuilder();
+
for (Map.Entry<String, String> entry : macEnv.entrySet()) {
String val = entry.getValue();
@@ -1024,13 +1013,12 @@ public class VisorTaskUtils {
ByteArrayOutputStream bos = new ByteArrayOutputStream(initBufSize);
try (ZipOutputStream zos = new ZipOutputStream(bos)) {
- ZipEntry entry = new ZipEntry("");
-
try {
+ ZipEntry entry = new ZipEntry("");
+
entry.setSize(input.length);
zos.putNextEntry(entry);
-
zos.write(input);
}
finally {
[19/50] [abbrv] ignite git commit: IGNITE-4145: Fixes "No query
result found for request" exception when running multiple queries
concurrently. This closes #1218.
Posted by sb...@apache.org.
IGNITE-4145: Fixes "No query result found for request" exception when running multiple queries concurrently. This closes #1218.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a70f0bac
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a70f0bac
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a70f0bac
Branch: refs/heads/master
Commit: a70f0bac3ac2487b8ab58598ad921daa952b485f
Parents: 53876d3
Author: Andrey V. Mashenkov <an...@gmail.com>
Authored: Fri Nov 11 13:03:40 2016 +0300
Committer: Andrey V. Mashenkov <an...@gmail.com>
Committed: Fri Nov 11 13:03:40 2016 +0300
----------------------------------------------------------------------
.../query/h2/twostep/GridMergeIndex.java | 49 +++++++++++-----
.../IgniteCacheQueryMultiThreadedSelfTest.java | 59 ++++++++++++++++++++
2 files changed, 93 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a70f0bac/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndex.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndex.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndex.java
index 3914bd7..7ac2ee3 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndex.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndex.java
@@ -177,36 +177,50 @@ public abstract class GridMergeIndex extends BaseIndex {
public final void addPage(GridResultPage page) {
int pageRowsCnt = page.rowsInPage();
- if (pageRowsCnt != 0)
- addPage0(page);
-
Counter cnt = remainingRows.get(page.source());
+ // RemainingRowsCount should be updated before page adding to avoid race
+ // in GridMergeIndexUnsorted cursor iterator
+ int remainingRowsCount;
+
int allRows = page.response().allRows();
if (allRows != -1) { // Only the first page contains allRows count and is allowed to init counter.
- assert !cnt.initialized : "Counter is already initialized.";
+ assert cnt.state == State.UNINITIALIZED : "Counter is already initialized.";
+
+ remainingRowsCount = cnt.addAndGet(allRows - pageRowsCnt);
- cnt.addAndGet(allRows);
expRowsCnt.addAndGet(allRows);
+ // Add page before setting initialized flag to avoid race condition with adding last page
+ if (pageRowsCnt > 0)
+ addPage0(page);
+
// We need this separate flag to handle case when the first source contains only one page
// and it will signal that all remaining counters are zero and fetch is finished.
- cnt.initialized = true;
+ cnt.state = State.INITIALIZED;
}
+ else {
+ remainingRowsCount = cnt.addAndGet(-pageRowsCnt);
- if (cnt.addAndGet(-pageRowsCnt) == 0) { // Result can be negative in case of race between messages, it is ok.
- boolean last = true;
+ if (pageRowsCnt > 0)
+ addPage0(page);
+ }
- for (Counter c : remainingRows.values()) { // Check all the sources.
- if (c.get() != 0 || !c.initialized) {
- last = false;
+ if (remainingRowsCount == 0) { // Result can be negative in case of race between messages, it is ok.
+ if (cnt.state == State.UNINITIALIZED)
+ return;
- break;
- }
+ // Guarantee that finished state possible only if counter is zero and all pages was added
+ cnt.state = State.FINISHED;
+
+ for (Counter c : remainingRows.values()) { // Check all the sources.
+ if (c.state != State.FINISHED)
+ return;
}
- if (last && lastSubmitted.compareAndSet(false, true)) {
+ if (lastSubmitted.compareAndSet(false, true)) {
+ // Add page-marker that last page was added
addPage0(new GridResultPage(null, page.source(), null) {
@Override public boolean isLast() {
return true;
@@ -426,11 +440,16 @@ public abstract class GridMergeIndex extends BaseIndex {
}
}
+ /** */
+ enum State {
+ UNINITIALIZED, INITIALIZED, FINISHED
+ }
+
/**
* Counter with initialization flag.
*/
private static class Counter extends AtomicInteger {
/** */
- volatile boolean initialized;
+ volatile State state = State.UNINITIALIZED;
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/a70f0bac/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java
index be644e2..efa6bd6 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java
@@ -21,6 +21,7 @@ import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
+import java.util.List;
import java.util.Random;
import java.util.Set;
import java.util.UUID;
@@ -34,6 +35,7 @@ import org.apache.ignite.cache.CacheMemoryMode;
import org.apache.ignite.cache.CachePeekMode;
import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy;
import org.apache.ignite.cache.query.ScanQuery;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.SqlQuery;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.configuration.CacheConfiguration;
@@ -730,6 +732,63 @@ public class IgniteCacheQueryMultiThreadedSelfTest extends GridCommonAbstractTes
}
/**
+ * SqlFieldsQuery paging mechanics stress test
+ *
+ * @throws Exception If failed.
+ */
+ @SuppressWarnings({"TooBroadScope"})
+ public void testMultiThreadedSqlFieldsQuery() throws Throwable {
+ int threadCnt = 16;
+ final int keyCnt = 1100; // set resultSet size bigger than page size
+ final int logMod = 5000;
+
+ final Ignite g = grid(0);
+
+ // Put test values into cache.
+ final IgniteCache<Integer, TestValue> c = g.cache(null);
+
+ for (int i = 0; i < keyCnt; i++)
+ c.put(i, new TestValue(i));
+
+ final AtomicInteger cnt = new AtomicInteger();
+
+ final AtomicBoolean done = new AtomicBoolean();
+
+ IgniteInternalFuture<?> fut = multithreadedAsync(
+ new CAX() {
+ @Override public void applyx() throws IgniteCheckedException {
+ int iter = 0;
+
+ while (!done.get() && !Thread.currentThread().isInterrupted()) {
+ iter++;
+
+ List<List<?>> entries =
+ c.query(new SqlFieldsQuery("SELECT * from TestValue").setPageSize(100)).getAll();
+
+ assert entries != null;
+
+ assertEquals("Entries count is not as expected on iteration: " + iter, keyCnt, entries.size());
+
+ if (cnt.incrementAndGet() % logMod == 0) {
+ GridCacheQueryManager<Object, Object> qryMgr =
+ ((IgniteKernal)g).internalCache().context().queries();
+
+ assert qryMgr != null;
+
+ qryMgr.printMemoryStats();
+ }
+ }
+ }
+ }, threadCnt);
+
+ Thread.sleep(DURATION);
+
+ done.set(true);
+
+ fut.get();
+ }
+
+ /**
* Test value.
*/
private static class TestValue implements Serializable {
[24/50] [abbrv] ignite git commit: .NET: Fix
DataStreamerTestTopologyChange tests
Posted by sb...@apache.org.
.NET: Fix DataStreamerTestTopologyChange tests
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c3e8a832
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c3e8a832
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c3e8a832
Branch: refs/heads/master
Commit: c3e8a832098887a0fd09b6e8f63d6a8cbaa20eb9
Parents: 7128a39
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Fri Nov 11 18:00:36 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Fri Nov 11 18:00:36 2016 +0300
----------------------------------------------------------------------
.../Dataload/DataStreamerTestTopologyChange.cs | 27 ++++++++++----------
1 file changed, 13 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c3e8a832/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Dataload/DataStreamerTestTopologyChange.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Dataload/DataStreamerTestTopologyChange.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Dataload/DataStreamerTestTopologyChange.cs
index c1f2c53..9e80c08 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Dataload/DataStreamerTestTopologyChange.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Dataload/DataStreamerTestTopologyChange.cs
@@ -19,7 +19,6 @@ namespace Apache.Ignite.Core.Tests.Dataload
{
using System;
using System.Threading;
- using System.Threading.Tasks;
using NUnit.Framework;
/// <summary>
@@ -59,7 +58,13 @@ namespace Apache.Ignite.Core.Tests.Dataload
var task = streamer.AddData(2, 3);
streamer.Flush();
- AssertThrowsCacheStopped(task);
+ var ex = Assert.Throws<AggregateException>(task.Wait).InnerException;
+
+ Assert.IsNotNull(ex);
+
+ Assert.AreEqual("Java exception occurred [class=org.apache.ignite.cache." +
+ "CacheServerNotFoundException, message=Failed to find server node for cache " +
+ "(all affinity nodes have left the grid or cache was stopped): cache]", ex.Message);
}
}
@@ -86,19 +91,13 @@ namespace Apache.Ignite.Core.Tests.Dataload
task = streamer.AddData(2, 3);
streamer.Flush();
- AssertThrowsCacheStopped(task);
- }
- }
+ var ex = Assert.Throws<AggregateException>(task.Wait).InnerException;
- /// <summary>
- /// Asserts that cache stopped error is thrown.
- /// </summary>
- private static void AssertThrowsCacheStopped(Task task)
- {
- var ex = Assert.Throws<AggregateException>(task.Wait);
- Assert.IsTrue(ex.InnerException.Message.Contains(
- "Failed to find server node for cache " +
- "(all affinity nodes have left the grid or cache was stopped):"));
+ Assert.IsNotNull(ex);
+
+ Assert.AreEqual("class org.apache.ignite.IgniteCheckedException: DataStreamer data loading failed.",
+ ex.Message);
+ }
}
}
}
[34/50] [abbrv] ignite git commit: IGNITE-2523 "single put" NEAR
update request
Posted by sb...@apache.org.
IGNITE-2523 "single put" NEAR update request
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a24a394b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a24a394b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a24a394b
Branch: refs/heads/master
Commit: a24a394bb66ba0237a9e9ef940707d422b2980f0
Parents: 0234f67
Author: Konstantin Dudkov <kd...@ya.ru>
Authored: Mon Nov 21 13:53:58 2016 +0300
Committer: Konstantin Dudkov <kd...@ya.ru>
Committed: Mon Nov 21 13:53:58 2016 +0300
----------------------------------------------------------------------
.../communication/GridIoMessageFactory.java | 24 +-
.../processors/cache/GridCacheIoManager.java | 64 +-
.../processors/cache/GridCachePreloader.java | 11 +
.../cache/GridCachePreloaderAdapter.java | 7 +
.../dht/atomic/GridDhtAtomicCache.java | 96 +-
.../dht/atomic/GridDhtAtomicUpdateFuture.java | 12 +-
...idNearAtomicAbstractSingleUpdateRequest.java | 562 +++++++++
.../GridNearAtomicAbstractUpdateFuture.java | 15 +-
.../GridNearAtomicAbstractUpdateRequest.java | 226 ++++
.../atomic/GridNearAtomicFullUpdateRequest.java | 1031 +++++++++++++++++
...GridNearAtomicSingleUpdateFilterRequest.java | 226 ++++
.../GridNearAtomicSingleUpdateFuture.java | 137 ++-
...GridNearAtomicSingleUpdateInvokeRequest.java | 303 +++++
.../GridNearAtomicSingleUpdateRequest.java | 359 ++++++
.../dht/atomic/GridNearAtomicUpdateFuture.java | 42 +-
.../dht/atomic/GridNearAtomicUpdateRequest.java | 1092 ------------------
.../dht/preloader/GridDhtPreloader.java | 20 +
.../distributed/near/GridNearAtomicCache.java | 10 +-
.../resources/META-INF/classnames.properties | 77 +-
.../CacheAtomicSingleMessageCountSelfTest.java | 259 +++++
.../GridCacheAtomicMessageCountSelfTest.java | 18 +-
.../IgniteCacheAtomicStopBusySelfTest.java | 10 +-
.../IgniteCacheP2pUnmarshallingErrorTest.java | 2 +-
...niteCacheClientNodeChangingTopologyTest.java | 22 +-
...eAtomicInvalidPartitionHandlingSelfTest.java | 2 +-
25 files changed, 3332 insertions(+), 1295 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
index fd55224..b20de68 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
@@ -69,7 +69,10 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtUnlock
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicDeferredUpdateResponse;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponse;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicFullUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateFilterRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateInvokeRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysResponse;
@@ -392,7 +395,7 @@ public class GridIoMessageFactory implements MessageFactory {
break;
case 40:
- msg = new GridNearAtomicUpdateRequest();
+ msg = new GridNearAtomicFullUpdateRequest();
break;
@@ -756,7 +759,22 @@ public class GridIoMessageFactory implements MessageFactory {
break;
- // [-3..119] [124] - this
+ case 125:
+ msg = new GridNearAtomicSingleUpdateRequest();
+
+ break;
+
+ case 126:
+ msg = new GridNearAtomicSingleUpdateInvokeRequest();
+
+ break;
+
+ case 127:
+ msg = new GridNearAtomicSingleUpdateFilterRequest();
+
+ break;
+
+ // [-3..119] [124..127] - this
// [120..123] - DR
// [-4..-22, -30..-35] - SQL
default:
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
index e450287..c5c1c60 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
@@ -47,7 +47,11 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrep
import org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedSingleGetFuture;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponse;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicAbstractUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicFullUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateFilterRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateInvokeRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysResponse;
@@ -462,8 +466,8 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
* @return Atomic future ID if applicable for message.
*/
@Nullable private GridCacheVersion atomicFututeId(GridCacheMessage cacheMsg) {
- if (cacheMsg instanceof GridNearAtomicUpdateRequest)
- return ((GridNearAtomicUpdateRequest)cacheMsg).futureVersion();
+ if (cacheMsg instanceof GridNearAtomicAbstractUpdateRequest)
+ return ((GridNearAtomicAbstractUpdateRequest)cacheMsg).futureVersion();
else if (cacheMsg instanceof GridNearAtomicUpdateResponse)
return ((GridNearAtomicUpdateResponse) cacheMsg).futureVersion();
else if (cacheMsg instanceof GridDhtAtomicUpdateRequest)
@@ -480,8 +484,8 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
* @return Atomic future ID if applicable for message.
*/
@Nullable private GridCacheVersion atomicWriteVersion(GridCacheMessage cacheMsg) {
- if (cacheMsg instanceof GridNearAtomicUpdateRequest)
- return ((GridNearAtomicUpdateRequest)cacheMsg).updateVersion();
+ if (cacheMsg instanceof GridNearAtomicAbstractUpdateRequest)
+ return ((GridNearAtomicAbstractUpdateRequest)cacheMsg).updateVersion();
else if (cacheMsg instanceof GridDhtAtomicUpdateRequest)
return ((GridDhtAtomicUpdateRequest)cacheMsg).writeVersion();
@@ -562,7 +566,7 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
break;
case 40: {
- GridNearAtomicUpdateRequest req = (GridNearAtomicUpdateRequest)msg;
+ GridNearAtomicFullUpdateRequest req = (GridNearAtomicFullUpdateRequest)msg;
GridNearAtomicUpdateResponse res = new GridNearAtomicUpdateResponse(
ctx.cacheId(),
@@ -739,6 +743,54 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
break;
+ case 125: {
+ GridNearAtomicSingleUpdateRequest req = (GridNearAtomicSingleUpdateRequest)msg;
+
+ GridNearAtomicUpdateResponse res = new GridNearAtomicUpdateResponse(
+ ctx.cacheId(),
+ nodeId,
+ req.futureVersion(),
+ ctx.deploymentEnabled());
+
+ res.error(req.classError());
+
+ sendResponseOnFailedMessage(nodeId, res, cctx, ctx.ioPolicy());
+ }
+
+ break;
+
+ case 126: {
+ GridNearAtomicSingleUpdateInvokeRequest req = (GridNearAtomicSingleUpdateInvokeRequest)msg;
+
+ GridNearAtomicUpdateResponse res = new GridNearAtomicUpdateResponse(
+ ctx.cacheId(),
+ nodeId,
+ req.futureVersion(),
+ ctx.deploymentEnabled());
+
+ res.error(req.classError());
+
+ sendResponseOnFailedMessage(nodeId, res, cctx, ctx.ioPolicy());
+ }
+
+ break;
+
+ case 127: {
+ GridNearAtomicSingleUpdateFilterRequest req = (GridNearAtomicSingleUpdateFilterRequest)msg;
+
+ GridNearAtomicUpdateResponse res = new GridNearAtomicUpdateResponse(
+ ctx.cacheId(),
+ nodeId,
+ req.futureVersion(),
+ ctx.deploymentEnabled());
+
+ res.error(req.classError());
+
+ sendResponseOnFailedMessage(nodeId, res, cctx, ctx.ioPolicy());
+ }
+
+ break;
+
default:
throw new IgniteCheckedException("Failed to send response to node. Unsupported direct type [message="
+ msg + "]", msg.classError());
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloader.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloader.java
index a49bb04..1d1cfab 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloader.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloader.java
@@ -24,6 +24,7 @@ import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicAbstractUpdateRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemandMessage;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionSupplyMessageV2;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture;
@@ -140,6 +141,16 @@ public interface GridCachePreloader {
public IgniteInternalFuture<Object> request(Collection<KeyCacheObject> keys, AffinityTopologyVersion topVer);
/**
+ * Requests that preloader sends the request for the key.
+ *
+ * @param req Message with keys to request.
+ * @param topVer Topology version, {@code -1} if not required.
+ * @return Future to complete when all keys are preloaded.
+ */
+ public IgniteInternalFuture<Object> request(GridNearAtomicAbstractUpdateRequest req,
+ AffinityTopologyVersion topVer);
+
+ /**
* Force preload process.
*/
public void forcePreload();
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloaderAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloaderAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloaderAdapter.java
index 58b75df..b15ebc5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloaderAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloaderAdapter.java
@@ -26,6 +26,7 @@ import org.apache.ignite.cache.affinity.AffinityFunction;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicAbstractUpdateRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemandMessage;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionSupplyMessageV2;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture;
@@ -149,6 +150,12 @@ public class GridCachePreloaderAdapter implements GridCachePreloader {
}
/** {@inheritDoc} */
+ @Override public IgniteInternalFuture<Object> request(GridNearAtomicAbstractUpdateRequest req,
+ AffinityTopologyVersion topVer) {
+ return new GridFinishedFuture<>();
+ }
+
+ /** {@inheritDoc} */
@Override public void onInitialExchangeComplete(@Nullable Throwable err) {
// No-op.
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index 30a3d57..f7d1973 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -136,7 +136,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
/** Update reply closure. */
@GridToStringExclude
- private CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> updateReplyClos;
+ private CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse> updateReplyClos;
/** Pending */
private GridDeferredAckMessageSender deferredUpdateMessageSender;
@@ -200,9 +200,9 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
@Override protected void init() {
super.init();
- updateReplyClos = new CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse>() {
+ updateReplyClos = new CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse>() {
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
- @Override public void apply(GridNearAtomicUpdateRequest req, GridNearAtomicUpdateResponse res) {
+ @Override public void apply(GridNearAtomicAbstractUpdateRequest req, GridNearAtomicUpdateResponse res) {
if (ctx.config().getAtomicWriteOrderMode() == CLOCK) {
assert req.writeSynchronizationMode() != FULL_ASYNC : req;
@@ -323,11 +323,11 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
ctx.io().addHandler(
ctx.cacheId(),
- GridNearAtomicUpdateRequest.class,
- new CI2<UUID, GridNearAtomicUpdateRequest>() {
+ GridNearAtomicAbstractUpdateRequest.class,
+ new CI2<UUID, GridNearAtomicAbstractUpdateRequest>() {
@Override public void apply(
UUID nodeId,
- GridNearAtomicUpdateRequest req
+ GridNearAtomicAbstractUpdateRequest req
) {
processNearAtomicUpdateRequest(
nodeId,
@@ -335,8 +335,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
}
@Override public String toString() {
- return "GridNearAtomicUpdateRequest handler " +
- "[msgIdx=" + GridNearAtomicUpdateRequest.CACHE_MSG_IDX + ']';
+ return "GridNearAtomicAbstractUpdateRequest handler " +
+ "[msgIdx=" + GridNearAtomicAbstractUpdateRequest.CACHE_MSG_IDX + ']';
}
});
@@ -1252,7 +1252,9 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
CacheEntryPredicate[] filters = CU.filterArray(filter);
- if (conflictPutVal == null && conflictRmvVer == null && !isFastMap(filters, op)) {
+ if (conflictPutVal == null &&
+ conflictRmvVer == null &&
+ !isFastMap(filters, op)) {
return new GridNearAtomicSingleUpdateFuture(
ctx,
this,
@@ -1603,10 +1605,10 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
*/
public void updateAllAsyncInternal(
final UUID nodeId,
- final GridNearAtomicUpdateRequest req,
- final CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb
+ final GridNearAtomicAbstractUpdateRequest req,
+ final CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse> completionCb
) {
- IgniteInternalFuture<Object> forceFut = preldr.request(req.keys(), req.topologyVersion());
+ IgniteInternalFuture<Object> forceFut = preldr.request(req, req.topologyVersion());
if (forceFut == null || forceFut.isDone()) {
try {
@@ -1652,8 +1654,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
* @param e Error.
*/
private void onForceKeysError(final UUID nodeId,
- final GridNearAtomicUpdateRequest req,
- final CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
+ final GridNearAtomicAbstractUpdateRequest req,
+ final CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
IgniteCheckedException e
) {
GridNearAtomicUpdateResponse res = new GridNearAtomicUpdateResponse(ctx.cacheId(),
@@ -1673,17 +1675,15 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
* @param req Update request.
* @param completionCb Completion callback.
*/
- public void updateAllAsyncInternal0(
+ private void updateAllAsyncInternal0(
UUID nodeId,
- GridNearAtomicUpdateRequest req,
- CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb
+ GridNearAtomicAbstractUpdateRequest req,
+ CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse> completionCb
) {
GridNearAtomicUpdateResponse res = new GridNearAtomicUpdateResponse(ctx.cacheId(), nodeId, req.futureVersion(),
ctx.deploymentEnabled());
- List<KeyCacheObject> keys = req.keys();
-
- assert !req.returnValue() || (req.operation() == TRANSFORM || keys.size() == 1);
+ assert !req.returnValue() || (req.operation() == TRANSFORM || req.size() == 1);
GridDhtAtomicUpdateFuture dhtFut = null;
@@ -1696,7 +1696,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
try {
// If batch store update is enabled, we need to lock all entries.
// First, need to acquire locks on cache entries, then check filter.
- List<GridDhtCacheEntry> locked = lockEntries(keys, req.topologyVersion());
+ List<GridDhtCacheEntry> locked = lockEntries(req, req.topologyVersion());
Collection<IgniteBiTuple<GridDhtCacheEntry, GridCacheVersion>> deleted = null;
@@ -1707,7 +1707,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
try {
if (top.stopping()) {
- res.addFailedKeys(keys, new IgniteCheckedException("Failed to perform cache operation " +
+ res.addFailedKeys(req.keys(), new IgniteCheckedException("Failed to perform cache operation " +
"(cache is stopped): " + name()));
completionCb.apply(req, res);
@@ -1757,7 +1757,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
GridCacheReturn retVal = null;
- if (keys.size() > 1 && // Several keys ...
+ if (req.size() > 1 && // Several keys ...
writeThrough() && !req.skipStore() && // and store is enabled ...
!ctx.store().isLocal() && // and this is not local store ...
// (conflict resolver should be used for local store)
@@ -1853,7 +1853,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
// an attempt to use cleaned resources.
U.error(log, "Unexpected exception during cache update", e);
- res.addFailedKeys(keys, e);
+ res.addFailedKeys(req.keys(), e);
completionCb.apply(req, res);
@@ -1866,7 +1866,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
if (remap) {
assert dhtFut == null;
- res.remapKeys(keys);
+ res.remapKeys(req.keys());
completionCb.apply(req, res);
}
@@ -1904,12 +1904,12 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
private UpdateBatchResult updateWithBatch(
final ClusterNode node,
final boolean hasNear,
- final GridNearAtomicUpdateRequest req,
+ final GridNearAtomicAbstractUpdateRequest req,
final GridNearAtomicUpdateResponse res,
final List<GridDhtCacheEntry> locked,
final GridCacheVersion ver,
@Nullable GridDhtAtomicUpdateFuture dhtFut,
- final CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
+ final CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
final boolean replicate,
final String taskName,
@Nullable final IgniteCacheExpiryPolicy expiry,
@@ -1929,7 +1929,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
}
}
- int size = req.keys().size();
+ int size = req.size();
Map<KeyCacheObject, CacheObject> putMap = null;
@@ -2327,12 +2327,12 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
private UpdateSingleResult updateSingle(
ClusterNode node,
boolean hasNear,
- GridNearAtomicUpdateRequest req,
+ GridNearAtomicAbstractUpdateRequest req,
GridNearAtomicUpdateResponse res,
List<GridDhtCacheEntry> locked,
GridCacheVersion ver,
@Nullable GridDhtAtomicUpdateFuture dhtFut,
- CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
+ CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
boolean replicate,
String taskName,
@Nullable IgniteCacheExpiryPolicy expiry,
@@ -2341,8 +2341,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
GridCacheReturn retVal = null;
Collection<IgniteBiTuple<GridDhtCacheEntry, GridCacheVersion>> deleted = null;
- List<KeyCacheObject> keys = req.keys();
-
AffinityTopologyVersion topVer = req.topologyVersion();
boolean checkReaders = hasNear || ctx.discovery().hasNearCache(name(), topVer);
@@ -2352,8 +2350,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
boolean intercept = ctx.config().getInterceptor() != null;
// Avoid iterator creation.
- for (int i = 0; i < keys.size(); i++) {
- KeyCacheObject k = keys.get(i);
+ for (int i = 0; i < req.size(); i++) {
+ KeyCacheObject k = req.key(i);
GridCacheOperation op = req.operation();
@@ -2489,7 +2487,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
if (updRes.removeVersion() != null) {
if (deleted == null)
- deleted = new ArrayList<>(keys.size());
+ deleted = new ArrayList<>(req.size());
deleted.add(F.t(entry, updRes.removeVersion()));
}
@@ -2565,8 +2563,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
@Nullable final Collection<KeyCacheObject> rmvKeys,
@Nullable final Map<KeyCacheObject, EntryProcessor<Object, Object, Object>> entryProcessorMap,
@Nullable GridDhtAtomicUpdateFuture dhtFut,
- final CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
- final GridNearAtomicUpdateRequest req,
+ final CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
+ final GridNearAtomicAbstractUpdateRequest req,
final GridNearAtomicUpdateResponse res,
final boolean replicate,
final UpdateBatchResult batchRes,
@@ -2803,17 +2801,17 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
/**
* Acquires java-level locks on cache entries. Returns collection of locked entries.
*
- * @param keys Keys to lock.
+ * @param req Request with keys to lock.
* @param topVer Topology version to lock on.
* @return Collection of locked entries.
* @throws GridDhtInvalidPartitionException If entry does not belong to local node. If exception is thrown,
* locks are released.
*/
@SuppressWarnings("ForLoopReplaceableByForEach")
- private List<GridDhtCacheEntry> lockEntries(List<KeyCacheObject> keys, AffinityTopologyVersion topVer)
+ private List<GridDhtCacheEntry> lockEntries(GridNearAtomicAbstractUpdateRequest req, AffinityTopologyVersion topVer)
throws GridDhtInvalidPartitionException {
- if (keys.size() == 1) {
- KeyCacheObject key = keys.get(0);
+ if (req.size() == 1) {
+ KeyCacheObject key = req.key(0);
while (true) {
try {
@@ -2836,12 +2834,12 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
}
}
else {
- List<GridDhtCacheEntry> locked = new ArrayList<>(keys.size());
+ List<GridDhtCacheEntry> locked = new ArrayList<>(req.size());
while (true) {
- for (KeyCacheObject key : keys) {
+ for (int i = 0; i < req.size(); i++) {
try {
- GridDhtCacheEntry entry = entryExx(key, topVer);
+ GridDhtCacheEntry entry = entryExx(req.key(i), topVer);
locked.add(entry);
}
@@ -2946,7 +2944,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
* will return false.
* @return {@code True} if filter evaluation succeeded.
*/
- private boolean checkFilter(GridCacheEntryEx entry, GridNearAtomicUpdateRequest req,
+ private boolean checkFilter(GridCacheEntryEx entry, GridNearAtomicAbstractUpdateRequest req,
GridNearAtomicUpdateResponse res) {
try {
return ctx.isAllLocked(entry, req.filter());
@@ -2961,7 +2959,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
/**
* @param req Request to remap.
*/
- private void remapToNewPrimary(GridNearAtomicUpdateRequest req) {
+ private void remapToNewPrimary(GridNearAtomicAbstractUpdateRequest req) {
assert req.writeSynchronizationMode() == FULL_ASYNC : req;
if (log.isDebugEnabled())
@@ -3040,9 +3038,9 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
*/
@Nullable private GridDhtAtomicUpdateFuture createDhtFuture(
GridCacheVersion writeVer,
- GridNearAtomicUpdateRequest updateReq,
+ GridNearAtomicAbstractUpdateRequest updateReq,
GridNearAtomicUpdateResponse updateRes,
- CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
+ CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
boolean force
) {
if (!force) {
@@ -3073,7 +3071,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
* @param nodeId Sender node ID.
* @param req Near atomic update request.
*/
- private void processNearAtomicUpdateRequest(UUID nodeId, GridNearAtomicUpdateRequest req) {
+ private void processNearAtomicUpdateRequest(UUID nodeId, GridNearAtomicAbstractUpdateRequest req) {
if (msgLog.isDebugEnabled()) {
msgLog.debug("Received near atomic update request [futId=" + req.futureVersion() +
", writeVer=" + req.updateVersion() +
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
index 4e59d11..c2ad8b8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
@@ -83,7 +83,7 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void>
/** Completion callback. */
@GridToStringExclude
- private final CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb;
+ private final CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse> completionCb;
/** Mappings. */
@GridToStringInclude
@@ -93,7 +93,7 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void>
private Map<KeyCacheObject, GridDhtCacheEntry> nearReadersEntries;
/** Update request. */
- private final GridNearAtomicUpdateRequest updateReq;
+ private final GridNearAtomicAbstractUpdateRequest updateReq;
/** Update response. */
private final GridNearAtomicUpdateResponse updateRes;
@@ -119,9 +119,9 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void>
*/
public GridDhtAtomicUpdateFuture(
GridCacheContext cctx,
- CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
+ CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse> completionCb,
GridCacheVersion writeVer,
- GridNearAtomicUpdateRequest updateReq,
+ GridNearAtomicAbstractUpdateRequest updateReq,
GridNearAtomicUpdateResponse updateRes
) {
this.cctx = cctx;
@@ -137,8 +137,8 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void>
log = U.logger(cctx.kernalContext(), logRef, GridDhtAtomicUpdateFuture.class);
}
- keys = new ArrayList<>(updateReq.keys().size());
- mappings = U.newHashMap(updateReq.keys().size());
+ keys = new ArrayList<>(updateReq.size());
+ mappings = U.newHashMap(updateReq.size());
waitForExchange = !(updateReq.topologyLocked() || (updateReq.fastMap() && !updateReq.clientRequest()));
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractSingleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractSingleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractSingleUpdateRequest.java
new file mode 100644
index 0000000..61deeee
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractSingleUpdateRequest.java
@@ -0,0 +1,562 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import java.io.Externalizable;
+import java.nio.ByteBuffer;
+import java.util.UUID;
+import javax.cache.expiry.ExpiryPolicy;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.internal.GridDirectTransient;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
+import org.apache.ignite.internal.processors.cache.GridCacheOperation;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.plugin.extensions.communication.MessageReader;
+import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ *
+ */
+public abstract class GridNearAtomicAbstractSingleUpdateRequest extends GridNearAtomicAbstractUpdateRequest {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private static final CacheEntryPredicate[] NO_FILTER = new CacheEntryPredicate[0];
+
+ /** Fast map flag mask. */
+ private static final int FAST_MAP_FLAG_MASK = 0x1;
+
+ /** Flag indicating whether request contains primary keys. */
+ private static final int HAS_PRIMARY_FLAG_MASK = 0x2;
+
+ /** Topology locked flag. Set if atomic update is performed inside TX or explicit lock. */
+ private static final int TOP_LOCKED_FLAG_MASK = 0x4;
+
+ /** Skip write-through to a persistent storage. */
+ private static final int SKIP_STORE_FLAG_MASK = 0x8;
+
+ /** */
+ private static final int CLIENT_REQ_FLAG_MASK = 0x10;
+
+ /** Keep binary flag. */
+ private static final int KEEP_BINARY_FLAG_MASK = 0x20;
+
+ /** Return value flag. */
+ private static final int RET_VAL_FLAG_MASK = 0x40;
+
+ /** Target node ID. */
+ @GridDirectTransient
+ protected UUID nodeId;
+
+ /** Future version. */
+ protected GridCacheVersion futVer;
+
+ /** Update version. Set to non-null if fastMap is {@code true}. */
+ private GridCacheVersion updateVer;
+
+ /** Topology version. */
+ protected AffinityTopologyVersion topVer;
+
+ /** Write synchronization mode. */
+ protected CacheWriteSynchronizationMode syncMode;
+
+ /** Update operation. */
+ protected GridCacheOperation op;
+
+ /** Subject ID. */
+ protected UUID subjId;
+
+ /** Task name hash. */
+ protected int taskNameHash;
+
+ /** */
+ @GridDirectTransient
+ private GridNearAtomicUpdateResponse res;
+
+ /** Compressed boolean flags. */
+ protected byte flags;
+
+ /**
+ * Empty constructor required by {@link Externalizable}.
+ */
+ protected GridNearAtomicAbstractSingleUpdateRequest() {
+ // No-op.
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param cacheId Cache ID.
+ * @param nodeId Node ID.
+ * @param futVer Future version.
+ * @param fastMap Fast map scheme flag.
+ * @param updateVer Update version set if fast map is performed.
+ * @param topVer Topology version.
+ * @param topLocked Topology locked flag.
+ * @param syncMode Synchronization mode.
+ * @param op Cache update operation.
+ * @param retval Return value required flag.
+ * @param subjId Subject ID.
+ * @param taskNameHash Task name hash code.
+ * @param skipStore Skip write-through to a persistent storage.
+ * @param keepBinary Keep binary flag.
+ * @param clientReq Client node request flag.
+ * @param addDepInfo Deployment info flag.
+ */
+ protected GridNearAtomicAbstractSingleUpdateRequest(
+ int cacheId,
+ UUID nodeId,
+ GridCacheVersion futVer,
+ boolean fastMap,
+ @Nullable GridCacheVersion updateVer,
+ @NotNull AffinityTopologyVersion topVer,
+ boolean topLocked,
+ CacheWriteSynchronizationMode syncMode,
+ GridCacheOperation op,
+ boolean retval,
+ @Nullable UUID subjId,
+ int taskNameHash,
+ boolean skipStore,
+ boolean keepBinary,
+ boolean clientReq,
+ boolean addDepInfo
+ ) {
+ assert futVer != null;
+
+ this.cacheId = cacheId;
+ this.nodeId = nodeId;
+ this.futVer = futVer;
+ this.updateVer = updateVer;
+ this.topVer = topVer;
+ this.syncMode = syncMode;
+ this.op = op;
+ this.subjId = subjId;
+ this.taskNameHash = taskNameHash;
+ this.addDepInfo = addDepInfo;
+
+ fastMap(fastMap);
+ topologyLocked(topLocked);
+ returnValue(retval);
+ skipStore(skipStore);
+ keepBinary(keepBinary);
+ clientRequest(clientReq);
+ }
+
+ /** {@inheritDoc} */
+ @Override public int lookupIndex() {
+ return CACHE_MSG_IDX;
+ }
+
+ /**
+ * @return Mapped node ID.
+ */
+ @Override public UUID nodeId() {
+ return nodeId;
+ }
+
+ /**
+ * @param nodeId Node ID.
+ */
+ @Override public void nodeId(UUID nodeId) {
+ this.nodeId = nodeId;
+ }
+
+ /**
+ * @return Subject ID.
+ */
+ @Override public UUID subjectId() {
+ return subjId;
+ }
+
+ /**
+ * @return Task name hash.
+ */
+ @Override public int taskNameHash() {
+ return taskNameHash;
+ }
+
+ /**
+ * @return Future version.
+ */
+ @Override public GridCacheVersion futureVersion() {
+ return futVer;
+ }
+
+ /**
+ * @return Update version for fast-map request.
+ */
+ @Override public GridCacheVersion updateVersion() {
+ return updateVer;
+ }
+
+ /**
+ * @return Topology version.
+ */
+ @Override public AffinityTopologyVersion topologyVersion() {
+ return topVer;
+ }
+
+ /**
+ * @return Cache write synchronization mode.
+ */
+ @Override public CacheWriteSynchronizationMode writeSynchronizationMode() {
+ return syncMode;
+ }
+
+ /**
+ * @return Expiry policy.
+ */
+ @Override public ExpiryPolicy expiry() {
+ return null;
+ }
+
+ /**
+ * @return Update operation.
+ */
+ @Override public GridCacheOperation operation() {
+ return op;
+ }
+
+ /**
+ * @return Optional arguments for entry processor.
+ */
+ @Override @Nullable public Object[] invokeArguments() {
+ return null;
+ }
+
+ /**
+ * @param res Response.
+ * @return {@code True} if current response was {@code null}.
+ */
+ @Override public boolean onResponse(GridNearAtomicUpdateResponse res) {
+ if (this.res == null) {
+ this.res = res;
+
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @return Response.
+ */
+ @Override @Nullable public GridNearAtomicUpdateResponse response() {
+ return res;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean addDeploymentInfo() {
+ return addDepInfo;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteLogger messageLogger(GridCacheSharedContext ctx) {
+ return ctx.atomicMessageLogger();
+ }
+
+ /**
+ * @return Flag indicating whether this is fast-map udpate.
+ */
+ @Override public boolean fastMap() {
+ return isFlag(FAST_MAP_FLAG_MASK);
+ }
+
+ /**
+ * Sets fastMap flag value.
+ */
+ public void fastMap(boolean val) {
+ setFlag(val, FAST_MAP_FLAG_MASK);
+ }
+
+ /**
+ * @return Topology locked flag.
+ */
+ @Override public boolean topologyLocked() {
+ return isFlag(TOP_LOCKED_FLAG_MASK);
+ }
+
+ /**
+ * Sets topologyLocked flag value.
+ */
+ public void topologyLocked(boolean val) {
+ setFlag(val, TOP_LOCKED_FLAG_MASK);
+ }
+
+ /**
+ * @return {@code True} if request sent from client node.
+ */
+ @Override public boolean clientRequest() {
+ return isFlag(CLIENT_REQ_FLAG_MASK);
+ }
+
+ /**
+ * Sets clientRequest flag value.
+ */
+ public void clientRequest(boolean val) {
+ setFlag(val, CLIENT_REQ_FLAG_MASK);
+ }
+
+ /**
+ * @return Return value flag.
+ */
+ @Override public boolean returnValue() {
+ return isFlag(RET_VAL_FLAG_MASK);
+ }
+
+ /**
+ * Sets returnValue flag value.
+ */
+ public void returnValue(boolean val) {
+ setFlag(val, RET_VAL_FLAG_MASK);
+ }
+
+ /**
+ * @return Skip write-through to a persistent storage.
+ */
+ @Override public boolean skipStore() {
+ return isFlag(SKIP_STORE_FLAG_MASK);
+ }
+
+ /**
+ * Sets skipStore flag value.
+ */
+ public void skipStore(boolean val) {
+ setFlag(val, SKIP_STORE_FLAG_MASK);
+ }
+
+ /**
+ * @return Keep binary flag.
+ */
+ @Override public boolean keepBinary() {
+ return isFlag(KEEP_BINARY_FLAG_MASK);
+ }
+
+ /**
+ * Sets keepBinary flag value.
+ */
+ public void keepBinary(boolean val) {
+ setFlag(val, KEEP_BINARY_FLAG_MASK);
+ }
+
+ /**
+ * @return Flag indicating whether this request contains primary keys.
+ */
+ @Override public boolean hasPrimary() {
+ return isFlag(HAS_PRIMARY_FLAG_MASK);
+ }
+
+ /**
+ * Sets hasPrimary flag value.
+ */
+ public void hasPrimary(boolean val) {
+ setFlag(val, HAS_PRIMARY_FLAG_MASK);
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public CacheEntryPredicate[] filter() {
+ return NO_FILTER;
+ }
+
+ /**
+ * Sets flag mask.
+ *
+ * @param flag Set or clear.
+ * @param mask Mask.
+ */
+ private void setFlag(boolean flag, int mask) {
+ flags = flag ? (byte)(flags | mask) : (byte)(flags & ~mask);
+ }
+
+ /**
+ * Reads flag mask.
+ *
+ * @param mask Mask to read.
+ * @return Flag value.
+ */
+ private boolean isFlag(int mask) {
+ return (flags & mask) != 0;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+ writer.setBuffer(buf);
+
+ if (!super.writeTo(buf, writer))
+ return false;
+
+ if (!writer.isHeaderWritten()) {
+ if (!writer.writeHeader(directType(), fieldsCount()))
+ return false;
+
+ writer.onHeaderWritten();
+ }
+
+ switch (writer.state()) {
+ case 3:
+ if (!writer.writeByte("flags", flags))
+ return false;
+
+ writer.incrementState();
+
+ case 4:
+ if (!writer.writeMessage("futVer", futVer))
+ return false;
+
+ writer.incrementState();
+
+ case 5:
+ if (!writer.writeByte("op", op != null ? (byte)op.ordinal() : -1))
+ return false;
+
+ writer.incrementState();
+
+ case 6:
+ if (!writer.writeUuid("subjId", subjId))
+ return false;
+
+ writer.incrementState();
+
+ case 7:
+ if (!writer.writeByte("syncMode", syncMode != null ? (byte)syncMode.ordinal() : -1))
+ return false;
+
+ writer.incrementState();
+
+ case 8:
+ if (!writer.writeInt("taskNameHash", taskNameHash))
+ return false;
+
+ writer.incrementState();
+
+ case 9:
+ if (!writer.writeMessage("topVer", topVer))
+ return false;
+
+ writer.incrementState();
+
+ case 10:
+ if (!writer.writeMessage("updateVer", updateVer))
+ return false;
+
+ writer.incrementState();
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+ reader.setBuffer(buf);
+
+ if (!reader.beforeMessageRead())
+ return false;
+
+ if (!super.readFrom(buf, reader))
+ return false;
+
+ switch (reader.state()) {
+ case 3:
+ flags = reader.readByte("flags");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 4:
+ futVer = reader.readMessage("futVer");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 5:
+ byte opOrd;
+
+ opOrd = reader.readByte("op");
+
+ if (!reader.isLastRead())
+ return false;
+
+ op = GridCacheOperation.fromOrdinal(opOrd);
+
+ reader.incrementState();
+
+ case 6:
+ subjId = reader.readUuid("subjId");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 7:
+ byte syncModeOrd;
+
+ syncModeOrd = reader.readByte("syncMode");
+
+ if (!reader.isLastRead())
+ return false;
+
+ syncMode = CacheWriteSynchronizationMode.fromOrdinal(syncModeOrd);
+
+ reader.incrementState();
+
+ case 8:
+ taskNameHash = reader.readInt("taskNameHash");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 9:
+ topVer = reader.readMessage("topVer");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 10:
+ updateVer = reader.readMessage("updateVer");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ }
+
+ return reader.afterMessageRead(GridNearAtomicAbstractSingleUpdateRequest.class);
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte fieldsCount() {
+ return 11;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java
index 85751bb..2fbabaa 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java
@@ -17,6 +17,9 @@
package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+import java.util.UUID;
+import java.util.concurrent.atomic.AtomicReference;
+import javax.cache.expiry.ExpiryPolicy;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
@@ -36,10 +39,6 @@ import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteUuid;
import org.jetbrains.annotations.Nullable;
-import javax.cache.expiry.ExpiryPolicy;
-import java.util.UUID;
-import java.util.concurrent.atomic.AtomicReference;
-
import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.CLOCK;
import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_ASYNC;
@@ -255,11 +254,11 @@ public abstract class GridNearAtomicAbstractUpdateFuture extends GridFutureAdapt
* @param nodeId Node ID.
* @param req Request.
*/
- protected void mapSingle(UUID nodeId, GridNearAtomicUpdateRequest req) {
+ protected void mapSingle(UUID nodeId, GridNearAtomicAbstractUpdateRequest req) {
if (cctx.localNodeId().equals(nodeId)) {
cache.updateAllAsyncInternal(nodeId, req,
- new CI2<GridNearAtomicUpdateRequest, GridNearAtomicUpdateResponse>() {
- @Override public void apply(GridNearAtomicUpdateRequest req, GridNearAtomicUpdateResponse res) {
+ new CI2<GridNearAtomicAbstractUpdateRequest, GridNearAtomicUpdateResponse>() {
+ @Override public void apply(GridNearAtomicAbstractUpdateRequest req, GridNearAtomicUpdateResponse res) {
onResult(res.nodeId(), res, false);
}
});
@@ -303,7 +302,7 @@ public abstract class GridNearAtomicAbstractUpdateFuture extends GridFutureAdapt
* @param req Request.
* @param e Error.
*/
- protected void onSendError(GridNearAtomicUpdateRequest req, IgniteCheckedException e) {
+ protected void onSendError(GridNearAtomicAbstractUpdateRequest req, IgniteCheckedException e) {
synchronized (mux) {
GridNearAtomicUpdateResponse res = new GridNearAtomicUpdateResponse(cctx.cacheId(),
req.nodeId(),
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java
new file mode 100644
index 0000000..bee2ecd
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java
@@ -0,0 +1,226 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
+
+import java.util.List;
+import java.util.UUID;
+import javax.cache.expiry.ExpiryPolicy;
+import javax.cache.processor.EntryProcessor;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
+import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
+import org.apache.ignite.internal.processors.cache.GridCacheMessage;
+import org.apache.ignite.internal.processors.cache.GridCacheOperation;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ *
+ */
+public abstract class GridNearAtomicAbstractUpdateRequest extends GridCacheMessage implements GridCacheDeployable {
+ /** Message index. */
+ public static final int CACHE_MSG_IDX = nextIndexId();
+
+ /**
+ * @return Mapped node ID.
+ */
+ public abstract UUID nodeId();
+
+ /**
+ * @param nodeId Node ID.
+ */
+ public abstract void nodeId(UUID nodeId);
+
+ /**
+ * @return Subject ID.
+ */
+ public abstract UUID subjectId();
+
+ /**
+ * @return Task name hash.
+ */
+ public abstract int taskNameHash();
+
+ /**
+ * @return Future version.
+ */
+ public abstract GridCacheVersion futureVersion();
+
+ /**
+ * @return Flag indicating whether this is fast-map udpate.
+ */
+ public abstract boolean fastMap();
+
+ /**
+ * @return Update version for fast-map request.
+ */
+ public abstract GridCacheVersion updateVersion();
+
+ /**
+ * @return Topology locked flag.
+ */
+ public abstract boolean topologyLocked();
+
+ /**
+ * @return {@code True} if request sent from client node.
+ */
+ public abstract boolean clientRequest();
+
+ /**
+ * @return Cache write synchronization mode.
+ */
+ public abstract CacheWriteSynchronizationMode writeSynchronizationMode();
+
+ /**
+ * @return Expiry policy.
+ */
+ public abstract ExpiryPolicy expiry();
+
+ /**
+ * @return Return value flag.
+ */
+ public abstract boolean returnValue();
+
+ /**
+ * @return Filter.
+ */
+ @Nullable public abstract CacheEntryPredicate[] filter();
+
+ /**
+ * @return Skip write-through to a persistent storage.
+ */
+ public abstract boolean skipStore();
+
+ /**
+ * @return Keep binary flag.
+ */
+ public abstract boolean keepBinary();
+
+ /**
+ * @return Update operation.
+ */
+ public abstract GridCacheOperation operation();
+
+ /**
+ * @return Optional arguments for entry processor.
+ */
+ @Nullable public abstract Object[] invokeArguments();
+
+ /**
+ * @return Flag indicating whether this request contains primary keys.
+ */
+ public abstract boolean hasPrimary();
+
+ /**
+ * @param res Response.
+ * @return {@code True} if current response was {@code null}.
+ */
+ public abstract boolean onResponse(GridNearAtomicUpdateResponse res);
+
+ /**
+ * @return Response.
+ */
+ @Nullable public abstract GridNearAtomicUpdateResponse response();
+
+ /**
+ * @param key Key to add.
+ * @param val Optional update value.
+ * @param conflictTtl Conflict TTL (optional).
+ * @param conflictExpireTime Conflict expire time (optional).
+ * @param conflictVer Conflict version (optional).
+ * @param primary If given key is primary on this mapping.
+ */
+ public abstract void addUpdateEntry(KeyCacheObject key,
+ @Nullable Object val,
+ long conflictTtl,
+ long conflictExpireTime,
+ @Nullable GridCacheVersion conflictVer,
+ boolean primary);
+
+ /**
+ * @return Keys for this update request.
+ */
+ public abstract List<KeyCacheObject> keys();
+
+ /**
+ * @return Values for this update request.
+ */
+ public abstract List<?> values();
+
+ /**
+ * @param idx Key index.
+ * @return Value.
+ */
+ public abstract CacheObject value(int idx);
+
+ /**
+ * @param idx Key index.
+ * @return Entry processor.
+ */
+ public abstract EntryProcessor<Object, Object, Object> entryProcessor(int idx);
+
+ /**
+ * @param idx Index to get.
+ * @return Write value - either value, or transform closure.
+ */
+ public abstract CacheObject writeValue(int idx);
+
+
+ /**
+ * @return Conflict versions.
+ */
+ @Nullable public abstract List<GridCacheVersion> conflictVersions();
+
+ /**
+ * @param idx Index.
+ * @return Conflict version.
+ */
+ @Nullable public abstract GridCacheVersion conflictVersion(int idx);
+
+ /**
+ * @param idx Index.
+ * @return Conflict TTL.
+ */
+ public abstract long conflictTtl(int idx);
+
+ /**
+ * @param idx Index.
+ * @return Conflict expire time.
+ */
+ public abstract long conflictExpireTime(int idx);
+
+ /**
+ * Cleanup values.
+ *
+ * @param clearKeys If {@code true} clears keys.
+ */
+ public abstract void cleanup(boolean clearKeys);
+
+ /**
+ * @return Keys size.
+ */
+ public abstract int size();
+
+ /**
+ * @param idx Key index.
+ * @return Key.
+ */
+ public abstract KeyCacheObject key(int idx);
+}
[02/50] [abbrv] ignite git commit: GG-11028 Fixed resolving of host
name.
Posted by sb...@apache.org.
GG-11028 Fixed resolving of host name.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d88f422a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d88f422a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d88f422a
Branch: refs/heads/master
Commit: d88f422aeb02738d676d86ce416551b805ad154e
Parents: 5a3a1960
Author: Andrey Novikov <an...@apache.org>
Authored: Wed Nov 9 14:25:38 2016 +0700
Committer: Andrey Novikov <an...@apache.org>
Committed: Wed Nov 9 14:28:54 2016 +0700
----------------------------------------------------------------------
bin/ignite.bat | 5 +++
.../ignite/internal/util/IgniteUtils.java | 47 +++++++++++++++-----
.../visor/misc/VisorResolveHostNameTask.java | 4 +-
3 files changed, 44 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d88f422a/bin/ignite.bat
----------------------------------------------------------------------
diff --git a/bin/ignite.bat b/bin/ignite.bat
index b999b86..db686cc 100644
--- a/bin/ignite.bat
+++ b/bin/ignite.bat
@@ -184,6 +184,11 @@ if %ERRORLEVEL% equ 0 (
:: set JVM_OPTS=%JVM_OPTS% -Djava.net.preferIPv4Stack=true
::
+:: Uncomment to enable reverse DNS lookup.
+::
+:: set JVM_OPTS=%JVM_OPTS% -Dsun.net.spi.nameservice.provider.1=default -Dsun.net.spi.nameservice.provider.2=dns,sun
+
+::
:: Assertions are disabled by default since version 3.5.
:: If you want to enable them - set 'ENABLE_ASSERTIONS' flag to '1'.
::
http://git-wip-us.apache.org/repos/asf/ignite/blob/d88f422a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
index 1e8d648..7b011dd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
@@ -477,6 +477,9 @@ public abstract class IgniteUtils {
private static volatile IgniteBiTuple<Collection<String>, Collection<String>> cachedLocalAddr;
/** */
+ private static volatile IgniteBiTuple<Collection<String>, Collection<String>> cachedLocalAddrAllHostNames;
+
+ /** */
private static final ConcurrentMap<ClassLoader, ConcurrentMap<String, Class>> classCache =
new ConcurrentHashMap8<>();
@@ -1845,41 +1848,61 @@ public abstract class IgniteUtils {
*/
public static IgniteBiTuple<Collection<String>, Collection<String>> resolveLocalAddresses(InetAddress locAddr)
throws IOException, IgniteCheckedException {
+ return resolveLocalAddresses(locAddr, false);
+ }
+
+ /**
+ * Returns host names consistent with {@link #resolveLocalHost(String)}. So when it returns
+ * a common address this method returns single host name, and when a wildcard address passed
+ * this method tries to collect addresses of all available interfaces.
+ *
+ * @param locAddr Local address to resolve.
+ * @param allHostNames If {@code true} then include host names for all addresses.
+ * @return Resolved available addresses and host names of given local address.
+ * @throws IOException If failed.
+ * @throws IgniteCheckedException If no network interfaces found.
+ */
+ public static IgniteBiTuple<Collection<String>, Collection<String>> resolveLocalAddresses(InetAddress locAddr,
+ boolean allHostNames) throws IOException, IgniteCheckedException {
assert locAddr != null;
Collection<String> addrs = new ArrayList<>();
Collection<String> hostNames = new ArrayList<>();
if (locAddr.isAnyLocalAddress()) {
- IgniteBiTuple<Collection<String>, Collection<String>> res = cachedLocalAddr;
+ IgniteBiTuple<Collection<String>, Collection<String>> res =
+ allHostNames ? cachedLocalAddrAllHostNames : cachedLocalAddr;
if (res == null) {
- List<InetAddress> localAddrs = new ArrayList<>();
+ List<InetAddress> locAddrs = new ArrayList<>();
for (NetworkInterface itf : asIterable(NetworkInterface.getNetworkInterfaces())) {
for (InetAddress addr : asIterable(itf.getInetAddresses())) {
if (!addr.isLinkLocalAddress())
- localAddrs.add(addr);
+ locAddrs.add(addr);
}
}
- localAddrs = filterReachable(localAddrs);
+ locAddrs = filterReachable(locAddrs);
- for (InetAddress addr : localAddrs)
- addresses(addr, addrs, hostNames);
+ for (InetAddress addr : locAddrs)
+ addresses(addr, addrs, hostNames, allHostNames);
if (F.isEmpty(addrs))
throw new IgniteCheckedException("No network addresses found (is networking enabled?).");
res = F.t(addrs, hostNames);
- cachedLocalAddr = res;
+ if (allHostNames)
+ cachedLocalAddrAllHostNames = res;
+ else
+ cachedLocalAddr = res;
}
return res;
}
- addresses(locAddr, addrs, hostNames);
+ addresses(locAddr, addrs, hostNames, allHostNames);
return F.t(addrs, hostNames);
}
@@ -1887,16 +1910,20 @@ public abstract class IgniteUtils {
/**
* @param addr Address.
* @param addrs Addresses.
+ * @param allHostNames If {@code true} then include host names for all addresses.
* @param hostNames Host names.
*/
- private static void addresses(InetAddress addr, Collection<String> addrs, Collection<String> hostNames) {
+ private static void addresses(InetAddress addr, Collection<String> addrs, Collection<String> hostNames,
+ boolean allHostNames) {
String hostName = addr.getHostName();
String ipAddr = addr.getHostAddress();
addrs.add(ipAddr);
- if (!F.isEmpty(hostName) && !addr.isLoopbackAddress())
+ if (allHostNames)
+ hostNames.add(hostName);
+ else if (!F.isEmpty(hostName) && !addr.isLoopbackAddress())
hostNames.add(hostName);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d88f422a/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorResolveHostNameTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorResolveHostNameTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorResolveHostNameTask.java
index 0f9e038..f851e26 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorResolveHostNameTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/misc/VisorResolveHostNameTask.java
@@ -66,7 +66,7 @@ public class VisorResolveHostNameTask extends VisorOneNodeTask<Void, Map<String,
try {
IgniteBiTuple<Collection<String>, Collection<String>> addrs =
- IgniteUtils.resolveLocalAddresses(InetAddress.getByName("0.0.0.0"));
+ IgniteUtils.resolveLocalAddresses(InetAddress.getByName("0.0.0.0"), true);
assert (addrs.get1() != null);
assert (addrs.get2() != null);
@@ -104,4 +104,4 @@ public class VisorResolveHostNameTask extends VisorOneNodeTask<Void, Map<String,
return S.toString(VisorResolveHostNameJob.class, this);
}
}
-}
\ No newline at end of file
+}
[45/50] [abbrv] ignite git commit: IGNITE-4239: add GridInternal
annotaion for tasks instead of jobs. This closes #1250.
Posted by sb...@apache.org.
IGNITE-4239: add GridInternal annotaion for tasks instead of jobs. This closes #1250.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/861fab9d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/861fab9d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/861fab9d
Branch: refs/heads/master
Commit: 861fab9d0598ca2f06c4a6f293bf2866af31967c
Parents: fc9ee6a
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Tue Nov 22 14:52:03 2016 +0500
Committer: tledkov-gridgain <tl...@gridgain.com>
Committed: Tue Nov 22 14:52:03 2016 +0500
----------------------------------------------------------------------
.../processors/cache/GridCacheAdapter.java | 11 +-
.../compute/PublicThreadpoolStarvationTest.java | 129 +++++++++++++++++++
.../testsuites/IgniteComputeGridTestSuite.java | 2 +
3 files changed, 135 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/861fab9d/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 55400ab..2e24e67 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
@@ -5443,7 +5443,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
/**
* Global clear all.
*/
- @GridInternal
private static class GlobalClearAllJob extends TopologyVersionAwareJob {
/** */
private static final long serialVersionUID = 0L;
@@ -5482,7 +5481,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
/**
* Global clear keys.
*/
- @GridInternal
private static class GlobalClearKeySetJob<K> extends TopologyVersionAwareJob {
/** */
private static final long serialVersionUID = 0L;
@@ -5527,7 +5525,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
/**
* Global clear all for near cache.
*/
- @GridInternal
private static class GlobalClearAllNearJob extends GlobalClearAllJob {
/** */
private static final long serialVersionUID = 0L;
@@ -5558,7 +5555,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
/**
* Global clear keys for near cache.
*/
- @GridInternal
private static class GlobalClearKeySetNearJob<K> extends GlobalClearKeySetJob<K> {
/** */
private static final long serialVersionUID = 0L;
@@ -5590,7 +5586,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
/**
* Internal callable for partition size calculation.
*/
- @GridInternal
private static class PartitionSizeLongJob extends TopologyVersionAwareJob {
/** */
private static final long serialVersionUID = 0L;
@@ -5636,7 +5631,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
/**
* Internal callable for global size calculation.
*/
- @GridInternal
private static class SizeJob extends TopologyVersionAwareJob {
/** */
private static final long serialVersionUID = 0L;
@@ -5677,7 +5671,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
/**
* Internal callable for global size calculation.
*/
- @GridInternal
private static class SizeLongJob extends TopologyVersionAwareJob {
/** */
private static final long serialVersionUID = 0L;
@@ -6523,6 +6516,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
/**
* Size task.
*/
+ @GridInternal
private static class SizeTask extends ComputeTaskAdapter<Object, Integer> {
/** */
private static final long serialVersionUID = 0L;
@@ -6588,6 +6582,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
/**
* Size task.
*/
+ @GridInternal
private static class SizeLongTask extends ComputeTaskAdapter<Object, Long> {
/** */
private static final long serialVersionUID = 0L;
@@ -6653,6 +6648,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
/**
* Partition Size Long task.
*/
+ @GridInternal
private static class PartitionSizeLongTask extends ComputeTaskAdapter<Object, Long> {
/** */
private static final long serialVersionUID = 0L;
@@ -6737,6 +6733,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
/**
* Clear task.
*/
+ @GridInternal
private static class ClearTask<K> extends ComputeTaskAdapter<Object, Object> {
/** */
private static final long serialVersionUID = 0L;
http://git-wip-us.apache.org/repos/asf/ignite/blob/861fab9d/modules/core/src/test/java/org/apache/ignite/internal/processors/compute/PublicThreadpoolStarvationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/compute/PublicThreadpoolStarvationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/compute/PublicThreadpoolStarvationTest.java
new file mode 100644
index 0000000..e587310
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/compute/PublicThreadpoolStarvationTest.java
@@ -0,0 +1,129 @@
+/*
+ * 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.compute;
+
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.binary.BinaryMarshaller;
+import org.apache.ignite.internal.processors.cache.GridCacheAbstractSelfTest;
+import org.apache.ignite.lang.IgniteRunnable;
+import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+
+/**
+ * Test to validate https://issues.apache.org/jira/browse/IGNITE-4239
+ * Jobs hang when a lot of jobs calculate cache.
+ */
+public class PublicThreadpoolStarvationTest extends GridCacheAbstractSelfTest {
+ /** Cache size. */
+ private static final int CACHE_SIZE = 10;
+
+ /** Cache size. */
+ private static final String CACHE_NAME = "test";
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ cfg.setPublicThreadPoolSize(1);
+
+ ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
+
+ cfg.setMarshaller(new BinaryMarshaller());
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected Class<?>[] indexedTypes() {
+ return new Class<?>[] {
+ Integer.class, String.class,
+ };
+ }
+
+ /** {@inheritDoc} */
+ @Override protected CacheAtomicityMode atomicityMode() {
+ return ATOMIC;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected int gridCount() {
+ return 2;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected CacheMode cacheMode() {
+ return PARTITIONED;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ super.beforeTestsStarted();
+
+ info("Fill caches begin...");
+
+ fillCaches();
+
+ info("Caches are filled.");
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ grid(0).destroyCache(CACHE_NAME);
+
+ super.afterTestsStopped();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ private void fillCaches() throws Exception {
+ grid(0).createCache(CACHE_NAME);
+
+ try (
+ IgniteDataStreamer<Integer, String> streamer =
+ grid(0).dataStreamer(CACHE_NAME)) {
+
+ for (int i = 0; i < CACHE_SIZE; ++i)
+ streamer.addData(i, "Data " + i);
+ }
+
+ awaitPartitionMapExchange();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testCacheSizeOnPublicThreadpoolStarvation() throws Exception {
+ grid(0).compute().run(new IgniteRunnable() {
+ @Override public void run() {
+ try {
+ Thread.sleep(500);
+ }
+ catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ }
+ grid(0).cache(CACHE_NAME).size();
+ }
+ });
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/861fab9d/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteComputeGridTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteComputeGridTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteComputeGridTestSuite.java
index a1a75f8..8a501fd 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteComputeGridTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteComputeGridTestSuite.java
@@ -71,6 +71,7 @@ import org.apache.ignite.internal.TaskNodeRestartTest;
import org.apache.ignite.internal.managers.checkpoint.GridCheckpointManagerSelfTest;
import org.apache.ignite.internal.managers.checkpoint.GridCheckpointTaskSelfTest;
import org.apache.ignite.internal.managers.communication.GridCommunicationManagerListenersSelfTest;
+import org.apache.ignite.internal.processors.compute.PublicThreadpoolStarvationTest;
import org.apache.ignite.p2p.GridMultinodeRedeployContinuousModeSelfTest;
import org.apache.ignite.p2p.GridMultinodeRedeployIsolatedModeSelfTest;
import org.apache.ignite.p2p.GridMultinodeRedeployPrivateModeSelfTest;
@@ -150,6 +151,7 @@ public class IgniteComputeGridTestSuite {
suite.addTestSuite(GridTaskFailoverAffinityRunTest.class);
suite.addTestSuite(TaskNodeRestartTest.class);
suite.addTestSuite(IgniteRoundRobinErrorAfterClientReconnectTest.class);
+ suite.addTestSuite(PublicThreadpoolStarvationTest.class);
return suite;
}
[42/50] [abbrv] ignite git commit: IGNITE-3748 Data rebalancing of
large cache can hang out.
Posted by sb...@apache.org.
IGNITE-3748 Data rebalancing of large cache can hang out.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f80bfbd1
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f80bfbd1
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f80bfbd1
Branch: refs/heads/master
Commit: f80bfbd19e7870554bf3abd13bde89b0f39aaee1
Parents: d15eba4
Author: Anton Vinogradov <av...@apache.org>
Authored: Tue Nov 22 12:02:57 2016 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Tue Nov 22 12:02:57 2016 +0300
----------------------------------------------------------------------
.../dht/preloader/GridDhtPreloader.java | 18 ++++++++++++-
.../ignite/internal/util/GridLogThrottle.java | 28 +++++++++++++++-----
2 files changed, 39 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f80bfbd1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
index 6ed58e7..0865d9f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
@@ -59,6 +59,7 @@ import org.apache.ignite.internal.util.typedef.CI1;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.GPC;
+import org.apache.ignite.internal.util.typedef.internal.LT;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiInClosure;
import org.apache.ignite.lang.IgnitePredicate;
@@ -788,7 +789,22 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
GridDhtLocalPartition part = partsToEvict.poll();
if (part != null)
- part.tryEvict();
+ try {
+ part.tryEvict();
+ }
+ catch (Throwable ex) {
+ if (cctx.kernalContext().isStopping()) {
+ LT.warn(log, ex, "Partition eviction failed (current node is stopping).",
+ false,
+ true);
+
+ partsToEvict.clear();
+
+ return true;
+ }
+ else
+ LT.error(log, ex, "Partition eviction failed, this can cause grid hang.");
+ }
}
finally {
if (!partsToEvict.isEmptyx())
http://git-wip-us.apache.org/repos/asf/ignite/blob/f80bfbd1/modules/core/src/main/java/org/apache/ignite/internal/util/GridLogThrottle.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/GridLogThrottle.java b/modules/core/src/main/java/org/apache/ignite/internal/util/GridLogThrottle.java
index ce6783a..c8ba865 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/GridLogThrottle.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/GridLogThrottle.java
@@ -81,12 +81,12 @@ public class GridLogThrottle {
* @param log Logger.
* @param e Error (optional).
* @param msg Message.
- * @param byMessage Errors group by message, not by tuple(error, msg).
+ * @param byMsg Errors group by message, not by tuple(error, msg).
*/
- public static void error(@Nullable IgniteLogger log, @Nullable Throwable e, String msg, boolean byMessage) {
+ public static void error(@Nullable IgniteLogger log, @Nullable Throwable e, String msg, boolean byMsg) {
assert !F.isEmpty(msg);
- log(log, e, msg, null, LogLevel.ERROR, false, byMessage);
+ log(log, e, msg, null, LogLevel.ERROR, false, byMsg);
}
/**
@@ -109,6 +109,22 @@ public class GridLogThrottle {
* @param e Error (optional).
* @param msg Message.
* @param quite Print warning anyway.
+ * @param byMsg Errors group by message, not by tuple(error, msg).
+ */
+ public static void warn(@Nullable IgniteLogger log, @Nullable Throwable e, String msg, boolean quite, boolean byMsg) {
+ assert !F.isEmpty(msg);
+
+ log(log, e, msg, null, LogLevel.WARN, quite, byMsg);
+ }
+
+
+ /**
+ * Logs warning if needed.
+ *
+ * @param log Logger.
+ * @param e Error (optional).
+ * @param msg Message.
+ * @param quite Print warning anyway.
*/
public static void warn(@Nullable IgniteLogger log, @Nullable Throwable e, String msg, boolean quite) {
assert !F.isEmpty(msg);
@@ -168,15 +184,15 @@ public class GridLogThrottle {
* @param longMsg Long message (or just message).
* @param shortMsg Short message for quite logging.
* @param level Level where messages should appear.
- * @param byMessage Errors group by message, not by tuple(error, msg).
+ * @param byMsg Errors group by message, not by tuple(error, msg).
*/
@SuppressWarnings({"RedundantTypeArguments"})
private static void log(@Nullable IgniteLogger log, @Nullable Throwable e, String longMsg, @Nullable String shortMsg,
- LogLevel level, boolean quiet, boolean byMessage) {
+ LogLevel level, boolean quiet, boolean byMsg) {
assert !F.isEmpty(longMsg);
IgniteBiTuple<Class<? extends Throwable>, String> tup =
- e != null && !byMessage ? F.<Class<? extends Throwable>, String>t(e.getClass(), e.getMessage()) :
+ e != null && !byMsg ? F.<Class<? extends Throwable>, String>t(e.getClass(), e.getMessage()) :
F.<Class<? extends Throwable>, String>t(null, longMsg);
while (true) {
[13/50] [abbrv] ignite git commit: IGNITE-4100: Improved README and
DEVNOTES for CPP.
Posted by sb...@apache.org.
IGNITE-4100: Improved README and DEVNOTES for CPP.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/eac5f0c0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/eac5f0c0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/eac5f0c0
Branch: refs/heads/master
Commit: eac5f0c05b85b620f979bd73d5043ae521b6f2f4
Parents: ef9d6cf
Author: Igor Sapego <is...@gridgain.com>
Authored: Thu Nov 10 21:13:13 2016 +0300
Committer: Igor Sapego <is...@gridgain.com>
Committed: Thu Nov 10 21:13:13 2016 +0300
----------------------------------------------------------------------
modules/platforms/cpp/DEVNOTES.txt | 10 +++++++---
modules/platforms/cpp/README.txt | 10 +++++++---
modules/platforms/cpp/examples/README.txt | 16 +++++++++-------
3 files changed, 23 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/eac5f0c0/modules/platforms/cpp/DEVNOTES.txt
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/DEVNOTES.txt b/modules/platforms/cpp/DEVNOTES.txt
index 924b0d8..5d0b2eb 100644
--- a/modules/platforms/cpp/DEVNOTES.txt
+++ b/modules/platforms/cpp/DEVNOTES.txt
@@ -3,7 +3,9 @@ Apache Ignite C++ Build Instructions
Here you can find instruction on how to build Apache Ignite C++ core library and
stand-alone node binary. To build examples you need to build and install core Apache
Ignite library then refer to $IGNITE_HOME/platforms/cpp/example/README.txt for
-futher instructions.
+further instructions.
+
+For details on ODBC driver installation and usage please refer to odbc/README.txt.
Building on Linux With Autotools
----------------------------------
@@ -15,7 +17,9 @@ Common Requirements:
* JAVA_HOME environment variable must be set pointing to Java installation directory.
* IGNITE_HOME environment variable must be set to Ignite installation directory.
* To build ODBC driver you need to install ODBC Driver Manager on you system.
- Apache Ignite has been tested with UnixODBC.
+ Apache Ignite has been tested with UnixODBC. Make sure that you install development
+ version of the driver manager which contains header files that are necessary for
+ building a driver.
Building the Apache Ignite C++ components:
* Navigate to the directory $IGNITE_HOME/platforms/cpp
@@ -37,7 +41,7 @@ use configure script with the following arguments:
With the config like that you should not have any ignite dependencies as jvm.dll installed
to build ODBC driver.
-NOTE: You may want to use "make install" command to install Ignite libraries and heasders
+NOTE: You may want to use "make install" command to install Ignite libraries and headers
for your operation system. Note however that this action may require superuser privileges.
Building on Windows with Visual Studio (tm)
http://git-wip-us.apache.org/repos/asf/ignite/blob/eac5f0c0/modules/platforms/cpp/README.txt
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/README.txt b/modules/platforms/cpp/README.txt
index dbde9f0..b1d7eef 100644
--- a/modules/platforms/cpp/README.txt
+++ b/modules/platforms/cpp/README.txt
@@ -2,7 +2,7 @@ Apache Ignite C++
==================================
Apache Ignite C++ provides data grid functionality.
-Using Apache Ignite C++ APIs you can execute perform concurrent operations on
+Using Apache Ignite C++ APIs you can perform concurrent operations on
the data stored in cache.
Apache Ignite C++ can access cluster and share data with .Net and
@@ -11,14 +11,18 @@ Java applications using binary object format.
Support for the following will be added in next releases:
* ACID transactions management.
* Distributed locks.
- * Async operations.
+ * Asynchronous operations.
* Cache SQL continuous queries.
* Event listening.
* Compute grid functionality.
Full source code is provided. Users should build the library for intended platform.
+
For build instructions please refer to DEVNOTES.txt.
+For details on ODBC driver installation and usage please refer to
+$IGNITE_HOME/platforms/cpp/odbc/README.txt.
+
Linux info
==============
@@ -49,7 +53,7 @@ Files list:
* ignite.exe - executable to start standalone Ignite C++ node.
* ignite.core.dll - Ignite C++ API library.
- * odbc.dll - Ignite ODBC driver.
+ * ignite.odbc.dll - Ignite ODBC driver.
Development:
http://git-wip-us.apache.org/repos/asf/ignite/blob/eac5f0c0/modules/platforms/cpp/examples/README.txt
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/examples/README.txt b/modules/platforms/cpp/examples/README.txt
index 29df732..91e4869 100644
--- a/modules/platforms/cpp/examples/README.txt
+++ b/modules/platforms/cpp/examples/README.txt
@@ -6,8 +6,13 @@ Common requirements
* Java Development Kit (JDK) must be installed: https://java.com/en/download/index.jsp
* JAVA_HOME environment variable must be set pointing to Java installation directory.
* IGNITE_HOME environment variable must be set to Ignite installation directory.
- * Ignite must be build and packaged using Maven. You can use the followin Maven command: mvn clean package -DskipTests
- * Apache Ignite C++ must be built according to instructions for your platform.
+ * Ignite must be built and packaged using Maven. You can use the following Maven command: mvn clean package -DskipTests
+ * Apache Ignite C++ must be built according to instructions for your platform. Refer to
+ $IGNITE_HOME/platforms/cpp/DEVNOTES.txt for instructions.
+ * For odbc-example additionally ODBC Driver Manager must be present and installed on your platform and
+ Apache Ignite ODBC driver must be built and installed according to instructions for your platform. Refer to
+ $IGNITE_HOME/platforms/cpp/DEVNOTES.txt for build instructions and to $IGNITE_HOME/platforms/cpp/odbc/README.txt.
+ for installation instructions.
Running examples on Linux
----------------------------------
@@ -22,11 +27,8 @@ To build examples execute the following commands one by one from examples root d
As a result executables will appear in every example's directory.
-Before running examples ensure that:
- * LD_LIBRARY_PATH environment variable is set and pointing to a directory with "libjvm.so" library. Typically this
- library is located in $JAVA_HOME/jre/lib/amd64/server directory.
- * For odbc-example additionaly ODBC Driver Manager must be present and installed on your platform and
- Apache Ignite ODBC driver must be built and installed according to instructions for your platform.
+Before running examples ensure that LD_LIBRARY_PATH environment variable is set and pointing to a directory with
+"libjvm.so" library. Typically this library is located in $JAVA_HOME/jre/lib/amd64/server directory.
Running examples on Windows
----------------------------------
[32/50] [abbrv] ignite git commit: IGNITE-2523 "single put" NEAR
update request
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
deleted file mode 100644
index 5057fbb..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
+++ /dev/null
@@ -1,1092 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
-
-import java.io.Externalizable;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.UUID;
-import javax.cache.expiry.ExpiryPolicy;
-import javax.cache.processor.EntryProcessor;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.cache.CacheWriteSynchronizationMode;
-import org.apache.ignite.internal.GridDirectCollection;
-import org.apache.ignite.internal.GridDirectTransient;
-import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
-import org.apache.ignite.internal.processors.cache.CacheObject;
-import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.GridCacheDeployable;
-import org.apache.ignite.internal.processors.cache.GridCacheMessage;
-import org.apache.ignite.internal.processors.cache.GridCacheOperation;
-import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
-import org.apache.ignite.internal.processors.cache.KeyCacheObject;
-import org.apache.ignite.internal.processors.cache.distributed.IgniteExternalizableExpiryPolicy;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.internal.util.GridLongList;
-import org.apache.ignite.internal.util.tostring.GridToStringInclude;
-import org.apache.ignite.internal.util.typedef.internal.CU;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
-import org.apache.ignite.plugin.extensions.communication.MessageReader;
-import org.apache.ignite.plugin.extensions.communication.MessageWriter;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import static org.apache.ignite.internal.processors.cache.GridCacheOperation.DELETE;
-import static org.apache.ignite.internal.processors.cache.GridCacheOperation.TRANSFORM;
-import static org.apache.ignite.internal.processors.cache.GridCacheOperation.UPDATE;
-
-/**
- * Lite DHT cache update request sent from near node to primary node.
- */
-public class GridNearAtomicUpdateRequest extends GridCacheMessage implements GridCacheDeployable {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** Message index. */
- public static final int CACHE_MSG_IDX = nextIndexId();
-
- /** Target node ID. */
- @GridDirectTransient
- private UUID nodeId;
-
- /** Future version. */
- private GridCacheVersion futVer;
-
- /** Fast map flag. */
- private boolean fastMap;
-
- /** Update version. Set to non-null if fastMap is {@code true}. */
- private GridCacheVersion updateVer;
-
- /** Topology version. */
- private AffinityTopologyVersion topVer;
-
- /** Topology locked flag. Set if atomic update is performed inside TX or explicit lock. */
- private boolean topLocked;
-
- /** Write synchronization mode. */
- private CacheWriteSynchronizationMode syncMode;
-
- /** Update operation. */
- private GridCacheOperation op;
-
- /** Keys to update. */
- @GridToStringInclude
- @GridDirectCollection(KeyCacheObject.class)
- private List<KeyCacheObject> keys;
-
- /** Values to update. */
- @GridDirectCollection(CacheObject.class)
- private List<CacheObject> vals;
-
- /** Partitions of keys. */
- @GridDirectCollection(int.class)
- private List<Integer> partIds;
-
- /** Entry processors. */
- @GridDirectTransient
- private List<EntryProcessor<Object, Object, Object>> entryProcessors;
-
- /** Entry processors bytes. */
- @GridDirectCollection(byte[].class)
- private List<byte[]> entryProcessorsBytes;
-
- /** Optional arguments for entry processor. */
- @GridDirectTransient
- private Object[] invokeArgs;
-
- /** Entry processor arguments bytes. */
- private byte[][] invokeArgsBytes;
-
- /** Conflict versions. */
- @GridDirectCollection(GridCacheVersion.class)
- private List<GridCacheVersion> conflictVers;
-
- /** Conflict TTLs. */
- private GridLongList conflictTtls;
-
- /** Conflict expire times. */
- private GridLongList conflictExpireTimes;
-
- /** Return value flag. */
- private boolean retval;
-
- /** Expiry policy. */
- @GridDirectTransient
- private ExpiryPolicy expiryPlc;
-
- /** Expiry policy bytes. */
- private byte[] expiryPlcBytes;
-
- /** Filter. */
- private CacheEntryPredicate[] filter;
-
- /** Flag indicating whether request contains primary keys. */
- private boolean hasPrimary;
-
- /** Subject ID. */
- private UUID subjId;
-
- /** Task name hash. */
- private int taskNameHash;
-
- /** Skip write-through to a persistent storage. */
- private boolean skipStore;
-
- /** */
- private boolean clientReq;
-
- /** Keep binary flag. */
- private boolean keepBinary;
-
- /** */
- @GridDirectTransient
- private GridNearAtomicUpdateResponse res;
-
- /** Maximum possible size of inner collections. */
- @GridDirectTransient
- private int initSize;
-
- /**
- * Empty constructor required by {@link Externalizable}.
- */
- public GridNearAtomicUpdateRequest() {
- // No-op.
- }
-
- /**
- * Constructor.
- *
- * @param cacheId Cache ID.
- * @param nodeId Node ID.
- * @param futVer Future version.
- * @param fastMap Fast map scheme flag.
- * @param updateVer Update version set if fast map is performed.
- * @param topVer Topology version.
- * @param topLocked Topology locked flag.
- * @param syncMode Synchronization mode.
- * @param op Cache update operation.
- * @param retval Return value required flag.
- * @param expiryPlc Expiry policy.
- * @param invokeArgs Optional arguments for entry processor.
- * @param filter Optional filter for atomic check.
- * @param subjId Subject ID.
- * @param taskNameHash Task name hash code.
- * @param skipStore Skip write-through to a persistent storage.
- * @param keepBinary Keep binary flag.
- * @param clientReq Client node request flag.
- * @param addDepInfo Deployment info flag.
- * @param maxEntryCnt Maximum entries count.
- */
- public GridNearAtomicUpdateRequest(
- int cacheId,
- UUID nodeId,
- GridCacheVersion futVer,
- boolean fastMap,
- @Nullable GridCacheVersion updateVer,
- @NotNull AffinityTopologyVersion topVer,
- boolean topLocked,
- CacheWriteSynchronizationMode syncMode,
- GridCacheOperation op,
- boolean retval,
- @Nullable ExpiryPolicy expiryPlc,
- @Nullable Object[] invokeArgs,
- @Nullable CacheEntryPredicate[] filter,
- @Nullable UUID subjId,
- int taskNameHash,
- boolean skipStore,
- boolean keepBinary,
- boolean clientReq,
- boolean addDepInfo,
- int maxEntryCnt
- ) {
- assert futVer != null;
-
- this.cacheId = cacheId;
- this.nodeId = nodeId;
- this.futVer = futVer;
- this.fastMap = fastMap;
- this.updateVer = updateVer;
-
- this.topVer = topVer;
- this.topLocked = topLocked;
- this.syncMode = syncMode;
- this.op = op;
- this.retval = retval;
- this.expiryPlc = expiryPlc;
- this.invokeArgs = invokeArgs;
- this.filter = filter;
- this.subjId = subjId;
- this.taskNameHash = taskNameHash;
- this.skipStore = skipStore;
- this.keepBinary = keepBinary;
- this.clientReq = clientReq;
- this.addDepInfo = addDepInfo;
-
- // By default ArrayList expands to array of 10 elements on first add. We cannot guess how many entries
- // will be added to request because of unknown affinity distribution. However, we DO KNOW how many keys
- // participate in request. As such, we know upper bound of all collections in request. If this bound is lower
- // than 10, we use it.
- initSize = Math.min(maxEntryCnt, 10);
-
- keys = new ArrayList<>(initSize);
-
- partIds = new ArrayList<>(initSize);
- }
-
- /** {@inheritDoc} */
- @Override public int lookupIndex() {
- return CACHE_MSG_IDX;
- }
-
- /**
- * @return Mapped node ID.
- */
- public UUID nodeId() {
- return nodeId;
- }
-
- /**
- * @param nodeId Node ID.
- */
- public void nodeId(UUID nodeId) {
- this.nodeId = nodeId;
- }
-
- /**
- * @return Subject ID.
- */
- public UUID subjectId() {
- return subjId;
- }
-
- /**
- * @return Task name hash.
- */
- public int taskNameHash() {
- return taskNameHash;
- }
-
- /**
- * @return Future version.
- */
- public GridCacheVersion futureVersion() {
- return futVer;
- }
-
- /**
- * @return Flag indicating whether this is fast-map udpate.
- */
- public boolean fastMap() {
- return fastMap;
- }
-
- /**
- * @return Update version for fast-map request.
- */
- public GridCacheVersion updateVersion() {
- return updateVer;
- }
-
- /**
- * @return Topology version.
- */
- @Override public AffinityTopologyVersion topologyVersion() {
- return topVer;
- }
-
- /**
- * @return Topology locked flag.
- */
- public boolean topologyLocked() {
- return topLocked;
- }
-
- /**
- * @return {@code True} if request sent from client node.
- */
- public boolean clientRequest() {
- return clientReq;
- }
-
- /**
- * @return Cache write synchronization mode.
- */
- public CacheWriteSynchronizationMode writeSynchronizationMode() {
- return syncMode;
- }
-
- /**
- * @return Expiry policy.
- */
- public ExpiryPolicy expiry() {
- return expiryPlc;
- }
-
- /**
- * @return Return value flag.
- */
- public boolean returnValue() {
- return retval;
- }
-
- /**
- * @return Filter.
- */
- @Nullable public CacheEntryPredicate[] filter() {
- return filter;
- }
-
- /**
- * @return Skip write-through to a persistent storage.
- */
- public boolean skipStore() {
- return skipStore;
- }
-
- /**
- * @return Keep binary flag.
- */
- public boolean keepBinary() {
- return keepBinary;
- }
-
- /**
- * @param key Key to add.
- * @param val Optional update value.
- * @param conflictTtl Conflict TTL (optional).
- * @param conflictExpireTime Conflict expire time (optional).
- * @param conflictVer Conflict version (optional).
- * @param primary If given key is primary on this mapping.
- */
- public void addUpdateEntry(KeyCacheObject key,
- @Nullable Object val,
- long conflictTtl,
- long conflictExpireTime,
- @Nullable GridCacheVersion conflictVer,
- boolean primary) {
- EntryProcessor<Object, Object, Object> entryProcessor = null;
-
- if (op == TRANSFORM) {
- assert val instanceof EntryProcessor : val;
-
- entryProcessor = (EntryProcessor<Object, Object, Object>)val;
- }
-
- assert val != null || op == DELETE;
-
- keys.add(key);
- partIds.add(key.partition());
-
- if (entryProcessor != null) {
- if (entryProcessors == null)
- entryProcessors = new ArrayList<>(initSize);
-
- entryProcessors.add(entryProcessor);
- }
- else if (val != null) {
- assert val instanceof CacheObject : val;
-
- if (vals == null)
- vals = new ArrayList<>(initSize);
-
- vals.add((CacheObject)val);
- }
-
- hasPrimary |= primary;
-
- // In case there is no conflict, do not create the list.
- if (conflictVer != null) {
- if (conflictVers == null) {
- conflictVers = new ArrayList<>(initSize);
-
- for (int i = 0; i < keys.size() - 1; i++)
- conflictVers.add(null);
- }
-
- conflictVers.add(conflictVer);
- }
- else if (conflictVers != null)
- conflictVers.add(null);
-
- if (conflictTtl >= 0) {
- if (conflictTtls == null) {
- conflictTtls = new GridLongList(keys.size());
-
- for (int i = 0; i < keys.size() - 1; i++)
- conflictTtls.add(CU.TTL_NOT_CHANGED);
- }
-
- conflictTtls.add(conflictTtl);
- }
-
- if (conflictExpireTime >= 0) {
- if (conflictExpireTimes == null) {
- conflictExpireTimes = new GridLongList(keys.size());
-
- for (int i = 0; i < keys.size() - 1; i++)
- conflictExpireTimes.add(CU.EXPIRE_TIME_CALCULATE);
- }
-
- conflictExpireTimes.add(conflictExpireTime);
- }
- }
-
- /**
- * @return Keys for this update request.
- */
- public List<KeyCacheObject> keys() {
- return keys;
- }
-
- /**
- * @return Values for this update request.
- */
- public List<?> values() {
- return op == TRANSFORM ? entryProcessors : vals;
- }
-
- /**
- * @return Update operation.
- */
- public GridCacheOperation operation() {
- return op;
- }
-
- /**
- * @return Optional arguments for entry processor.
- */
- @Nullable public Object[] invokeArguments() {
- return invokeArgs;
- }
-
- /**
- * @param idx Key index.
- * @return Value.
- */
- @SuppressWarnings("unchecked")
- public CacheObject value(int idx) {
- assert op == UPDATE : op;
-
- return vals.get(idx);
- }
-
- /**
- * @param idx Key index.
- * @return Entry processor.
- */
- @SuppressWarnings("unchecked")
- public EntryProcessor<Object, Object, Object> entryProcessor(int idx) {
- assert op == TRANSFORM : op;
-
- return entryProcessors.get(idx);
- }
-
- /**
- * @param idx Index to get.
- * @return Write value - either value, or transform closure.
- */
- public CacheObject writeValue(int idx) {
- if (vals != null)
- return vals.get(idx);
-
- return null;
- }
-
- /**
- * @return Conflict versions.
- */
- @Nullable public List<GridCacheVersion> conflictVersions() {
- return conflictVers;
- }
-
- /**
- * @param idx Index.
- * @return Conflict version.
- */
- @Nullable public GridCacheVersion conflictVersion(int idx) {
- if (conflictVers != null) {
- assert idx >= 0 && idx < conflictVers.size();
-
- return conflictVers.get(idx);
- }
-
- return null;
- }
-
- /**
- * @param idx Index.
- * @return Conflict TTL.
- */
- public long conflictTtl(int idx) {
- if (conflictTtls != null) {
- assert idx >= 0 && idx < conflictTtls.size();
-
- return conflictTtls.get(idx);
- }
-
- return CU.TTL_NOT_CHANGED;
- }
-
- /**
- * @param idx Index.
- * @return Conflict expire time.
- */
- public long conflictExpireTime(int idx) {
- if (conflictExpireTimes != null) {
- assert idx >= 0 && idx < conflictExpireTimes.size();
-
- return conflictExpireTimes.get(idx);
- }
-
- return CU.EXPIRE_TIME_CALCULATE;
- }
-
- /**
- * @return Flag indicating whether this request contains primary keys.
- */
- public boolean hasPrimary() {
- return hasPrimary;
- }
-
- /**
- * @param res Response.
- * @return {@code True} if current response was {@code null}.
- */
- public boolean onResponse(GridNearAtomicUpdateResponse res) {
- if (this.res == null) {
- this.res = res;
-
- return true;
- }
-
- return false;
- }
-
- /**
- * @return Response.
- */
- @Nullable public GridNearAtomicUpdateResponse response() {
- return res;
- }
-
- /** {@inheritDoc}
- * @param ctx*/
- @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
- super.prepareMarshal(ctx);
-
- GridCacheContext cctx = ctx.cacheContext(cacheId);
-
- prepareMarshalCacheObjects(keys, cctx);
-
- if (filter != null) {
- boolean hasFilter = false;
-
- for (CacheEntryPredicate p : filter) {
- if (p != null) {
- hasFilter = true;
-
- p.prepareMarshal(cctx);
- }
- }
-
- if (!hasFilter)
- filter = null;
- }
-
- if (expiryPlc != null && expiryPlcBytes == null)
- expiryPlcBytes = CU.marshal(cctx, new IgniteExternalizableExpiryPolicy(expiryPlc));
-
- if (op == TRANSFORM) {
- // force addition of deployment info for entry processors if P2P is enabled globally.
- if (!addDepInfo && ctx.deploymentEnabled())
- addDepInfo = true;
-
- if (entryProcessorsBytes == null)
- entryProcessorsBytes = marshalCollection(entryProcessors, cctx);
-
- if (invokeArgsBytes == null)
- invokeArgsBytes = marshalInvokeArguments(invokeArgs, cctx);
- }
- else
- prepareMarshalCacheObjects(vals, cctx);
- }
-
- /** {@inheritDoc} */
- @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
- super.finishUnmarshal(ctx, ldr);
-
- GridCacheContext cctx = ctx.cacheContext(cacheId);
-
- finishUnmarshalCacheObjects(keys, cctx, ldr);
-
- if (op == TRANSFORM) {
- if (entryProcessors == null)
- entryProcessors = unmarshalCollection(entryProcessorsBytes, ctx, ldr);
-
- if (invokeArgs == null)
- invokeArgs = unmarshalInvokeArguments(invokeArgsBytes, ctx, ldr);
- }
- else
- finishUnmarshalCacheObjects(vals, cctx, ldr);
-
- if (filter != null) {
- for (CacheEntryPredicate p : filter) {
- if (p != null)
- p.finishUnmarshal(cctx, ldr);
- }
- }
-
- if (expiryPlcBytes != null && expiryPlc == null)
- expiryPlc = U.unmarshal(ctx, expiryPlcBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
-
- if (partIds != null && !partIds.isEmpty()) {
- assert partIds.size() == keys.size();
-
- for (int i = 0; i < keys.size(); i++)
- keys.get(i).partition(partIds.get(i));
- }
- }
-
- /** {@inheritDoc} */
- @Override public boolean addDeploymentInfo() {
- return addDepInfo;
- }
-
- /** {@inheritDoc} */
- @Override public IgniteLogger messageLogger(GridCacheSharedContext ctx) {
- return ctx.atomicMessageLogger();
- }
-
- /** {@inheritDoc} */
- @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
- writer.setBuffer(buf);
-
- if (!super.writeTo(buf, writer))
- return false;
-
- if (!writer.isHeaderWritten()) {
- if (!writer.writeHeader(directType(), fieldsCount()))
- return false;
-
- writer.onHeaderWritten();
- }
-
- switch (writer.state()) {
- case 3:
- if (!writer.writeBoolean("clientReq", clientReq))
- return false;
-
- writer.incrementState();
-
- case 4:
- if (!writer.writeMessage("conflictExpireTimes", conflictExpireTimes))
- return false;
-
- writer.incrementState();
-
- case 5:
- if (!writer.writeMessage("conflictTtls", conflictTtls))
- return false;
-
- writer.incrementState();
-
- case 6:
- if (!writer.writeCollection("conflictVers", conflictVers, MessageCollectionItemType.MSG))
- return false;
-
- writer.incrementState();
-
- case 7:
- if (!writer.writeCollection("entryProcessorsBytes", entryProcessorsBytes, MessageCollectionItemType.BYTE_ARR))
- return false;
-
- writer.incrementState();
-
- case 8:
- if (!writer.writeByteArray("expiryPlcBytes", expiryPlcBytes))
- return false;
-
- writer.incrementState();
-
- case 9:
- if (!writer.writeBoolean("fastMap", fastMap))
- return false;
-
- writer.incrementState();
-
- case 10:
- if (!writer.writeObjectArray("filter", filter, MessageCollectionItemType.MSG))
- return false;
-
- writer.incrementState();
-
- case 11:
- if (!writer.writeMessage("futVer", futVer))
- return false;
-
- writer.incrementState();
-
- case 12:
- if (!writer.writeBoolean("hasPrimary", hasPrimary))
- return false;
-
- writer.incrementState();
-
- case 13:
- if (!writer.writeObjectArray("invokeArgsBytes", invokeArgsBytes, MessageCollectionItemType.BYTE_ARR))
- return false;
-
- writer.incrementState();
-
- case 14:
- if (!writer.writeBoolean("keepBinary", keepBinary))
- return false;
-
- writer.incrementState();
-
- case 15:
- if (!writer.writeCollection("keys", keys, MessageCollectionItemType.MSG))
- return false;
-
- writer.incrementState();
-
- case 16:
- if (!writer.writeByte("op", op != null ? (byte)op.ordinal() : -1))
- return false;
-
- writer.incrementState();
-
- case 17:
- if (!writer.writeBoolean("retval", retval))
- return false;
-
- writer.incrementState();
-
- case 18:
- if (!writer.writeBoolean("skipStore", skipStore))
- return false;
-
- writer.incrementState();
-
- case 19:
- if (!writer.writeUuid("subjId", subjId))
- return false;
-
- writer.incrementState();
-
- case 20:
- if (!writer.writeByte("syncMode", syncMode != null ? (byte)syncMode.ordinal() : -1))
- return false;
-
- writer.incrementState();
-
- case 21:
- if (!writer.writeInt("taskNameHash", taskNameHash))
- return false;
-
- writer.incrementState();
-
- case 22:
- if (!writer.writeBoolean("topLocked", topLocked))
- return false;
-
- writer.incrementState();
-
- case 23:
- if (!writer.writeMessage("topVer", topVer))
- return false;
-
- writer.incrementState();
-
- case 24:
- if (!writer.writeMessage("updateVer", updateVer))
- return false;
-
- writer.incrementState();
-
- case 25:
- if (!writer.writeCollection("vals", vals, MessageCollectionItemType.MSG))
- return false;
-
- writer.incrementState();
-
- case 26:
- if (!writer.writeCollection("partIds", partIds, MessageCollectionItemType.INT))
- return false;
-
- writer.incrementState();
- }
-
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
- reader.setBuffer(buf);
-
- if (!reader.beforeMessageRead())
- return false;
-
- if (!super.readFrom(buf, reader))
- return false;
-
- switch (reader.state()) {
- case 3:
- clientReq = reader.readBoolean("clientReq");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 4:
- conflictExpireTimes = reader.readMessage("conflictExpireTimes");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 5:
- conflictTtls = reader.readMessage("conflictTtls");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 6:
- conflictVers = reader.readCollection("conflictVers", MessageCollectionItemType.MSG);
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 7:
- entryProcessorsBytes = reader.readCollection("entryProcessorsBytes", MessageCollectionItemType.BYTE_ARR);
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 8:
- expiryPlcBytes = reader.readByteArray("expiryPlcBytes");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 9:
- fastMap = reader.readBoolean("fastMap");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 10:
- filter = reader.readObjectArray("filter", MessageCollectionItemType.MSG, CacheEntryPredicate.class);
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 11:
- futVer = reader.readMessage("futVer");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 12:
- hasPrimary = reader.readBoolean("hasPrimary");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 13:
- invokeArgsBytes = reader.readObjectArray("invokeArgsBytes", MessageCollectionItemType.BYTE_ARR, byte[].class);
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 14:
- keepBinary = reader.readBoolean("keepBinary");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 15:
- keys = reader.readCollection("keys", MessageCollectionItemType.MSG);
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 16:
- byte opOrd;
-
- opOrd = reader.readByte("op");
-
- if (!reader.isLastRead())
- return false;
-
- op = GridCacheOperation.fromOrdinal(opOrd);
-
- reader.incrementState();
-
- case 17:
- retval = reader.readBoolean("retval");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 18:
- skipStore = reader.readBoolean("skipStore");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 19:
- subjId = reader.readUuid("subjId");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 20:
- byte syncModeOrd;
-
- syncModeOrd = reader.readByte("syncMode");
-
- if (!reader.isLastRead())
- return false;
-
- syncMode = CacheWriteSynchronizationMode.fromOrdinal(syncModeOrd);
-
- reader.incrementState();
-
- case 21:
- taskNameHash = reader.readInt("taskNameHash");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 22:
- topLocked = reader.readBoolean("topLocked");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 23:
- topVer = reader.readMessage("topVer");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 24:
- updateVer = reader.readMessage("updateVer");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 25:
- vals = reader.readCollection("vals", MessageCollectionItemType.MSG);
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 26:
- partIds = reader.readCollection("partIds", MessageCollectionItemType.INT);
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- }
-
- return reader.afterMessageRead(GridNearAtomicUpdateRequest.class);
- }
-
- /**
- * Cleanup values.
- *
- * @param clearKeys If {@code true} clears keys.
- */
- public void cleanup(boolean clearKeys) {
- vals = null;
- entryProcessors = null;
- entryProcessorsBytes = null;
- invokeArgs = null;
- invokeArgsBytes = null;
-
- if (clearKeys)
- keys = null;
- }
-
- /** {@inheritDoc} */
- @Override public byte directType() {
- return 40;
- }
-
- /** {@inheritDoc} */
- @Override public byte fieldsCount() {
- return 27;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(GridNearAtomicUpdateRequest.class, this, "filter", Arrays.toString(filter),
- "parent", super.toString());
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
index 09aec81..a9245f0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
@@ -50,6 +50,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtFuture
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtInvalidPartitionException;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopology;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicAbstractUpdateRequest;
import org.apache.ignite.internal.util.future.GridCompoundFuture;
import org.apache.ignite.internal.util.future.GridFinishedFuture;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
@@ -661,6 +662,15 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
return true;
}
+ /** {@inheritDoc} */
+ @Override public IgniteInternalFuture<Object> request(GridNearAtomicAbstractUpdateRequest req,
+ AffinityTopologyVersion topVer) {
+ if (!needForceKeys())
+ return null;
+
+ return request0(req.keys(), topVer);
+ }
+
/**
* @param keys Keys to request.
* @return Future for request.
@@ -670,6 +680,16 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
if (!needForceKeys())
return null;
+ return request0(keys, topVer);
+ }
+
+ /**
+ * @param keys Keys to request.
+ * @param topVer Topology version.
+ * @return Future for request.
+ */
+ @SuppressWarnings({"unchecked", "RedundantCast"})
+ private GridDhtFuture<Object> request0(Collection<KeyCacheObject> keys, AffinityTopologyVersion topVer) {
final GridDhtForceKeysFuture<?, ?> fut = new GridDhtForceKeysFuture<>(cctx, topVer, keys, this);
IgniteInternalFuture<?> topReadyFut = cctx.affinity().affinityReadyFuturex(topVer);
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
index 3e0e392..b5b2c72 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
@@ -44,7 +44,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtInvali
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponse;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicAbstractUpdateRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse;
import org.apache.ignite.internal.processors.cache.dr.GridCacheDrInfo;
import org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalEx;
@@ -126,10 +126,10 @@ public class GridNearAtomicCache<K, V> extends GridNearCacheAdapter<K, V> {
* @param res Update response.
*/
public void processNearAtomicUpdateResponse(
- GridNearAtomicUpdateRequest req,
+ GridNearAtomicAbstractUpdateRequest req,
GridNearAtomicUpdateResponse res
) {
- if (F.size(res.failedKeys()) == req.keys().size())
+ if (F.size(res.failedKeys()) == req.size())
return;
/*
@@ -152,11 +152,11 @@ public class GridNearAtomicCache<K, V> extends GridNearCacheAdapter<K, V> {
String taskName = ctx.kernalContext().task().resolveTaskName(req.taskNameHash());
- for (int i = 0; i < req.keys().size(); i++) {
+ for (int i = 0; i < req.size(); i++) {
if (F.contains(skipped, i))
continue;
- KeyCacheObject key = req.keys().get(i);
+ KeyCacheObject key = req.key(i);
if (F.contains(failed, key))
continue;
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties
index 0d291cc..71d236f 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -75,13 +75,11 @@ org.apache.ignite.cache.eviction.sorted.SortedEvictionPolicy$HolderComparator
org.apache.ignite.cache.query.CacheQueryEntryEvent
org.apache.ignite.cache.query.ContinuousQuery
org.apache.ignite.cache.query.Query
-org.apache.ignite.cache.query.QueryCancelledException
org.apache.ignite.cache.query.ScanQuery
org.apache.ignite.cache.query.SpiQuery
org.apache.ignite.cache.query.SqlFieldsQuery
org.apache.ignite.cache.query.SqlQuery
org.apache.ignite.cache.query.TextQuery
-org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore$2
org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore$EntryMapping$1
org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore$EntryMapping$2
org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore$TypeKind
@@ -368,7 +366,6 @@ org.apache.ignite.internal.processors.cache.CacheWeakQueryIteratorsHolder$WeakQu
org.apache.ignite.internal.processors.cache.CacheWeakQueryIteratorsHolder$WeakReferenceCloseableIterator
org.apache.ignite.internal.processors.cache.DynamicCacheChangeBatch
org.apache.ignite.internal.processors.cache.DynamicCacheChangeRequest
-org.apache.ignite.internal.processors.cache.EntryProcessorResourceInjectorProxy
org.apache.ignite.internal.processors.cache.GridCacheAdapter
org.apache.ignite.internal.processors.cache.GridCacheAdapter$10
org.apache.ignite.internal.processors.cache.GridCacheAdapter$11
@@ -376,9 +373,9 @@ org.apache.ignite.internal.processors.cache.GridCacheAdapter$12
org.apache.ignite.internal.processors.cache.GridCacheAdapter$13
org.apache.ignite.internal.processors.cache.GridCacheAdapter$14
org.apache.ignite.internal.processors.cache.GridCacheAdapter$15
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$16
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$16$1
org.apache.ignite.internal.processors.cache.GridCacheAdapter$17
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$18$1
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$18
org.apache.ignite.internal.processors.cache.GridCacheAdapter$2
org.apache.ignite.internal.processors.cache.GridCacheAdapter$26$1
org.apache.ignite.internal.processors.cache.GridCacheAdapter$28
@@ -536,7 +533,6 @@ org.apache.ignite.internal.processors.cache.GridCacheUtils$8
org.apache.ignite.internal.processors.cache.GridCacheUtils$9
org.apache.ignite.internal.processors.cache.GridCacheValueCollection
org.apache.ignite.internal.processors.cache.GridCacheValueCollection$1
-org.apache.ignite.internal.processors.cache.GridDeferredAckMessageSender$DeferredAckMessageBuffer
org.apache.ignite.internal.processors.cache.IgniteCacheProxy
org.apache.ignite.internal.processors.cache.IgniteCacheProxy$1
org.apache.ignite.internal.processors.cache.IgniteCacheProxy$10
@@ -549,13 +545,12 @@ org.apache.ignite.internal.processors.cache.IgniteCacheProxy$8
org.apache.ignite.internal.processors.cache.IgniteCacheProxy$9
org.apache.ignite.internal.processors.cache.KeyCacheObject
org.apache.ignite.internal.processors.cache.KeyCacheObjectImpl
-org.apache.ignite.internal.processors.cache.QueryCursorImpl$State
org.apache.ignite.internal.processors.cache.affinity.GridCacheAffinityProxy
org.apache.ignite.internal.processors.cache.binary.BinaryMetadataKey
org.apache.ignite.internal.processors.cache.binary.CacheDefaultBinaryAffinityKeyMapper
org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$1
+org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$4
org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$5
-org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$6
org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$MetaDataEntryFilter
org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$MetaDataPredicate
org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$MetadataProcessor
@@ -635,7 +630,6 @@ org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocal$2
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocalAdapter
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocalAdapter$1
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocalAdapter$2
-org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxOnePhaseCommitAckRequest
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareFuture$1
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareFuture$2
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareFuture$3
@@ -676,24 +670,26 @@ org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomic
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$27
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$28
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$29
+org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$3
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$30
-org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$31
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$4
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$5
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$6
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$7
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$8
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$9
+org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$DeferredResponseBuffer
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicDeferredUpdateResponse
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponse
-org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicAbstractUpdateFuture$1
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateFuture$1
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateFuture$2
+org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateFuture$3
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateFuture$1
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateFuture$2
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateFuture$3
-org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest
+org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateFuture$4
+org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicFullUpdateRequest
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse
org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedCache
org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedCache$2
@@ -764,7 +760,6 @@ org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$2
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$3
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$4
-org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$LockTimeoutObject$1
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$MiniFuture$1
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockRequest
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockResponse
@@ -777,7 +772,6 @@ org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticS
org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticTxPrepareFuture$1
org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticTxPrepareFuture$2
org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticTxPrepareFuture$3
-org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticTxPrepareFuture$4
org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticTxPrepareFuture$MiniFuture$1
org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticTxPrepareFutureAdapter$1
org.apache.ignite.internal.processors.cache.distributed.near.GridNearPessimisticTxPrepareFuture$1
@@ -827,23 +821,22 @@ org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManag
org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager$7
org.apache.ignite.internal.processors.cache.query.GridCacheQueryAdapter$1
org.apache.ignite.internal.processors.cache.query.GridCacheQueryAdapter$ScanQueryFallbackClosableIterator
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryDetailMetricsAdapter
org.apache.ignite.internal.processors.cache.query.GridCacheQueryFutureAdapter$1
org.apache.ignite.internal.processors.cache.query.GridCacheQueryFutureAdapter$2
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$10
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$1$1
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$1$2
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$11
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$12
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$13
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$14
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$15
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$16
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$17$1
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$3$1
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$3$2
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$15$1
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$2
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$3
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$4
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$5
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$6
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$7
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$8
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$9
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$CacheSqlIndexMetadata
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$CacheSqlMetadata
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$CachedResult$QueueIterator
@@ -903,8 +896,6 @@ org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$12
org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$13
org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$14
org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$15
-org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$16
-org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$17
org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$2
org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$3
org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$4
@@ -938,9 +929,9 @@ org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$Po
org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$PostLockClosure1$4
org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$PostLockClosure2
org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$PostMissClosure
+org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$2
org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$3
org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$4
-org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$5
org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$CommitListener
org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$CommittedVersion
org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$NodeFailureTimeoutObject$1
@@ -1014,6 +1005,7 @@ org.apache.ignite.internal.processors.datastreamer.DataStreamerEntry
org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl$1
org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl$4
org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl$5
+org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl$6
org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl$Buffer$1
org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl$Buffer$2
org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl$DataStreamerPda
@@ -1092,7 +1084,6 @@ org.apache.ignite.internal.processors.datastructures.GridCacheSetProxy
org.apache.ignite.internal.processors.datastructures.GridSetQueryPredicate
org.apache.ignite.internal.processors.dr.GridDrType
org.apache.ignite.internal.processors.dr.IgniteDrDataStreamerCacheUpdater
-org.apache.ignite.internal.processors.hadoop.HadoopDefaultJobInfo
org.apache.ignite.internal.processors.hadoop.HadoopFileBlock
org.apache.ignite.internal.processors.hadoop.HadoopInputSplit
org.apache.ignite.internal.processors.hadoop.HadoopJobId
@@ -1128,6 +1119,7 @@ org.apache.ignite.internal.processors.igfs.IgfsFragmentizerManager$IdentityHashS
org.apache.ignite.internal.processors.igfs.IgfsFragmentizerRequest
org.apache.ignite.internal.processors.igfs.IgfsFragmentizerResponse
org.apache.ignite.internal.processors.igfs.IgfsHandshakeResponse
+org.apache.ignite.internal.processors.igfs.IgfsImpl$12$1
org.apache.ignite.internal.processors.igfs.IgfsImpl$IgfsGlobalSpaceTask
org.apache.ignite.internal.processors.igfs.IgfsImpl$IgfsGlobalSpaceTask$1
org.apache.ignite.internal.processors.igfs.IgfsInputStreamDescriptor
@@ -1163,7 +1155,6 @@ org.apache.ignite.internal.processors.igfs.client.IgfsClientSummaryCallable
org.apache.ignite.internal.processors.igfs.client.IgfsClientUpdateCallable
org.apache.ignite.internal.processors.igfs.client.meta.IgfsClientMetaIdsForPathCallable
org.apache.ignite.internal.processors.igfs.client.meta.IgfsClientMetaInfoForPathCallable
-org.apache.ignite.internal.processors.igfs.client.meta.IgfsClientMetaUnlockCallable
org.apache.ignite.internal.processors.igfs.data.IgfsDataPutProcessor
org.apache.ignite.internal.processors.igfs.meta.IgfsMetaDirectoryCreateProcessor
org.apache.ignite.internal.processors.igfs.meta.IgfsMetaDirectoryListingAddProcessor
@@ -1181,8 +1172,6 @@ org.apache.ignite.internal.processors.igfs.meta.IgfsMetaUpdateTimesProcessor
org.apache.ignite.internal.processors.job.GridJobProcessor$5
org.apache.ignite.internal.processors.job.GridJobWorker$3
org.apache.ignite.internal.processors.jobmetrics.GridJobMetricsProcessor$SnapshotReducer
-org.apache.ignite.internal.processors.odbc.OdbcProtocolVersion
-org.apache.ignite.internal.processors.odbc.escape.OdbcEscapeType
org.apache.ignite.internal.processors.platform.PlatformAbstractConfigurationClosure
org.apache.ignite.internal.processors.platform.PlatformAbstractPredicate
org.apache.ignite.internal.processors.platform.PlatformEventFilterListener
@@ -1191,7 +1180,7 @@ org.apache.ignite.internal.processors.platform.PlatformExtendedException
org.apache.ignite.internal.processors.platform.PlatformJavaObjectFactoryProxy
org.apache.ignite.internal.processors.platform.PlatformNativeException
org.apache.ignite.internal.processors.platform.PlatformNoCallbackException
-org.apache.ignite.internal.processors.platform.cache.PlatformCache$5
+org.apache.ignite.internal.processors.platform.cache.PlatformCache$1
org.apache.ignite.internal.processors.platform.cache.PlatformCacheEntryFilter
org.apache.ignite.internal.processors.platform.cache.PlatformCacheEntryFilterImpl
org.apache.ignite.internal.processors.platform.cache.PlatformCacheEntryProcessor
@@ -1222,8 +1211,6 @@ org.apache.ignite.internal.processors.platform.cpp.PlatformCppConfigurationClosu
org.apache.ignite.internal.processors.platform.datastreamer.PlatformStreamReceiver
org.apache.ignite.internal.processors.platform.datastreamer.PlatformStreamReceiverImpl
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$1
-org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$10
-org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$11
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$2
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$3
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$4
@@ -1231,7 +1218,6 @@ org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$5
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$6
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$7
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$8
-org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$9
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetConfigurationClosure
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetService
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetServiceImpl
@@ -1246,24 +1232,19 @@ org.apache.ignite.internal.processors.platform.transactions.PlatformTransactions
org.apache.ignite.internal.processors.platform.utils.PlatformFutureUtils$1
org.apache.ignite.internal.processors.platform.utils.PlatformFutureUtils$FutureListenable$1
org.apache.ignite.internal.processors.platform.utils.PlatformFutureUtils$InternalFutureListenable$1
-org.apache.ignite.internal.processors.platform.websession.PlatformDotNetSessionLockProcessor
-org.apache.ignite.internal.processors.platform.websession.PlatformDotNetSessionSetAndUnlockProcessor
org.apache.ignite.internal.processors.query.GridQueryFieldMetadata
org.apache.ignite.internal.processors.query.GridQueryIndexType
+org.apache.ignite.internal.processors.query.GridQueryProcessor$2
org.apache.ignite.internal.processors.query.GridQueryProcessor$3
org.apache.ignite.internal.processors.query.GridQueryProcessor$4
org.apache.ignite.internal.processors.query.GridQueryProcessor$5
org.apache.ignite.internal.processors.query.GridQueryProcessor$6
-org.apache.ignite.internal.processors.query.GridQueryProcessor$7
-org.apache.ignite.internal.processors.query.GridQueryProcessor$8
org.apache.ignite.internal.processors.query.GridQueryProcessor$IndexType
org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryCancelRequest
org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryFailResponse
org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryNextPageRequest
org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryNextPageResponse
org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryRequest
-org.apache.ignite.internal.processors.resource.GridResourceIoc$AnnotationSet
-org.apache.ignite.internal.processors.resource.GridResourceIoc$ResourceAnnotation
org.apache.ignite.internal.processors.rest.GridRestCommand
org.apache.ignite.internal.processors.rest.GridRestProcessor$2$1
org.apache.ignite.internal.processors.rest.GridRestProcessor$3
@@ -1351,7 +1332,7 @@ org.apache.ignite.internal.processors.service.ServiceDescriptorImpl
org.apache.ignite.internal.processors.task.GridTaskProcessor$1
org.apache.ignite.internal.processors.task.GridTaskThreadContextKey
org.apache.ignite.internal.processors.task.GridTaskWorker$3
-org.apache.ignite.internal.processors.task.GridTaskWorker$5
+org.apache.ignite.internal.processors.task.GridTaskWorker$4
org.apache.ignite.internal.processors.task.GridTaskWorker$State
org.apache.ignite.internal.transactions.IgniteTxHeuristicCheckedException
org.apache.ignite.internal.transactions.IgniteTxOptimisticCheckedException
@@ -1375,7 +1356,6 @@ org.apache.ignite.internal.util.GridBoundedConcurrentOrderedMap
org.apache.ignite.internal.util.GridBoundedConcurrentOrderedSet
org.apache.ignite.internal.util.GridBoundedLinkedHashMap
org.apache.ignite.internal.util.GridBoundedLinkedHashSet
-org.apache.ignite.internal.util.GridBoundedPriorityQueue
org.apache.ignite.internal.util.GridByteArrayList
org.apache.ignite.internal.util.GridCloseableIteratorAdapter
org.apache.ignite.internal.util.GridCloseableIteratorAdapterEx
@@ -1427,14 +1407,14 @@ org.apache.ignite.internal.util.IgniteUtils$11
org.apache.ignite.internal.util.IgniteUtils$12
org.apache.ignite.internal.util.IgniteUtils$13
org.apache.ignite.internal.util.IgniteUtils$14
-org.apache.ignite.internal.util.IgniteUtils$15
-org.apache.ignite.internal.util.IgniteUtils$17
+org.apache.ignite.internal.util.IgniteUtils$16
+org.apache.ignite.internal.util.IgniteUtils$2
+org.apache.ignite.internal.util.IgniteUtils$22
org.apache.ignite.internal.util.IgniteUtils$23
org.apache.ignite.internal.util.IgniteUtils$24
org.apache.ignite.internal.util.IgniteUtils$25
org.apache.ignite.internal.util.IgniteUtils$26
org.apache.ignite.internal.util.IgniteUtils$27
-org.apache.ignite.internal.util.IgniteUtils$28
org.apache.ignite.internal.util.IgniteUtils$3
org.apache.ignite.internal.util.IgniteUtils$4
org.apache.ignite.internal.util.IgniteUtils$5
@@ -1667,19 +1647,12 @@ org.apache.ignite.internal.visor.cache.VisorCachePartitionsTask
org.apache.ignite.internal.visor.cache.VisorCachePartitionsTask$VisorCachePartitionsJob
org.apache.ignite.internal.visor.cache.VisorCacheQueryConfiguration
org.apache.ignite.internal.visor.cache.VisorCacheQueryConfigurationV2
-org.apache.ignite.internal.visor.cache.VisorCacheQueryDetailMetrics
-org.apache.ignite.internal.visor.cache.VisorCacheQueryDetailMetricsCollectorTask
-org.apache.ignite.internal.visor.cache.VisorCacheQueryDetailMetricsCollectorTask$VisorCacheQueryDetailMetricsCollectorJob
org.apache.ignite.internal.visor.cache.VisorCacheQueryMetrics
org.apache.ignite.internal.visor.cache.VisorCacheRebalanceConfiguration
org.apache.ignite.internal.visor.cache.VisorCacheRebalanceTask
org.apache.ignite.internal.visor.cache.VisorCacheRebalanceTask$VisorCachesRebalanceJob
org.apache.ignite.internal.visor.cache.VisorCacheResetMetricsTask
org.apache.ignite.internal.visor.cache.VisorCacheResetMetricsTask$VisorCacheResetMetricsJob
-org.apache.ignite.internal.visor.cache.VisorCacheResetQueryDetailMetricsTask
-org.apache.ignite.internal.visor.cache.VisorCacheResetQueryDetailMetricsTask$VisorCacheResetQueryDetailMetricsJob
-org.apache.ignite.internal.visor.cache.VisorCacheResetQueryMetricsTask
-org.apache.ignite.internal.visor.cache.VisorCacheResetQueryMetricsTask$VisorCacheResetQueryMetricsJob
org.apache.ignite.internal.visor.cache.VisorCacheStartTask
org.apache.ignite.internal.visor.cache.VisorCacheStartTask$VisorCacheStartArg
org.apache.ignite.internal.visor.cache.VisorCacheStartTask$VisorCacheStartJob
@@ -1709,7 +1682,6 @@ org.apache.ignite.internal.visor.debug.VisorThreadLockInfo
org.apache.ignite.internal.visor.debug.VisorThreadMonitorInfo
org.apache.ignite.internal.visor.event.VisorGridDeploymentEvent
org.apache.ignite.internal.visor.event.VisorGridDiscoveryEvent
-org.apache.ignite.internal.visor.event.VisorGridDiscoveryEventV2
org.apache.ignite.internal.visor.event.VisorGridEvent
org.apache.ignite.internal.visor.event.VisorGridEventsLost
org.apache.ignite.internal.visor.event.VisorGridJobEvent
@@ -1797,7 +1769,6 @@ org.apache.ignite.internal.visor.util.VisorClusterGroupEmptyException
org.apache.ignite.internal.visor.util.VisorEventMapper
org.apache.ignite.internal.visor.util.VisorExceptionWrapper
org.apache.ignite.internal.visor.util.VisorTaskUtils$4
-org.apache.ignite.internal.visor.util.VisorTaskUtils$5
org.apache.ignite.internal.websession.WebSessionAttributeProcessor
org.apache.ignite.internal.websession.WebSessionEntity
org.apache.ignite.lang.IgniteBiClosure
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheAtomicSingleMessageCountSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheAtomicSingleMessageCountSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheAtomicSingleMessageCountSelfTest.java
new file mode 100644
index 0000000..8822115
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheAtomicSingleMessageCountSelfTest.java
@@ -0,0 +1,259 @@
+/*
+ * 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.HashMap;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
+import javax.cache.processor.EntryProcessorException;
+import javax.cache.processor.MutableEntry;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.cache.CacheEntryProcessor;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.managers.communication.GridIoMessage;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicFullUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateFilterRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateInvokeRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
+import org.apache.ignite.lang.IgniteInClosure;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.PRIMARY;
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/**
+ * Tests single / transform messages being sent between nodes in ATOMIC mode.
+ */
+public class CacheAtomicSingleMessageCountSelfTest extends GridCommonAbstractTest {
+ /** VM ip finder for TCP discovery. */
+ private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+ /** Starting grid index. */
+ private int idx;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
+
+ discoSpi.setForceServerMode(true);
+ discoSpi.setIpFinder(ipFinder);
+
+ cfg.setDiscoverySpi(discoSpi);
+
+ CacheConfiguration cCfg = new CacheConfiguration();
+
+ cCfg.setCacheMode(PARTITIONED);
+ cCfg.setBackups(1);
+ cCfg.setWriteSynchronizationMode(FULL_SYNC);
+ cCfg.setAtomicWriteOrderMode(PRIMARY);
+
+ cfg.setCacheConfiguration(cCfg);
+
+ if (idx++ == 0)
+ cfg.setClientMode(true);
+
+ cfg.setCommunicationSpi(new TestCommunicationSpi());
+
+ return cfg;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testSingleMessage() throws Exception {
+ startGrids(2);
+
+ try {
+ awaitPartitionMapExchange();
+
+ TestCommunicationSpi commSpi = (TestCommunicationSpi)grid(0).configuration().getCommunicationSpi();
+ commSpi.resetCount();
+
+ commSpi.registerMessage(GridNearAtomicFullUpdateRequest.class);
+ commSpi.registerMessage(GridNearAtomicSingleUpdateRequest.class);
+ commSpi.registerMessage(GridNearAtomicSingleUpdateInvokeRequest.class);
+ commSpi.registerMessage(GridNearAtomicSingleUpdateFilterRequest.class);
+
+ int putCnt = 15;
+
+ for (int i = 0; i < putCnt; i++)
+ jcache(0).put(i, i);
+
+ assertEquals(0, commSpi.messageCount(GridNearAtomicFullUpdateRequest.class));
+ assertEquals(putCnt, commSpi.messageCount(GridNearAtomicSingleUpdateRequest.class));
+ assertEquals(0, commSpi.messageCount(GridNearAtomicSingleUpdateInvokeRequest.class));
+ assertEquals(0, commSpi.messageCount(GridNearAtomicSingleUpdateFilterRequest.class));
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testSingleTransformMessage() throws Exception {
+ startGrids(2);
+
+ int cacheId = ((IgniteKernal)grid(0)).internalCache(null).context().cacheId();
+
+ try {
+ awaitPartitionMapExchange();
+
+ TestCommunicationSpi commSpi = (TestCommunicationSpi)grid(0).configuration().getCommunicationSpi();
+
+ commSpi.resetCount();
+ commSpi.filterCacheId(cacheId);
+
+ commSpi.registerMessage(GridNearAtomicFullUpdateRequest.class);
+ commSpi.registerMessage(GridNearAtomicSingleUpdateRequest.class);
+ commSpi.registerMessage(GridNearAtomicSingleUpdateInvokeRequest.class);
+ commSpi.registerMessage(GridNearAtomicSingleUpdateFilterRequest.class);
+
+ int putCnt = 15;
+
+ for (int i = 0; i < putCnt; i++) {
+ jcache(0).invoke(i, new CacheEntryProcessor<Object, Object, Object>() {
+ @Override public Object process(MutableEntry<Object, Object> entry,
+ Object... objects) throws EntryProcessorException {
+ return 2;
+ }
+ });
+ }
+
+ assertEquals(0, commSpi.messageCount(GridNearAtomicFullUpdateRequest.class));
+ assertEquals(0, commSpi.messageCount(GridNearAtomicSingleUpdateRequest.class));
+ assertEquals(putCnt, commSpi.messageCount(GridNearAtomicSingleUpdateInvokeRequest.class));
+ assertEquals(0, commSpi.messageCount(GridNearAtomicSingleUpdateFilterRequest.class));
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testSingleFilterMessage() throws Exception {
+ startGrids(2);
+
+ try {
+ awaitPartitionMapExchange();
+
+ TestCommunicationSpi commSpi = (TestCommunicationSpi)grid(0).configuration().getCommunicationSpi();
+
+ commSpi.resetCount();
+
+ commSpi.registerMessage(GridNearAtomicFullUpdateRequest.class);
+ commSpi.registerMessage(GridNearAtomicSingleUpdateRequest.class);
+ commSpi.registerMessage(GridNearAtomicSingleUpdateInvokeRequest.class);
+ commSpi.registerMessage(GridNearAtomicSingleUpdateFilterRequest.class);
+
+ int putCnt = 15;
+
+ for (int i = 0; i < putCnt; i++)
+ jcache(0).putIfAbsent(i, i);
+
+ assertEquals(0, commSpi.messageCount(GridNearAtomicFullUpdateRequest.class));
+ assertEquals(0, commSpi.messageCount(GridNearAtomicSingleUpdateRequest.class));
+ assertEquals(0, commSpi.messageCount(GridNearAtomicSingleUpdateInvokeRequest.class));
+ assertEquals(putCnt, commSpi.messageCount(GridNearAtomicSingleUpdateFilterRequest.class));
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
+ * Test communication SPI.
+ */
+ private static class TestCommunicationSpi extends TcpCommunicationSpi {
+ /** Counters map. */
+ private Map<Class<?>, AtomicInteger> cntMap = new HashMap<>();
+
+ /** Cache id to filter */
+ private volatile Integer filterCacheId;
+
+ /** {@inheritDoc} */
+ @Override public void sendMessage(ClusterNode node, Message msg, IgniteInClosure<IgniteException> ackC)
+ throws IgniteSpiException {
+
+ if (((GridIoMessage)msg).message() instanceof GridCacheMessage) {
+ int msgCacheId = ((GridCacheMessage)((GridIoMessage)msg).message()).cacheId();
+
+ if (filterCacheId == null || filterCacheId == msgCacheId) {
+ AtomicInteger cntr = cntMap.get(((GridIoMessage)msg).message().getClass());
+
+ if (cntr != null)
+ cntr.incrementAndGet();
+ }
+ }
+
+ super.sendMessage(node, msg, ackC);
+ }
+
+ /**
+ * Registers message for counting.
+ *
+ * @param cls Class to count.
+ */
+ void registerMessage(Class<?> cls) {
+ AtomicInteger cntr = cntMap.get(cls);
+
+ if (cntr == null)
+ cntMap.put(cls, new AtomicInteger());
+ }
+
+ /**
+ * @param cls Message type to get count.
+ * @return Number of messages of given class.
+ */
+ int messageCount(Class<?> cls) {
+ AtomicInteger cntr = cntMap.get(cls);
+
+ return cntr == null ? 0 : cntr.get();
+ }
+
+ /**
+ * Resets counter to zero.
+ */
+ void resetCount() {
+ cntMap.clear();
+ filterCacheId = null;
+ }
+
+ /**
+ * @param cacheId Cache ID.
+ */
+ void filterCacheId(int cacheId) {
+ filterCacheId = cacheId;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
index 0e17102..a6d612a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
@@ -28,7 +28,8 @@ import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.managers.communication.GridIoMessage;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicFullUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
import org.apache.ignite.lang.IgniteInClosure;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.spi.IgniteSpiException;
@@ -137,11 +138,13 @@ public class GridCacheAtomicMessageCountSelfTest extends GridCommonAbstractTest
TestCommunicationSpi commSpi = (TestCommunicationSpi)grid(0).configuration().getCommunicationSpi();
- commSpi.registerMessage(GridNearAtomicUpdateRequest.class);
+ commSpi.registerMessage(GridNearAtomicSingleUpdateRequest.class);
+ commSpi.registerMessage(GridNearAtomicFullUpdateRequest.class);
commSpi.registerMessage(GridDhtAtomicUpdateRequest.class);
int putCnt = 15;
+ int expNearSingleCnt = 0;
int expNearCnt = 0;
int expDhtCnt = 0;
@@ -160,20 +163,22 @@ public class GridCacheAtomicMessageCountSelfTest extends GridCommonAbstractTest
if (affinity.isPrimary(locNode, i))
expDhtCnt++;
else
- expNearCnt ++;
+ expNearSingleCnt++;
}
jcache(0).put(i, i);
}
- assertEquals(expNearCnt, commSpi.messageCount(GridNearAtomicUpdateRequest.class));
+ assertEquals(expNearCnt, commSpi.messageCount(GridNearAtomicFullUpdateRequest.class));
+ assertEquals(expNearSingleCnt, commSpi.messageCount(GridNearAtomicSingleUpdateRequest.class));
assertEquals(expDhtCnt, commSpi.messageCount(GridDhtAtomicUpdateRequest.class));
if (writeOrderMode == CLOCK) {
for (int i = 1; i < 4; i++) {
commSpi = (TestCommunicationSpi)grid(i).configuration().getCommunicationSpi();
- assertEquals(0, commSpi.messageCount(GridNearAtomicUpdateRequest.class));
+ assertEquals(0, commSpi.messageCount(GridNearAtomicSingleUpdateRequest.class));
+ assertEquals(0, commSpi.messageCount(GridNearAtomicFullUpdateRequest.class));
assertEquals(0, commSpi.messageCount(GridDhtAtomicUpdateRequest.class));
}
}
@@ -181,7 +186,8 @@ public class GridCacheAtomicMessageCountSelfTest extends GridCommonAbstractTest
for (int i = 1; i < 4; i++) {
commSpi = (TestCommunicationSpi)grid(i).configuration().getCommunicationSpi();
- assertEquals(0, commSpi.messageCount(GridNearAtomicUpdateRequest.class));
+ assertEquals(0, commSpi.messageCount(GridNearAtomicSingleUpdateRequest.class));
+ assertEquals(0, commSpi.messageCount(GridNearAtomicFullUpdateRequest.class));
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStopBusySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStopBusySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStopBusySelfTest.java
index cdb7907..281397a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStopBusySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicStopBusySelfTest.java
@@ -18,7 +18,7 @@
package org.apache.ignite.internal.processors.cache;
import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateRequest;
/**
* Stopped node when client operations are executing.
@@ -31,28 +31,28 @@ public class IgniteCacheAtomicStopBusySelfTest extends IgniteCacheAbstractStopBu
/** {@inheritDoc} */
@Override public void testPut() throws Exception {
- bannedMsg.set(GridNearAtomicUpdateRequest.class);
+ bannedMsg.set(GridNearAtomicSingleUpdateRequest.class);
super.testPut();
}
/** {@inheritDoc} */
@Override public void testPutBatch() throws Exception {
- bannedMsg.set(GridNearAtomicUpdateRequest.class);
+ bannedMsg.set(GridNearAtomicSingleUpdateRequest.class);
super.testPut();
}
/** {@inheritDoc} */
@Override public void testPutAsync() throws Exception {
- bannedMsg.set(GridNearAtomicUpdateRequest.class);
+ bannedMsg.set(GridNearAtomicSingleUpdateRequest.class);
super.testPut();
}
/** {@inheritDoc} */
@Override public void testRemove() throws Exception {
- bannedMsg.set(GridNearAtomicUpdateRequest.class);
+ bannedMsg.set(GridNearAtomicSingleUpdateRequest.class);
super.testPut();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingErrorTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingErrorTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingErrorTest.java
index f9608e1..fb2d0de 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingErrorTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingErrorTest.java
@@ -148,7 +148,7 @@ public class IgniteCacheP2pUnmarshallingErrorTest extends IgniteCacheAbstractTes
* @throws Exception If failed.
*/
public void testResponseMessageOnUnmarshallingFailed() throws Exception {
- // GridNearAtomicUpdateRequest unmarshalling failed test.
+ // GridNearAtomicFullUpdateRequest unmarshalling failed test.
readCnt.set(1);
failAtomicPut(++key);
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
index 49c3289..b4ef11a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
@@ -61,7 +61,7 @@ import org.apache.ignite.internal.processors.affinity.GridAffinityFunctionContex
import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
import org.apache.ignite.internal.processors.cache.GridCacheAffinityManager;
import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicFullUpdateRequest;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheEntry;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockRequest;
@@ -230,8 +230,8 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
TestCommunicationSpi spi = (TestCommunicationSpi)ignite2.configuration().getCommunicationSpi();
// Block messages requests for both nodes.
- spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite0.localNode().id());
- spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite1.localNode().id());
+ spi.blockMessages(GridNearAtomicFullUpdateRequest.class, ignite0.localNode().id());
+ spi.blockMessages(GridNearAtomicFullUpdateRequest.class, ignite1.localNode().id());
final IgniteCache<Integer, Integer> cache = ignite2.cache(null);
@@ -272,7 +272,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
map.put(i, i + 1);
// Block messages requests for single node.
- spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite0.localNode().id());
+ spi.blockMessages(GridNearAtomicFullUpdateRequest.class, ignite0.localNode().id());
putFut = GridTestUtils.runAsync(new Callable<Object>() {
@Override public Object call() throws Exception {
@@ -361,11 +361,11 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
TestCommunicationSpi spi = (TestCommunicationSpi)ignite3.configuration().getCommunicationSpi();
// Block messages requests for both nodes.
- spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite0.localNode().id());
- spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite1.localNode().id());
- spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite2.localNode().id());
+ spi.blockMessages(GridNearAtomicFullUpdateRequest.class, ignite0.localNode().id());
+ spi.blockMessages(GridNearAtomicFullUpdateRequest.class, ignite1.localNode().id());
+ spi.blockMessages(GridNearAtomicFullUpdateRequest.class, ignite2.localNode().id());
- spi.record(GridNearAtomicUpdateRequest.class);
+ spi.record(GridNearAtomicFullUpdateRequest.class);
final IgniteCache<Integer, Integer> cache = ignite3.cache(null);
@@ -402,7 +402,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
assertEquals(3, msgs.size());
for (Object msg : msgs)
- assertTrue(((GridNearAtomicUpdateRequest)msg).clientRequest());
+ assertTrue(((GridNearAtomicFullUpdateRequest)msg).clientRequest());
map.put(primaryKey(ignite0.cache(null)), 3);
map.put(primaryKey(ignite1.cache(null)), 4);
@@ -459,8 +459,8 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
TestCommunicationSpi spi = (TestCommunicationSpi)ignite2.configuration().getCommunicationSpi();
// Block messages requests for both nodes.
- spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite0.localNode().id());
- spi.blockMessages(GridNearAtomicUpdateRequest.class, ignite1.localNode().id());
+ spi.blockMessages(GridNearAtomicFullUpdateRequest.class, ignite0.localNode().id());
+ spi.blockMessages(GridNearAtomicFullUpdateRequest.class, ignite1.localNode().id());
final IgniteCache<Integer, Integer> cache = ignite2.cache(null);
http://git-wip-us.apache.org/repos/asf/ignite/blob/a24a394b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
index 74d2d09..0899423 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
@@ -478,7 +478,7 @@ public class GridCacheAtomicInvalidPartitionHandlingSelfTest extends GridCommonA
Object origMsg = msg.message();
return delay &&
- ((origMsg instanceof GridNearAtomicUpdateRequest) || (origMsg instanceof GridDhtAtomicUpdateRequest));
+ ((origMsg instanceof GridNearAtomicAbstractUpdateRequest) || (origMsg instanceof GridDhtAtomicUpdateRequest));
}
}
}
\ No newline at end of file
[16/50] [abbrv] ignite git commit: Fixed classnames.properties
generation for ignite-hadoop module.
Posted by sb...@apache.org.
Fixed classnames.properties generation for ignite-hadoop module.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/73a8fa8b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/73a8fa8b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/73a8fa8b
Branch: refs/heads/master
Commit: 73a8fa8b635cce3b9d8dcad364a32d29f12d4398
Parents: 5a4ebd5
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Fri Nov 11 10:20:32 2016 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Nov 11 10:20:32 2016 +0700
----------------------------------------------------------------------
modules/hadoop/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/73a8fa8b/modules/hadoop/pom.xml
----------------------------------------------------------------------
diff --git a/modules/hadoop/pom.xml b/modules/hadoop/pom.xml
index 15d6eee..d0b0481 100644
--- a/modules/hadoop/pom.xml
+++ b/modules/hadoop/pom.xml
@@ -168,7 +168,7 @@
#
]]>
</argument>
- <argument>org.apache.ignite</argument>
+ <argument>org.apache.ignite.hadoop:org.apache.ignite.internal.processors.hadoop</argument>
</arguments>
</configuration>
</execution>
[43/50] [abbrv] ignite git commit: IGNITE-4227: ODBC: Implemented
SQLError. This closes #1237.
Posted by sb...@apache.org.
IGNITE-4227: ODBC: Implemented SQLError. This closes #1237.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/bc695f8e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/bc695f8e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/bc695f8e
Branch: refs/heads/master
Commit: bc695f8e3306c6d74d4fe53d9a98adedd43ad8f0
Parents: f2dc1d7
Author: Igor Sapego <is...@gridgain.com>
Authored: Tue Nov 22 12:05:15 2016 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Tue Nov 22 12:05:15 2016 +0300
----------------------------------------------------------------------
.../cpp/odbc-test/src/api_robustness_test.cpp | 45 +++++++++++++++
.../platforms/cpp/odbc/include/ignite/odbc.h | 12 +++-
.../ignite/odbc/diagnostic/diagnosable.h | 7 +++
.../odbc/diagnostic/diagnosable_adapter.h | 10 ++++
.../ignite/odbc/diagnostic/diagnostic_record.h | 19 +++++++
.../odbc/diagnostic/diagnostic_record_storage.h | 16 ++++++
.../odbc/os/win/src/system/socket_client.cpp | 4 +-
.../odbc/src/diagnostic/diagnostic_record.cpp | 16 +++++-
.../diagnostic/diagnostic_record_storage.cpp | 18 ++++++
modules/platforms/cpp/odbc/src/entry_points.cpp | 26 ++++-----
modules/platforms/cpp/odbc/src/odbc.cpp | 59 ++++++++++++++++++++
11 files changed, 214 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/bc695f8e/modules/platforms/cpp/odbc-test/src/api_robustness_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/api_robustness_test.cpp b/modules/platforms/cpp/odbc-test/src/api_robustness_test.cpp
index fbd5f12..13a5ea6 100644
--- a/modules/platforms/cpp/odbc-test/src/api_robustness_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/api_robustness_test.cpp
@@ -1066,4 +1066,49 @@ BOOST_AUTO_TEST_CASE(TestFetchScrollFirst)
CheckFetchScrollUnsupportedOrientation(SQL_FETCH_FIRST);
}
+BOOST_AUTO_TEST_CASE(TestSQLError)
+{
+ // There are no checks because we do not really care what is the result of these
+ // calls as long as they do not cause segmentation fault.
+
+ Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;cache=cache");
+
+ SQLCHAR state[6] = { 0 };
+ SQLINTEGER nativeCode = 0;
+ SQLCHAR message[ODBC_BUFFER_SIZE] = { 0 };
+ SQLSMALLINT messageLen = 0;
+
+ // Everything is ok.
+ SQLRETURN ret = SQLError(env, 0, 0, state, &nativeCode, message, sizeof(message), &messageLen);
+
+ if (ret != SQL_SUCCESS && ret != SQL_NO_DATA)
+ BOOST_FAIL("Unexpected error");
+
+ ret = SQLError(0, dbc, 0, state, &nativeCode, message, sizeof(message), &messageLen);
+
+ if (ret != SQL_SUCCESS && ret != SQL_NO_DATA)
+ BOOST_FAIL("Unexpected error");
+
+ ret = SQLError(0, 0, stmt, state, &nativeCode, message, sizeof(message), &messageLen);
+
+ if (ret != SQL_SUCCESS && ret != SQL_NO_DATA)
+ BOOST_FAIL("Unexpected error");
+
+ SQLError(0, 0, 0, state, &nativeCode, message, sizeof(message), &messageLen);
+
+ SQLError(0, 0, stmt, 0, &nativeCode, message, sizeof(message), &messageLen);
+
+ SQLError(0, 0, stmt, state, 0, message, sizeof(message), &messageLen);
+
+ SQLError(0, 0, stmt, state, &nativeCode, 0, sizeof(message), &messageLen);
+
+ SQLError(0, 0, stmt, state, &nativeCode, message, 0, &messageLen);
+
+ SQLError(0, 0, stmt, state, &nativeCode, message, sizeof(message), 0);
+
+ SQLError(0, 0, stmt, 0, 0, 0, 0, 0);
+
+ SQLError(0, 0, 0, 0, 0, 0, 0, 0);
+}
+
BOOST_AUTO_TEST_SUITE_END()
http://git-wip-us.apache.org/repos/asf/ignite/blob/bc695f8e/modules/platforms/cpp/odbc/include/ignite/odbc.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc.h b/modules/platforms/cpp/odbc/include/ignite/odbc.h
index ec0861c..345cdb8 100644
--- a/modules/platforms/cpp/odbc/include/ignite/odbc.h
+++ b/modules/platforms/cpp/odbc/include/ignite/odbc.h
@@ -255,6 +255,16 @@ namespace ignite
SQLRETURN SQLParamData(SQLHSTMT stmt, SQLPOINTER* value);
SQLRETURN SQLPutData(SQLHSTMT stmt, SQLPOINTER data, SQLLEN strLengthOrIndicator);
+
+ SQLRETURN SQLError(SQLHENV env,
+ SQLHDBC conn,
+ SQLHSTMT stmt,
+ SQLCHAR* state,
+ SQLINTEGER* error,
+ SQLCHAR* msgBuf,
+ SQLSMALLINT msgBufLen,
+ SQLSMALLINT* msgResLen);
+
} // namespace ignite
-#endif //_IGNITE_ODBC
+#endif //_IGNITE_ODBC
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/bc695f8e/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnosable.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnosable.h b/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnosable.h
index 909fe01..6937fcc 100644
--- a/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnosable.h
+++ b/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnosable.h
@@ -48,6 +48,13 @@ namespace ignite
virtual const diagnostic::DiagnosticRecordStorage& GetDiagnosticRecords() const = 0;
/**
+ * Get diagnostic record.
+ *
+ * @return Diagnostic record.
+ */
+ virtual diagnostic::DiagnosticRecordStorage& GetDiagnosticRecords() = 0;
+
+ /**
* Add new status record.
*
* @param sqlState SQL state.
http://git-wip-us.apache.org/repos/asf/ignite/blob/bc695f8e/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnosable_adapter.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnosable_adapter.h b/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnosable_adapter.h
index 63d26ca..548eecd 100644
--- a/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnosable_adapter.h
+++ b/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnosable_adapter.h
@@ -62,6 +62,16 @@ namespace ignite
}
/**
+ * Get diagnostic record.
+ *
+ * @return Diagnostic record.
+ */
+ virtual diagnostic::DiagnosticRecordStorage& GetDiagnosticRecords()
+ {
+ return diagnosticRecords;
+ }
+
+ /**
* Add new status record.
*
* @param sqlState SQL state.
http://git-wip-us.apache.org/repos/asf/ignite/blob/bc695f8e/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnostic_record.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnostic_record.h b/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnostic_record.h
index 670e0aa..80d5090 100644
--- a/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnostic_record.h
+++ b/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnostic_record.h
@@ -127,6 +127,19 @@ namespace ignite
*/
int32_t GetColumnNumber() const;
+ /**
+ * Check if the record was retrieved with the SQLError previously.
+ *
+ * return True if the record was retrieved with the SQLError
+ * previously.
+ */
+ bool IsRetrieved() const;
+
+ /**
+ * Mark record as retrieved with the SQLError.
+ */
+ void MarkRetrieved();
+
private:
/** SQL state diagnostic code. */
SqlState sqlState;
@@ -157,6 +170,12 @@ namespace ignite
* result set or the parameter number in the set of parameters.
*/
int32_t columnNum;
+
+ /**
+ * Flag that shows if the record was retrieved with the
+ * SQLError previously.
+ */
+ bool retrieved;
};
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bc695f8e/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnostic_record_storage.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnostic_record_storage.h b/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnostic_record_storage.h
index 4cc3576..b45bb7d 100644
--- a/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnostic_record_storage.h
+++ b/modules/platforms/cpp/odbc/include/ignite/odbc/diagnostic/diagnostic_record_storage.h
@@ -139,6 +139,22 @@ namespace ignite
const DiagnosticRecord& GetStatusRecord(int32_t idx) const;
/**
+ * Get specified status record.
+ *
+ * @param idx Status record index.
+ * @return Status record instance reference.
+ */
+ DiagnosticRecord& GetStatusRecord(int32_t idx);
+
+ /**
+ * Get last non-retrieved status record index.
+ *
+ * @return Index of the last non-retrieved status record or zero
+ * if nothing was found.
+ */
+ int32_t GetLastNonRetrieved() const;
+
+ /**
* Check if the record is in the success state.
*
* @return True if the record is in the success state.
http://git-wip-us.apache.org/repos/asf/ignite/blob/bc695f8e/modules/platforms/cpp/odbc/os/win/src/system/socket_client.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/os/win/src/system/socket_client.cpp b/modules/platforms/cpp/odbc/os/win/src/system/socket_client.cpp
index bc4cdc0..e248323 100644
--- a/modules/platforms/cpp/odbc/os/win/src/system/socket_client.cpp
+++ b/modules/platforms/cpp/odbc/os/win/src/system/socket_client.cpp
@@ -83,8 +83,8 @@ namespace ignite
// Attempt to connect to an address until one succeeds
for (addrinfo *it = result; it != NULL; it = it->ai_next)
{
- LOG_MSG("Addr: %u.%u.%u.%u\n", it->ai_addr->sa_data[2], it->ai_addr->sa_data[3],
- it->ai_addr->sa_data[4], it->ai_addr->sa_data[5]);
+ LOG_MSG("Addr: %u.%u.%u.%u\n", it->ai_addr->sa_data[2] & 0xFF, it->ai_addr->sa_data[3] & 0xFF,
+ it->ai_addr->sa_data[4] & 0xFF, it->ai_addr->sa_data[5] & 0xFF);
// Create a SOCKET for connecting to server
socketHandle = socket(it->ai_family, it->ai_socktype, it->ai_protocol);
http://git-wip-us.apache.org/repos/asf/ignite/blob/bc695f8e/modules/platforms/cpp/odbc/src/diagnostic/diagnostic_record.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/diagnostic/diagnostic_record.cpp b/modules/platforms/cpp/odbc/src/diagnostic/diagnostic_record.cpp
index 1b654d2..215d77f 100644
--- a/modules/platforms/cpp/odbc/src/diagnostic/diagnostic_record.cpp
+++ b/modules/platforms/cpp/odbc/src/diagnostic/diagnostic_record.cpp
@@ -89,7 +89,8 @@ namespace ignite
connectionName(),
serverName(),
rowNum(0),
- columnNum(0)
+ columnNum(0),
+ retrieved(false)
{
// No-op.
}
@@ -102,7 +103,8 @@ namespace ignite
connectionName(connectionName),
serverName(serverName),
rowNum(rowNum),
- columnNum(columnNum)
+ columnNum(columnNum),
+ retrieved(false)
{
// No-op.
}
@@ -260,6 +262,16 @@ namespace ignite
{
return columnNum;
}
+
+ bool DiagnosticRecord::IsRetrieved() const
+ {
+ return retrieved;
+ }
+
+ void DiagnosticRecord::MarkRetrieved()
+ {
+ retrieved = true;
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bc695f8e/modules/platforms/cpp/odbc/src/diagnostic/diagnostic_record_storage.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/diagnostic/diagnostic_record_storage.cpp b/modules/platforms/cpp/odbc/src/diagnostic/diagnostic_record_storage.cpp
index 99ef292..c075567 100644
--- a/modules/platforms/cpp/odbc/src/diagnostic/diagnostic_record_storage.cpp
+++ b/modules/platforms/cpp/odbc/src/diagnostic/diagnostic_record_storage.cpp
@@ -102,6 +102,24 @@ namespace ignite
return statusRecords[idx - 1];
}
+ DiagnosticRecord& DiagnosticRecordStorage::GetStatusRecord(int32_t idx)
+ {
+ return statusRecords[idx - 1];
+ }
+
+ int32_t DiagnosticRecordStorage::GetLastNonRetrieved() const
+ {
+ for (size_t i = 0; i < statusRecords.size(); ++i)
+ {
+ const DiagnosticRecord& record = statusRecords[i];
+
+ if (!record.IsRetrieved())
+ return static_cast<int32_t>(i + 1);
+ }
+
+ return 0;
+ }
+
bool DiagnosticRecordStorage::IsSuccessful() const
{
return result == SQL_RESULT_SUCCESS ||
http://git-wip-us.apache.org/repos/asf/ignite/blob/bc695f8e/modules/platforms/cpp/odbc/src/entry_points.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/entry_points.cpp b/modules/platforms/cpp/odbc/src/entry_points.cpp
index 08016cc..a85b3cf 100644
--- a/modules/platforms/cpp/odbc/src/entry_points.cpp
+++ b/modules/platforms/cpp/odbc/src/entry_points.cpp
@@ -412,6 +412,19 @@ SQLRETURN SQL_API SQLPutData(SQLHSTMT stmt,
return ignite::SQLPutData(stmt, data, strLengthOrIndicator);
}
+SQLRETURN SQL_API SQLError(SQLHENV env,
+ SQLHDBC conn,
+ SQLHSTMT stmt,
+ SQLCHAR* state,
+ SQLINTEGER* error,
+ SQLCHAR* msgBuf,
+ SQLSMALLINT msgBufLen,
+ SQLSMALLINT* msgResLen)
+{
+ return ignite::SQLError(env, conn, stmt, state,
+ error, msgBuf, msgBufLen, msgResLen);
+}
+
//
// ==== Not implemented ====
//
@@ -434,19 +447,6 @@ SQLRETURN SQL_API SQLColAttributes(SQLHSTMT stmt,
return SQL_SUCCESS;
}
-SQLRETURN SQL_API SQLError(SQLHENV env,
- SQLHDBC conn,
- SQLHSTMT stmt,
- SQLCHAR* state,
- SQLINTEGER* error,
- SQLCHAR* msgBuf,
- SQLSMALLINT msgBufLen,
- SQLSMALLINT* msgResLen)
-{
- LOG_MSG("SQLError called\n");
- return SQL_ERROR;
-}
-
SQLRETURN SQL_API SQLGetCursorName(SQLHSTMT stmt,
SQLCHAR* nameBuf,
SQLSMALLINT nameBufLen,
http://git-wip-us.apache.org/repos/asf/ignite/blob/bc695f8e/modules/platforms/cpp/odbc/src/odbc.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/odbc.cpp b/modules/platforms/cpp/odbc/src/odbc.cpp
index 79036eb..684ed08 100644
--- a/modules/platforms/cpp/odbc/src/odbc.cpp
+++ b/modules/platforms/cpp/odbc/src/odbc.cpp
@@ -1255,4 +1255,63 @@ namespace ignite
return statement->GetDiagnosticRecords().GetReturnCode();
}
+ SQLRETURN SQLError(SQLHENV env,
+ SQLHDBC conn,
+ SQLHSTMT stmt,
+ SQLCHAR* state,
+ SQLINTEGER* error,
+ SQLCHAR* msgBuf,
+ SQLSMALLINT msgBufLen,
+ SQLSMALLINT* msgResLen)
+ {
+ using namespace ignite::utility;
+ using namespace ignite::odbc;
+ using namespace ignite::odbc::diagnostic;
+ using namespace ignite::odbc::type_traits;
+
+ using ignite::odbc::app::ApplicationDataBuffer;
+
+ LOG_MSG("SQLError called\n");
+
+ SQLHANDLE handle = 0;
+
+ if (env != 0)
+ handle = static_cast<SQLHANDLE>(env);
+ else if (conn != 0)
+ handle = static_cast<SQLHANDLE>(conn);
+ else if (stmt != 0)
+ handle = static_cast<SQLHANDLE>(stmt);
+ else
+ return SQL_INVALID_HANDLE;
+
+ Diagnosable *diag = reinterpret_cast<Diagnosable*>(handle);
+
+ DiagnosticRecordStorage& records = diag->GetDiagnosticRecords();
+
+ int32_t recNum = records.GetLastNonRetrieved();
+
+ if (recNum < 1 || recNum > records.GetStatusRecordsNumber())
+ return SQL_NO_DATA;
+
+ DiagnosticRecord& record = records.GetStatusRecord(recNum);
+
+ record.MarkRetrieved();
+
+ if (state)
+ CopyStringToBuffer(record.GetSqlState(), reinterpret_cast<char*>(state), 6);
+
+ if (error)
+ *error = 0;
+
+ SqlLen outResLen;
+ ApplicationDataBuffer outBuffer(IGNITE_ODBC_C_TYPE_CHAR, msgBuf, msgBufLen, &outResLen);
+
+ outBuffer.PutString(record.GetMessageText());
+
+ if (msgResLen)
+ *msgResLen = static_cast<SQLSMALLINT>(outResLen);
+
+ return SQL_SUCCESS;
+ }
+
} // namespace ignite;
[14/50] [abbrv] ignite git commit: Fixed classnames.properties
generation for ignite-hadoop module.
Posted by sb...@apache.org.
Fixed classnames.properties generation for ignite-hadoop module.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e159fdee
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e159fdee
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e159fdee
Branch: refs/heads/master
Commit: e159fdee0152a6df1bbf4dafc3d18a284e86a57e
Parents: eac5f0c
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Fri Nov 11 09:39:32 2016 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Nov 11 09:39:32 2016 +0700
----------------------------------------------------------------------
modules/hadoop/pom.xml | 49 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e159fdee/modules/hadoop/pom.xml
----------------------------------------------------------------------
diff --git a/modules/hadoop/pom.xml b/modules/hadoop/pom.xml
index a3f40e5..98f8576 100644
--- a/modules/hadoop/pom.xml
+++ b/modules/hadoop/pom.xml
@@ -127,6 +127,55 @@
<build>
<plugins>
<plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>1.3.2</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.ignite</groupId>
+ <artifactId>ignite-tools</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>java</goal>
+ </goals>
+ <configuration>
+ <includePluginDependencies>true</includePluginDependencies>
+ <mainClass>org.apache.ignite.tools.classgen.ClassesGenerator</mainClass>
+ <arguments>
+ <argument>${project.basedir}/target/classes</argument>
+ <argument>
+ <![CDATA[
+#
+# 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.
+#
+ ]]>
+ </argument>
+ <argument>org.apache.ignite</argument>
+ </arguments>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
[18/50] [abbrv] ignite git commit: Reverted wrong commit.
Posted by sb...@apache.org.
Reverted wrong commit.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f8aa9573
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f8aa9573
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f8aa9573
Branch: refs/heads/master
Commit: f8aa957327312d76f90231b9bfe6d386d1d4ec37
Parents: 73a8fa8
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Fri Nov 11 15:56:42 2016 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Nov 11 15:56:42 2016 +0700
----------------------------------------------------------------------
modules/hadoop/pom.xml | 49 ---------------------------------------------
1 file changed, 49 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f8aa9573/modules/hadoop/pom.xml
----------------------------------------------------------------------
diff --git a/modules/hadoop/pom.xml b/modules/hadoop/pom.xml
index d0b0481..c02a574 100644
--- a/modules/hadoop/pom.xml
+++ b/modules/hadoop/pom.xml
@@ -127,55 +127,6 @@
<build>
<plugins>
<plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>exec-maven-plugin</artifactId>
- <version>1.3.2</version>
- <dependencies>
- <dependency>
- <groupId>org.apache.ignite</groupId>
- <artifactId>ignite-tools</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
- <executions>
- <execution>
- <phase>process-classes</phase>
- <goals>
- <goal>java</goal>
- </goals>
- <configuration>
- <includePluginDependencies>true</includePluginDependencies>
- <mainClass>org.apache.ignite.tools.classgen.ClassesGenerator</mainClass>
- <arguments>
- <argument>${project.basedir}/target/classes</argument>
- <argument>
- <![CDATA[
-#
-# 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.
-#
- ]]>
- </argument>
- <argument>org.apache.ignite.hadoop:org.apache.ignite.internal.processors.hadoop</argument>
- </arguments>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
[17/50] [abbrv] ignite git commit: Fixed classnames.properties
generation for ignite-hadoop module.
Posted by sb...@apache.org.
Fixed classnames.properties generation for ignite-hadoop module.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/53876d3f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/53876d3f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/53876d3f
Branch: refs/heads/master
Commit: 53876d3f1b3e561702fc0cd8c6ddd078d6c7dce6
Parents: e159fde
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Fri Nov 11 10:26:09 2016 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Nov 11 10:26:09 2016 +0700
----------------------------------------------------------------------
modules/hadoop/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/53876d3f/modules/hadoop/pom.xml
----------------------------------------------------------------------
diff --git a/modules/hadoop/pom.xml b/modules/hadoop/pom.xml
index 98f8576..f5bc081 100644
--- a/modules/hadoop/pom.xml
+++ b/modules/hadoop/pom.xml
@@ -168,7 +168,7 @@
#
]]>
</argument>
- <argument>org.apache.ignite</argument>
+ <argument>org.apache.ignite.hadoop:org.apache.ignite.internal.processors.hadoop</argument>
</arguments>
</configuration>
</execution>
[12/50] [abbrv] ignite git commit: IGNITE-4208: Hadoop: Fixed a bug
preventing normal secondary file system start. This closes #1228.
Posted by sb...@apache.org.
IGNITE-4208: Hadoop: Fixed a bug preventing normal secondary file system start. This closes #1228.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ef9d6cf9
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ef9d6cf9
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ef9d6cf9
Branch: refs/heads/master
Commit: ef9d6cf9e334c35b03dfa42e4ce0680c85a693a4
Parents: b749982
Author: iveselovskiy <iv...@gridgain.com>
Authored: Thu Nov 10 18:47:09 2016 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Thu Nov 10 18:48:48 2016 +0300
----------------------------------------------------------------------
.../org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java | 2 +-
.../org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java | 2 +-
.../internal/processors/hadoop/delegate/HadoopDelegateUtils.java | 4 ++--
.../impl/delegate/HadoopIgfsSecondaryFileSystemDelegateImpl.java | 3 +--
.../hadoop/impl/fs/KerberosHadoopFileSystemFactorySelfTest.java | 3 ++-
.../hadoop/impl/igfs/HadoopFIleSystemFactorySelfTest.java | 2 +-
.../impl/igfs/HadoopIgfsSecondaryFileSystemTestAdapter.java | 3 +--
.../impl/igfs/HadoopSecondaryFileSystemConfigurationTest.java | 4 ++--
8 files changed, 11 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ef9d6cf9/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java
index 7133c08..866fc1a 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java
@@ -336,7 +336,7 @@ public class IgniteHadoopFileSystem extends FileSystem {
HadoopFileSystemFactory factory0 =
(HadoopFileSystemFactory)paths.getPayload(getClass().getClassLoader());
- factory = HadoopDelegateUtils.fileSystemFactoryDelegate(factory0);
+ factory = HadoopDelegateUtils.fileSystemFactoryDelegate(getClass().getClassLoader(), factory0);
}
catch (IgniteCheckedException e) {
throw new IOException("Failed to get secondary file system factory.", e);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ef9d6cf9/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java
index 18b8bf9..82ad683 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java
@@ -345,7 +345,7 @@ public class IgniteHadoopFileSystem extends AbstractFileSystem implements Closea
HadoopFileSystemFactory factory0 =
(HadoopFileSystemFactory) paths.getPayload(getClass().getClassLoader());
- factory = HadoopDelegateUtils.fileSystemFactoryDelegate(factory0);
+ factory = HadoopDelegateUtils.fileSystemFactoryDelegate(getClass().getClassLoader(), factory0);
}
catch (IgniteCheckedException e) {
throw new IOException("Failed to get secondary file system factory.", e);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ef9d6cf9/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/delegate/HadoopDelegateUtils.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/delegate/HadoopDelegateUtils.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/delegate/HadoopDelegateUtils.java
index 76d9bff..2059c8d 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/delegate/HadoopDelegateUtils.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/delegate/HadoopDelegateUtils.java
@@ -81,13 +81,13 @@ public class HadoopDelegateUtils {
* @return Delegate.
*/
@SuppressWarnings("unchecked")
- public static HadoopFileSystemFactoryDelegate fileSystemFactoryDelegate(Object proxy) {
+ public static HadoopFileSystemFactoryDelegate fileSystemFactoryDelegate(ClassLoader ldr, Object proxy) {
String clsName = FACTORY_CLS_MAP.get(proxy.getClass().getName());
if (clsName == null)
clsName = DFLT_FACTORY_CLS;
- return newInstance(clsName, null, proxy);
+ return newInstance(clsName, ldr, proxy);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/ef9d6cf9/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/delegate/HadoopIgfsSecondaryFileSystemDelegateImpl.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/delegate/HadoopIgfsSecondaryFileSystemDelegateImpl.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/delegate/HadoopIgfsSecondaryFileSystemDelegateImpl.java
index 203965c..e336fad 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/delegate/HadoopIgfsSecondaryFileSystemDelegateImpl.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/impl/delegate/HadoopIgfsSecondaryFileSystemDelegateImpl.java
@@ -56,7 +56,6 @@ import java.io.OutputStream;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -86,7 +85,7 @@ public class HadoopIgfsSecondaryFileSystemDelegateImpl implements HadoopIgfsSeco
if (factory0 == null)
factory0 = new CachingHadoopFileSystemFactory();
- factory = HadoopDelegateUtils.fileSystemFactoryDelegate(factory0);
+ factory = HadoopDelegateUtils.fileSystemFactoryDelegate(getClass().getClassLoader(), factory0);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/ef9d6cf9/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/fs/KerberosHadoopFileSystemFactorySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/fs/KerberosHadoopFileSystemFactorySelfTest.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/fs/KerberosHadoopFileSystemFactorySelfTest.java
index 8c95a0e..f35d644 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/fs/KerberosHadoopFileSystemFactorySelfTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/fs/KerberosHadoopFileSystemFactorySelfTest.java
@@ -70,7 +70,8 @@ public class KerberosHadoopFileSystemFactorySelfTest extends GridCommonAbstractT
GridTestUtils.assertThrows(null, new Callable<Object>() {
@Override public Object call() throws Exception {
- HadoopFileSystemFactoryDelegate delegate = HadoopDelegateUtils.fileSystemFactoryDelegate(fac);
+ HadoopFileSystemFactoryDelegate delegate = HadoopDelegateUtils.fileSystemFactoryDelegate(
+ getClass().getClassLoader(), fac);
delegate.start();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ef9d6cf9/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopFIleSystemFactorySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopFIleSystemFactorySelfTest.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopFIleSystemFactorySelfTest.java
index 7cf7f2d..5d955d4 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopFIleSystemFactorySelfTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopFIleSystemFactorySelfTest.java
@@ -330,7 +330,7 @@ public class HadoopFIleSystemFactorySelfTest extends IgfsCommonAbstractTest {
/** {@inheritDoc} */
@Override public void start() throws IgniteException {
- delegate = HadoopDelegateUtils.fileSystemFactoryDelegate(factory);
+ delegate = HadoopDelegateUtils.fileSystemFactoryDelegate(getClass().getClassLoader(), factory);
delegate.start();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ef9d6cf9/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopIgfsSecondaryFileSystemTestAdapter.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopIgfsSecondaryFileSystemTestAdapter.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopIgfsSecondaryFileSystemTestAdapter.java
index adb1330..453d0c7 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopIgfsSecondaryFileSystemTestAdapter.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopIgfsSecondaryFileSystemTestAdapter.java
@@ -30,7 +30,6 @@ import org.apache.ignite.configuration.FileSystemConfiguration;
import org.apache.ignite.hadoop.fs.HadoopFileSystemFactory;
import org.apache.ignite.internal.processors.hadoop.delegate.HadoopDelegateUtils;
import org.apache.ignite.internal.processors.hadoop.delegate.HadoopFileSystemFactoryDelegate;
-import org.apache.ignite.internal.processors.hadoop.impl.igfs.HadoopIgfsUtils;
import org.apache.ignite.internal.processors.igfs.IgfsEx;
import org.apache.ignite.internal.processors.igfs.IgfsUtils;
import org.apache.ignite.internal.processors.igfs.IgfsSecondaryFileSystemTestAdapter;
@@ -50,7 +49,7 @@ public class HadoopIgfsSecondaryFileSystemTestAdapter implements IgfsSecondaryFi
public HadoopIgfsSecondaryFileSystemTestAdapter(HadoopFileSystemFactory factory) {
assert factory != null;
- this.factory = HadoopDelegateUtils.fileSystemFactoryDelegate(factory);
+ this.factory = HadoopDelegateUtils.fileSystemFactoryDelegate(getClass().getClassLoader(), factory);
this.factory.start();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ef9d6cf9/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopSecondaryFileSystemConfigurationTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopSecondaryFileSystemConfigurationTest.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopSecondaryFileSystemConfigurationTest.java
index ae03f14..78f457b 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopSecondaryFileSystemConfigurationTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/HadoopSecondaryFileSystemConfigurationTest.java
@@ -37,7 +37,6 @@ import org.apache.ignite.igfs.IgfsIpcEndpointType;
import org.apache.ignite.igfs.IgfsMode;
import org.apache.ignite.internal.processors.hadoop.delegate.HadoopDelegateUtils;
import org.apache.ignite.internal.processors.hadoop.delegate.HadoopFileSystemFactoryDelegate;
-import org.apache.ignite.internal.processors.hadoop.impl.igfs.HadoopIgfsUtils;
import org.apache.ignite.internal.processors.igfs.IgfsCommonAbstractTest;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -185,7 +184,8 @@ public class HadoopSecondaryFileSystemConfigurationTest extends IgfsCommonAbstra
fac.setConfigPaths(primaryConfFullPath);
fac.setUri(primaryFsUriStr);
- HadoopFileSystemFactoryDelegate facDelegate = HadoopDelegateUtils.fileSystemFactoryDelegate(fac);
+ HadoopFileSystemFactoryDelegate facDelegate = HadoopDelegateUtils.fileSystemFactoryDelegate(
+ getClass().getClassLoader(), fac);
facDelegate.start();
[44/50] [abbrv] ignite git commit: Merge remote-tracking branch
'upstream/ignite-1.7.4' into ignite-1.7.4
Posted by sb...@apache.org.
Merge remote-tracking branch 'upstream/ignite-1.7.4' into ignite-1.7.4
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/fc9ee6a7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/fc9ee6a7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/fc9ee6a7
Branch: refs/heads/master
Commit: fc9ee6a74fe0bf413ab0643d2776a1a43e6dd5d2
Parents: bc695f8 f80bfbd
Author: devozerov <vo...@gridgain.com>
Authored: Tue Nov 22 12:05:32 2016 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Tue Nov 22 12:05:32 2016 +0300
----------------------------------------------------------------------
.../GridDhtAtomicAbstractUpdateFuture.java | 19 ++++++++-----
.../dht/atomic/GridDhtAtomicCache.java | 2 +-
.../atomic/GridDhtAtomicSingleUpdateFuture.java | 30 +++++++++++++-------
.../dht/atomic/GridDhtAtomicUpdateFuture.java | 10 +++++--
.../GridNearAtomicAbstractUpdateRequest.java | 5 ----
.../atomic/GridNearAtomicFullUpdateRequest.java | 5 ----
.../GridNearAtomicSingleUpdateRequest.java | 9 ------
.../dht/preloader/GridDhtPreloader.java | 18 +++++++++++-
.../datastreamer/DataStreamerImpl.java | 2 +-
.../ignite/internal/util/GridLogThrottle.java | 28 ++++++++++++++----
...CacheLoadingConcurrentGridStartSelfTest.java | 6 +++-
11 files changed, 84 insertions(+), 50 deletions(-)
----------------------------------------------------------------------
[41/50] [abbrv] ignite git commit: IGNITE-4225 DataStreamer can hang
on changing topology
Posted by sb...@apache.org.
IGNITE-4225 DataStreamer can hang on changing topology
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d15eba4b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d15eba4b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d15eba4b
Branch: refs/heads/master
Commit: d15eba4becf7515b512c1032b193ce75e1589177
Parents: d32fa21
Author: Anton Vinogradov <av...@apache.org>
Authored: Tue Nov 22 11:56:20 2016 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Tue Nov 22 11:56:20 2016 +0300
----------------------------------------------------------------------
.../ignite/internal/processors/datastreamer/DataStreamerImpl.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d15eba4b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
index 443783b..bb9ffdd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
@@ -1919,7 +1919,7 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
AffinityTopologyVersion topVer = cctx.isLocal() ?
cctx.affinity().affinityTopologyVersion() :
- cctx.topology().topologyVersion();
+ cctx.shared().exchange().readyAffinityVersion();
GridCacheVersion ver = cctx.versions().isolatedStreamerVersion();
[07/50] [abbrv] ignite git commit: Fixed javadoc.
Posted by sb...@apache.org.
Fixed javadoc.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/26daa57c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/26daa57c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/26daa57c
Branch: refs/heads/master
Commit: 26daa57ca82254d68ac04a7b33223c6eb5ade0e4
Parents: bac0cba
Author: sboikov <sb...@gridgain.com>
Authored: Thu Nov 10 11:17:29 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Nov 10 11:17:29 2016 +0300
----------------------------------------------------------------------
.../spi/discovery/tcp/messages/TcpDiscoveryAbstractMessage.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/26daa57c/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryAbstractMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryAbstractMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryAbstractMessage.java
index 39170ea..783a113 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryAbstractMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryAbstractMessage.java
@@ -99,7 +99,7 @@ public abstract class TcpDiscoveryAbstractMessage implements Serializable {
}
/**
- * @return
+ * @return {@code True} if need use trace logging for this message (to reduce amount of logging with debug level).
*/
public boolean traceLogLevel() {
return false;
[30/50] [abbrv] ignite git commit: IGNITE-3443 Implemented metrics
for queries monitoring.
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties
index ade21ce..0d291cc 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -75,11 +75,13 @@ org.apache.ignite.cache.eviction.sorted.SortedEvictionPolicy$HolderComparator
org.apache.ignite.cache.query.CacheQueryEntryEvent
org.apache.ignite.cache.query.ContinuousQuery
org.apache.ignite.cache.query.Query
+org.apache.ignite.cache.query.QueryCancelledException
org.apache.ignite.cache.query.ScanQuery
org.apache.ignite.cache.query.SpiQuery
org.apache.ignite.cache.query.SqlFieldsQuery
org.apache.ignite.cache.query.SqlQuery
org.apache.ignite.cache.query.TextQuery
+org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore$2
org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore$EntryMapping$1
org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore$EntryMapping$2
org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore$TypeKind
@@ -366,6 +368,7 @@ org.apache.ignite.internal.processors.cache.CacheWeakQueryIteratorsHolder$WeakQu
org.apache.ignite.internal.processors.cache.CacheWeakQueryIteratorsHolder$WeakReferenceCloseableIterator
org.apache.ignite.internal.processors.cache.DynamicCacheChangeBatch
org.apache.ignite.internal.processors.cache.DynamicCacheChangeRequest
+org.apache.ignite.internal.processors.cache.EntryProcessorResourceInjectorProxy
org.apache.ignite.internal.processors.cache.GridCacheAdapter
org.apache.ignite.internal.processors.cache.GridCacheAdapter$10
org.apache.ignite.internal.processors.cache.GridCacheAdapter$11
@@ -373,9 +376,9 @@ org.apache.ignite.internal.processors.cache.GridCacheAdapter$12
org.apache.ignite.internal.processors.cache.GridCacheAdapter$13
org.apache.ignite.internal.processors.cache.GridCacheAdapter$14
org.apache.ignite.internal.processors.cache.GridCacheAdapter$15
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$16$1
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$16
org.apache.ignite.internal.processors.cache.GridCacheAdapter$17
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$18
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$18$1
org.apache.ignite.internal.processors.cache.GridCacheAdapter$2
org.apache.ignite.internal.processors.cache.GridCacheAdapter$26$1
org.apache.ignite.internal.processors.cache.GridCacheAdapter$28
@@ -533,6 +536,7 @@ org.apache.ignite.internal.processors.cache.GridCacheUtils$8
org.apache.ignite.internal.processors.cache.GridCacheUtils$9
org.apache.ignite.internal.processors.cache.GridCacheValueCollection
org.apache.ignite.internal.processors.cache.GridCacheValueCollection$1
+org.apache.ignite.internal.processors.cache.GridDeferredAckMessageSender$DeferredAckMessageBuffer
org.apache.ignite.internal.processors.cache.IgniteCacheProxy
org.apache.ignite.internal.processors.cache.IgniteCacheProxy$1
org.apache.ignite.internal.processors.cache.IgniteCacheProxy$10
@@ -545,12 +549,13 @@ org.apache.ignite.internal.processors.cache.IgniteCacheProxy$8
org.apache.ignite.internal.processors.cache.IgniteCacheProxy$9
org.apache.ignite.internal.processors.cache.KeyCacheObject
org.apache.ignite.internal.processors.cache.KeyCacheObjectImpl
+org.apache.ignite.internal.processors.cache.QueryCursorImpl$State
org.apache.ignite.internal.processors.cache.affinity.GridCacheAffinityProxy
org.apache.ignite.internal.processors.cache.binary.BinaryMetadataKey
org.apache.ignite.internal.processors.cache.binary.CacheDefaultBinaryAffinityKeyMapper
org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$1
-org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$4
org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$5
+org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$6
org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$MetaDataEntryFilter
org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$MetaDataPredicate
org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$MetadataProcessor
@@ -630,6 +635,7 @@ org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocal$2
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocalAdapter
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocalAdapter$1
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocalAdapter$2
+org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxOnePhaseCommitAckRequest
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareFuture$1
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareFuture$2
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareFuture$3
@@ -670,25 +676,23 @@ org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomic
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$27
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$28
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$29
-org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$3
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$30
+org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$31
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$4
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$5
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$6
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$7
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$8
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$9
-org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$DeferredResponseBuffer
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicDeferredUpdateResponse
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateRequest
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicUpdateResponse
+org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicAbstractUpdateFuture$1
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateFuture$1
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateFuture$2
-org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateFuture$3
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateFuture$1
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateFuture$2
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateFuture$3
-org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateFuture$4
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateRequest
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse
org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedCache
@@ -760,6 +764,7 @@ org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$2
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$3
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$4
+org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$LockTimeoutObject$1
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$MiniFuture$1
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockRequest
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockResponse
@@ -772,6 +777,7 @@ org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticS
org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticTxPrepareFuture$1
org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticTxPrepareFuture$2
org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticTxPrepareFuture$3
+org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticTxPrepareFuture$4
org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticTxPrepareFuture$MiniFuture$1
org.apache.ignite.internal.processors.cache.distributed.near.GridNearOptimisticTxPrepareFutureAdapter$1
org.apache.ignite.internal.processors.cache.distributed.near.GridNearPessimisticTxPrepareFuture$1
@@ -821,22 +827,23 @@ org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManag
org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager$7
org.apache.ignite.internal.processors.cache.query.GridCacheQueryAdapter$1
org.apache.ignite.internal.processors.cache.query.GridCacheQueryAdapter$ScanQueryFallbackClosableIterator
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryDetailMetricsAdapter
org.apache.ignite.internal.processors.cache.query.GridCacheQueryFutureAdapter$1
org.apache.ignite.internal.processors.cache.query.GridCacheQueryFutureAdapter$2
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$1$1
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$1$2
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$10
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$11
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$12
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$13
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$14
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$15$1
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$2
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$3
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$15
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$16
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$17$1
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$3$1
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$3$2
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$4
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$5
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$6
+org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$7
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$8
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$9
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$CacheSqlIndexMetadata
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$CacheSqlMetadata
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$CachedResult$QueueIterator
@@ -896,6 +903,8 @@ org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$12
org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$13
org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$14
org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$15
+org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$16
+org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$17
org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$2
org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$3
org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$4
@@ -929,9 +938,9 @@ org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$Po
org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$PostLockClosure1$4
org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$PostLockClosure2
org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter$PostMissClosure
-org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$2
org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$3
org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$4
+org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$5
org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$CommitListener
org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$CommittedVersion
org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager$NodeFailureTimeoutObject$1
@@ -1005,7 +1014,6 @@ org.apache.ignite.internal.processors.datastreamer.DataStreamerEntry
org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl$1
org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl$4
org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl$5
-org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl$6
org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl$Buffer$1
org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl$Buffer$2
org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl$DataStreamerPda
@@ -1084,6 +1092,7 @@ org.apache.ignite.internal.processors.datastructures.GridCacheSetProxy
org.apache.ignite.internal.processors.datastructures.GridSetQueryPredicate
org.apache.ignite.internal.processors.dr.GridDrType
org.apache.ignite.internal.processors.dr.IgniteDrDataStreamerCacheUpdater
+org.apache.ignite.internal.processors.hadoop.HadoopDefaultJobInfo
org.apache.ignite.internal.processors.hadoop.HadoopFileBlock
org.apache.ignite.internal.processors.hadoop.HadoopInputSplit
org.apache.ignite.internal.processors.hadoop.HadoopJobId
@@ -1119,7 +1128,6 @@ org.apache.ignite.internal.processors.igfs.IgfsFragmentizerManager$IdentityHashS
org.apache.ignite.internal.processors.igfs.IgfsFragmentizerRequest
org.apache.ignite.internal.processors.igfs.IgfsFragmentizerResponse
org.apache.ignite.internal.processors.igfs.IgfsHandshakeResponse
-org.apache.ignite.internal.processors.igfs.IgfsImpl$12$1
org.apache.ignite.internal.processors.igfs.IgfsImpl$IgfsGlobalSpaceTask
org.apache.ignite.internal.processors.igfs.IgfsImpl$IgfsGlobalSpaceTask$1
org.apache.ignite.internal.processors.igfs.IgfsInputStreamDescriptor
@@ -1155,6 +1163,7 @@ org.apache.ignite.internal.processors.igfs.client.IgfsClientSummaryCallable
org.apache.ignite.internal.processors.igfs.client.IgfsClientUpdateCallable
org.apache.ignite.internal.processors.igfs.client.meta.IgfsClientMetaIdsForPathCallable
org.apache.ignite.internal.processors.igfs.client.meta.IgfsClientMetaInfoForPathCallable
+org.apache.ignite.internal.processors.igfs.client.meta.IgfsClientMetaUnlockCallable
org.apache.ignite.internal.processors.igfs.data.IgfsDataPutProcessor
org.apache.ignite.internal.processors.igfs.meta.IgfsMetaDirectoryCreateProcessor
org.apache.ignite.internal.processors.igfs.meta.IgfsMetaDirectoryListingAddProcessor
@@ -1172,6 +1181,8 @@ org.apache.ignite.internal.processors.igfs.meta.IgfsMetaUpdateTimesProcessor
org.apache.ignite.internal.processors.job.GridJobProcessor$5
org.apache.ignite.internal.processors.job.GridJobWorker$3
org.apache.ignite.internal.processors.jobmetrics.GridJobMetricsProcessor$SnapshotReducer
+org.apache.ignite.internal.processors.odbc.OdbcProtocolVersion
+org.apache.ignite.internal.processors.odbc.escape.OdbcEscapeType
org.apache.ignite.internal.processors.platform.PlatformAbstractConfigurationClosure
org.apache.ignite.internal.processors.platform.PlatformAbstractPredicate
org.apache.ignite.internal.processors.platform.PlatformEventFilterListener
@@ -1180,7 +1191,7 @@ org.apache.ignite.internal.processors.platform.PlatformExtendedException
org.apache.ignite.internal.processors.platform.PlatformJavaObjectFactoryProxy
org.apache.ignite.internal.processors.platform.PlatformNativeException
org.apache.ignite.internal.processors.platform.PlatformNoCallbackException
-org.apache.ignite.internal.processors.platform.cache.PlatformCache$1
+org.apache.ignite.internal.processors.platform.cache.PlatformCache$5
org.apache.ignite.internal.processors.platform.cache.PlatformCacheEntryFilter
org.apache.ignite.internal.processors.platform.cache.PlatformCacheEntryFilterImpl
org.apache.ignite.internal.processors.platform.cache.PlatformCacheEntryProcessor
@@ -1211,6 +1222,8 @@ org.apache.ignite.internal.processors.platform.cpp.PlatformCppConfigurationClosu
org.apache.ignite.internal.processors.platform.datastreamer.PlatformStreamReceiver
org.apache.ignite.internal.processors.platform.datastreamer.PlatformStreamReceiverImpl
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$1
+org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$10
+org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$11
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$2
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$3
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$4
@@ -1218,6 +1231,7 @@ org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$5
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$6
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$7
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$8
+org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore$9
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetConfigurationClosure
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetService
org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetServiceImpl
@@ -1232,19 +1246,24 @@ org.apache.ignite.internal.processors.platform.transactions.PlatformTransactions
org.apache.ignite.internal.processors.platform.utils.PlatformFutureUtils$1
org.apache.ignite.internal.processors.platform.utils.PlatformFutureUtils$FutureListenable$1
org.apache.ignite.internal.processors.platform.utils.PlatformFutureUtils$InternalFutureListenable$1
+org.apache.ignite.internal.processors.platform.websession.PlatformDotNetSessionLockProcessor
+org.apache.ignite.internal.processors.platform.websession.PlatformDotNetSessionSetAndUnlockProcessor
org.apache.ignite.internal.processors.query.GridQueryFieldMetadata
org.apache.ignite.internal.processors.query.GridQueryIndexType
-org.apache.ignite.internal.processors.query.GridQueryProcessor$2
org.apache.ignite.internal.processors.query.GridQueryProcessor$3
org.apache.ignite.internal.processors.query.GridQueryProcessor$4
org.apache.ignite.internal.processors.query.GridQueryProcessor$5
org.apache.ignite.internal.processors.query.GridQueryProcessor$6
+org.apache.ignite.internal.processors.query.GridQueryProcessor$7
+org.apache.ignite.internal.processors.query.GridQueryProcessor$8
org.apache.ignite.internal.processors.query.GridQueryProcessor$IndexType
org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryCancelRequest
org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryFailResponse
org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryNextPageRequest
org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryNextPageResponse
org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryRequest
+org.apache.ignite.internal.processors.resource.GridResourceIoc$AnnotationSet
+org.apache.ignite.internal.processors.resource.GridResourceIoc$ResourceAnnotation
org.apache.ignite.internal.processors.rest.GridRestCommand
org.apache.ignite.internal.processors.rest.GridRestProcessor$2$1
org.apache.ignite.internal.processors.rest.GridRestProcessor$3
@@ -1332,7 +1351,7 @@ org.apache.ignite.internal.processors.service.ServiceDescriptorImpl
org.apache.ignite.internal.processors.task.GridTaskProcessor$1
org.apache.ignite.internal.processors.task.GridTaskThreadContextKey
org.apache.ignite.internal.processors.task.GridTaskWorker$3
-org.apache.ignite.internal.processors.task.GridTaskWorker$4
+org.apache.ignite.internal.processors.task.GridTaskWorker$5
org.apache.ignite.internal.processors.task.GridTaskWorker$State
org.apache.ignite.internal.transactions.IgniteTxHeuristicCheckedException
org.apache.ignite.internal.transactions.IgniteTxOptimisticCheckedException
@@ -1356,6 +1375,7 @@ org.apache.ignite.internal.util.GridBoundedConcurrentOrderedMap
org.apache.ignite.internal.util.GridBoundedConcurrentOrderedSet
org.apache.ignite.internal.util.GridBoundedLinkedHashMap
org.apache.ignite.internal.util.GridBoundedLinkedHashSet
+org.apache.ignite.internal.util.GridBoundedPriorityQueue
org.apache.ignite.internal.util.GridByteArrayList
org.apache.ignite.internal.util.GridCloseableIteratorAdapter
org.apache.ignite.internal.util.GridCloseableIteratorAdapterEx
@@ -1407,14 +1427,14 @@ org.apache.ignite.internal.util.IgniteUtils$11
org.apache.ignite.internal.util.IgniteUtils$12
org.apache.ignite.internal.util.IgniteUtils$13
org.apache.ignite.internal.util.IgniteUtils$14
-org.apache.ignite.internal.util.IgniteUtils$16
-org.apache.ignite.internal.util.IgniteUtils$2
-org.apache.ignite.internal.util.IgniteUtils$22
+org.apache.ignite.internal.util.IgniteUtils$15
+org.apache.ignite.internal.util.IgniteUtils$17
org.apache.ignite.internal.util.IgniteUtils$23
org.apache.ignite.internal.util.IgniteUtils$24
org.apache.ignite.internal.util.IgniteUtils$25
org.apache.ignite.internal.util.IgniteUtils$26
org.apache.ignite.internal.util.IgniteUtils$27
+org.apache.ignite.internal.util.IgniteUtils$28
org.apache.ignite.internal.util.IgniteUtils$3
org.apache.ignite.internal.util.IgniteUtils$4
org.apache.ignite.internal.util.IgniteUtils$5
@@ -1647,12 +1667,19 @@ org.apache.ignite.internal.visor.cache.VisorCachePartitionsTask
org.apache.ignite.internal.visor.cache.VisorCachePartitionsTask$VisorCachePartitionsJob
org.apache.ignite.internal.visor.cache.VisorCacheQueryConfiguration
org.apache.ignite.internal.visor.cache.VisorCacheQueryConfigurationV2
+org.apache.ignite.internal.visor.cache.VisorCacheQueryDetailMetrics
+org.apache.ignite.internal.visor.cache.VisorCacheQueryDetailMetricsCollectorTask
+org.apache.ignite.internal.visor.cache.VisorCacheQueryDetailMetricsCollectorTask$VisorCacheQueryDetailMetricsCollectorJob
org.apache.ignite.internal.visor.cache.VisorCacheQueryMetrics
org.apache.ignite.internal.visor.cache.VisorCacheRebalanceConfiguration
org.apache.ignite.internal.visor.cache.VisorCacheRebalanceTask
org.apache.ignite.internal.visor.cache.VisorCacheRebalanceTask$VisorCachesRebalanceJob
org.apache.ignite.internal.visor.cache.VisorCacheResetMetricsTask
org.apache.ignite.internal.visor.cache.VisorCacheResetMetricsTask$VisorCacheResetMetricsJob
+org.apache.ignite.internal.visor.cache.VisorCacheResetQueryDetailMetricsTask
+org.apache.ignite.internal.visor.cache.VisorCacheResetQueryDetailMetricsTask$VisorCacheResetQueryDetailMetricsJob
+org.apache.ignite.internal.visor.cache.VisorCacheResetQueryMetricsTask
+org.apache.ignite.internal.visor.cache.VisorCacheResetQueryMetricsTask$VisorCacheResetQueryMetricsJob
org.apache.ignite.internal.visor.cache.VisorCacheStartTask
org.apache.ignite.internal.visor.cache.VisorCacheStartTask$VisorCacheStartArg
org.apache.ignite.internal.visor.cache.VisorCacheStartTask$VisorCacheStartJob
@@ -1682,6 +1709,7 @@ org.apache.ignite.internal.visor.debug.VisorThreadLockInfo
org.apache.ignite.internal.visor.debug.VisorThreadMonitorInfo
org.apache.ignite.internal.visor.event.VisorGridDeploymentEvent
org.apache.ignite.internal.visor.event.VisorGridDiscoveryEvent
+org.apache.ignite.internal.visor.event.VisorGridDiscoveryEventV2
org.apache.ignite.internal.visor.event.VisorGridEvent
org.apache.ignite.internal.visor.event.VisorGridEventsLost
org.apache.ignite.internal.visor.event.VisorGridJobEvent
@@ -1769,6 +1797,7 @@ org.apache.ignite.internal.visor.util.VisorClusterGroupEmptyException
org.apache.ignite.internal.visor.util.VisorEventMapper
org.apache.ignite.internal.visor.util.VisorExceptionWrapper
org.apache.ignite.internal.visor.util.VisorTaskUtils$4
+org.apache.ignite.internal.visor.util.VisorTaskUtils$5
org.apache.ignite.internal.websession.WebSessionAttributeProcessor
org.apache.ignite.internal.websession.WebSessionEntity
org.apache.ignite.lang.IgniteBiClosure
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/test/java/org/apache/ignite/lang/utils/GridBoundedPriorityQueueSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/lang/utils/GridBoundedPriorityQueueSelfTest.java b/modules/core/src/test/java/org/apache/ignite/lang/utils/GridBoundedPriorityQueueSelfTest.java
new file mode 100644
index 0000000..bcaecc4
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/lang/utils/GridBoundedPriorityQueueSelfTest.java
@@ -0,0 +1,114 @@
+/*
+ * 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.lang.utils;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Random;
+
+import org.apache.ignite.internal.util.GridBoundedPriorityQueue;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.apache.ignite.testframework.junits.common.GridCommonTest;
+
+/**
+ * Test for {@link GridBoundedPriorityQueue}.
+ */
+@GridCommonTest(group = "Lang")
+public class GridBoundedPriorityQueueSelfTest extends GridCommonAbstractTest {
+ /** Queue items comparator. */
+ private static final Comparator<Integer> CMP = new Comparator<Integer>() {
+ @Override public int compare(Integer o1, Integer o2) {
+ return Integer.compare(o1, o2);
+ }
+ };
+
+ /** Queue items reverse order comparator. */
+ private static final Comparator<Integer> CMP_REVERSE = Collections.reverseOrder(CMP);
+
+ /**
+ * Test eviction in bounded priority queue.
+ */
+ public void testEviction() {
+ GridBoundedPriorityQueue<Integer> queue = new GridBoundedPriorityQueue<>(3, CMP);
+
+ assertTrue(queue.offer(2));
+ assertTrue(queue.offer(1));
+ assertTrue(queue.offer(3));
+ assertTrue(queue.offer(4));
+
+ assertEquals(3, queue.size());
+
+ assertFalse(queue.offer(0)); // Item with lower priority should not be put into queue.
+
+ assertEquals(3, queue.size());
+
+ assertEquals(Integer.valueOf(2), queue.poll());
+ assertEquals(Integer.valueOf(3), queue.poll());
+ assertEquals(Integer.valueOf(4), queue.poll());
+
+ assertNull(queue.poll());
+ assertTrue(queue.isEmpty());
+
+ // Test queue with reverse comparator.
+ GridBoundedPriorityQueue<Integer> queueReverse = new GridBoundedPriorityQueue<>(3, CMP_REVERSE);
+
+ assertTrue(queueReverse.offer(2));
+ assertTrue(queueReverse.offer(1));
+ assertTrue(queueReverse.offer(3));
+
+ assertFalse(queueReverse.offer(4)); // Item with lower priority should not be put into queue.
+
+ assertEquals(Integer.valueOf(3), queueReverse.poll());
+ assertEquals(Integer.valueOf(2), queueReverse.poll());
+ assertEquals(Integer.valueOf(1), queueReverse.poll());
+
+ assertNull(queueReverse.poll());
+ assertTrue(queueReverse.isEmpty());
+
+ // Test put random 100 items into GridBoundedPriorityQueue(10) and check result.
+ queue = new GridBoundedPriorityQueue<>(10, CMP);
+ queueReverse = new GridBoundedPriorityQueue<>(10, CMP_REVERSE);
+
+ Random rnd = new Random();
+
+ List<Integer> items = new ArrayList<>(100);
+
+ for (int i = 0; i < 100; i++) {
+ Integer item = rnd.nextInt(100);
+
+ items.add(item);
+ queue.offer(item);
+ queueReverse.offer(item);
+ }
+
+ Collections.sort(items);
+
+ for (int i = 0; i < 10; i++) {
+ assertEquals(items.get(90 + i), queue.poll());
+ assertEquals(items.get(9 - i), queueReverse.poll());
+ }
+
+ assertNull(queue.poll());
+ assertTrue(queue.isEmpty());
+
+ assertNull(queueReverse.poll());
+ assertTrue(queueReverse.isEmpty());
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java
index 71dc964..46053b3 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java
@@ -40,6 +40,7 @@ import org.apache.ignite.cache.CacheMetrics;
import org.apache.ignite.cache.CachePeekMode;
import org.apache.ignite.cache.query.Query;
import org.apache.ignite.cache.query.QueryCursor;
+import org.apache.ignite.cache.query.QueryDetailMetrics;
import org.apache.ignite.cache.query.QueryMetrics;
import org.apache.ignite.cluster.ClusterGroup;
import org.apache.ignite.internal.processors.cache.CacheEntryImpl;
@@ -188,6 +189,21 @@ public class IgniteCacheProcessProxy<K, V> implements IgniteCache<K, V> {
}
/** {@inheritDoc} */
+ @Override public void resetQueryMetrics() {
+ throw new UnsupportedOperationException("Method should be supported.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public Collection<? extends QueryDetailMetrics> queryDetailMetrics() {
+ throw new UnsupportedOperationException("Method should be supported.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public void resetQueryDetailMetrics() {
+ throw new UnsupportedOperationException("Method should be supported.");
+ }
+
+ /** {@inheritDoc} */
@Override public void localEvict(Collection<? extends K> keys) {
compute.call(new LocalEvictTask<>(cacheName, isAsync, keys));
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteLangSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteLangSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteLangSelfTestSuite.java
index 78c0ab4..cfec1ec 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteLangSelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteLangSelfTestSuite.java
@@ -32,6 +32,7 @@ import org.apache.ignite.lang.GridXSelfTest;
import org.apache.ignite.lang.IgniteUuidSelfTest;
import org.apache.ignite.lang.utils.GridBoundedConcurrentLinkedHashMapSelfTest;
import org.apache.ignite.lang.utils.GridBoundedConcurrentOrderedMapSelfTest;
+import org.apache.ignite.lang.utils.GridBoundedPriorityQueueSelfTest;
import org.apache.ignite.lang.utils.GridCircularBufferSelfTest;
import org.apache.ignite.lang.utils.GridConcurrentLinkedHashMapSelfTest;
import org.apache.ignite.lang.utils.GridConcurrentWeakHashSetSelfTest;
@@ -55,6 +56,7 @@ public class IgniteLangSelfTestSuite extends TestSuite {
TestSuite suite = new TestSuite("Ignite Lang Test Suite");
suite.addTest(new TestSuite(GridTupleSelfTest.class));
+ suite.addTest(new TestSuite(GridBoundedPriorityQueueSelfTest.class));
suite.addTest(new TestSuite(GridByteArrayListSelfTest.class));
suite.addTest(new TestSuite(GridLeanMapSelfTest.class));
suite.addTest(new TestSuite(GridLeanIdentitySetSelfTest.class));
@@ -85,4 +87,4 @@ public class IgniteLangSelfTestSuite extends TestSuite {
return suite;
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheAbstractQueryDetailMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheAbstractQueryDetailMetricsSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheAbstractQueryDetailMetricsSelfTest.java
new file mode 100644
index 0000000..1b870e4
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheAbstractQueryDetailMetricsSelfTest.java
@@ -0,0 +1,572 @@
+/*
+ * 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.Collection;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.query.Query;
+import org.apache.ignite.cache.query.QueryDetailMetrics;
+import org.apache.ignite.cache.query.ScanQuery;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.cache.query.SqlQuery;
+import org.apache.ignite.cache.query.TextQuery;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteInterruptedCheckedException;
+import org.apache.ignite.internal.util.lang.GridAbsPredicate;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/**
+ * Tests for cache query details metrics.
+ */
+public abstract class CacheAbstractQueryDetailMetricsSelfTest extends GridCommonAbstractTest {
+ /** */
+ private static final int QRY_DETAIL_METRICS_SIZE = 3;
+
+ /** Grid count. */
+ protected int gridCnt;
+
+ /** Cache mode. */
+ protected CacheMode cacheMode;
+
+ /** */
+ private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ startGridsMultiThreaded(gridCnt);
+
+ IgniteCache<Integer, String> cacheA = grid(0).cache("A");
+ IgniteCache<Integer, String> cacheB = grid(0).cache("B");
+
+ for (int i = 0; i < 100; i++) {
+ cacheA.put(i, String.valueOf(i));
+ cacheB.put(i, String.valueOf(i));
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+ }
+
+ /**
+ * @param cacheName Cache name.
+ * @return Cache configuration.
+ */
+ private CacheConfiguration<Integer, String> configureCache(String cacheName) {
+ CacheConfiguration<Integer, String> ccfg = defaultCacheConfiguration();
+
+ ccfg.setName(cacheName);
+ ccfg.setCacheMode(cacheMode);
+ ccfg.setWriteSynchronizationMode(FULL_SYNC);
+ ccfg.setIndexedTypes(Integer.class, String.class);
+ ccfg.setStatisticsEnabled(true);
+ ccfg.setQueryDetailMetricsSize(QRY_DETAIL_METRICS_SIZE);
+
+ return ccfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+ disco.setIpFinder(ipFinder);
+
+ cfg.setDiscoverySpi(disco);
+
+ cfg.setCacheConfiguration(configureCache("A"), configureCache("B"));
+
+ return cfg;
+ }
+
+ /**
+ * Test metrics for SQL fields queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testSqlFieldsQueryMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ SqlFieldsQuery qry = new SqlFieldsQuery("select * from String");
+
+ checkQueryMetrics(cache, qry);
+ }
+
+ /**
+ * Test metrics for SQL fields queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testSqlFieldsQueryNotFullyFetchedMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ SqlFieldsQuery qry = new SqlFieldsQuery("select * from String");
+ qry.setPageSize(10);
+
+ checkQueryNotFullyFetchedMetrics(cache, qry, false);
+ }
+
+ /**
+ * Test metrics for failed SQL queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testSqlFieldsQueryFailedMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ SqlFieldsQuery qry = new SqlFieldsQuery("select * from UNKNOWN");
+
+ checkQueryFailedMetrics(cache, qry);
+ }
+
+ /**
+ * Test metrics eviction.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testQueryMetricsEviction() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ // Execute several DIFFERENT queries with guaranteed DIFFERENT time of execution.
+ cache.query(new SqlFieldsQuery("select * from String")).getAll();
+ Thread.sleep(100);
+
+ cache.query(new SqlFieldsQuery("select count(*) from String")).getAll();
+ Thread.sleep(100);
+
+ cache.query(new SqlFieldsQuery("select * from String limit 1")).getAll();
+ Thread.sleep(100);
+
+ cache.query(new SqlFieldsQuery("select * from String limit 2")).getAll();
+ Thread.sleep(100);
+
+ cache.query(new ScanQuery()).getAll();
+ Thread.sleep(100);
+
+ cache.query(new SqlQuery("String", "from String")).getAll();
+
+ waitingFor(cache, "size", QRY_DETAIL_METRICS_SIZE);
+
+ for (int i = 0; i < QRY_DETAIL_METRICS_SIZE; i++)
+ checkMetrics(cache, QRY_DETAIL_METRICS_SIZE, i, 1, 1, 0, false);
+
+ // Check that collected metrics contains correct items: metrics for last 3 queries.
+ Collection<? extends QueryDetailMetrics> metrics = cache.queryDetailMetrics();
+
+ String lastMetrics = "";
+
+ for (QueryDetailMetrics m : metrics)
+ lastMetrics += m.queryType() + " " + m.query() + ";";
+
+ assertTrue(lastMetrics.contains("SQL_FIELDS select * from String limit 2;"));
+ assertTrue(lastMetrics.contains("SCAN A;"));
+ assertTrue(lastMetrics.contains("SQL from String;"));
+
+ cache = grid(0).context().cache().jcache("B");
+
+ cache.query(new SqlFieldsQuery("select * from String")).getAll();
+ cache.query(new SqlFieldsQuery("select count(*) from String")).getAll();
+ cache.query(new SqlFieldsQuery("select * from String limit 1")).getAll();
+ cache.query(new SqlFieldsQuery("select * from String limit 2")).getAll();
+ cache.query(new ScanQuery()).getAll();
+ cache.query(new SqlQuery("String", "from String")).getAll();
+
+ waitingFor(cache, "size", QRY_DETAIL_METRICS_SIZE);
+
+ for (int i = 0; i < QRY_DETAIL_METRICS_SIZE; i++)
+ checkMetrics(cache, QRY_DETAIL_METRICS_SIZE, i, 1, 1, 0, false);
+
+ if (gridCnt > 1) {
+ cache = grid(1).context().cache().jcache("A");
+
+ cache.query(new SqlFieldsQuery("select * from String")).getAll();
+ cache.query(new SqlFieldsQuery("select count(*) from String")).getAll();
+ cache.query(new SqlFieldsQuery("select * from String limit 1")).getAll();
+ cache.query(new SqlFieldsQuery("select * from String limit 2")).getAll();
+ cache.query(new ScanQuery()).getAll();
+ cache.query(new SqlQuery("String", "from String")).getAll();
+
+ waitingFor(cache, "size", QRY_DETAIL_METRICS_SIZE);
+
+ for (int i = 0; i < QRY_DETAIL_METRICS_SIZE; i++)
+ checkMetrics(cache, QRY_DETAIL_METRICS_SIZE, i, 1, 1, 0, false);
+
+ cache = grid(1).context().cache().jcache("B");
+
+ cache.query(new SqlFieldsQuery("select * from String")).getAll();
+ cache.query(new SqlFieldsQuery("select count(*) from String")).getAll();
+ cache.query(new SqlFieldsQuery("select * from String limit 1")).getAll();
+ cache.query(new SqlFieldsQuery("select * from String limit 2")).getAll();
+ cache.query(new ScanQuery()).getAll();
+ cache.query(new SqlQuery("String", "from String")).getAll();
+
+ waitingFor(cache, "size", QRY_DETAIL_METRICS_SIZE);
+
+ for (int i = 0; i < QRY_DETAIL_METRICS_SIZE; i++)
+ checkMetrics(cache, QRY_DETAIL_METRICS_SIZE, i, 1, 1, 0, false);
+ }
+ }
+
+ /** */
+ private static class Worker extends Thread {
+ /** */
+ private final IgniteCache cache;
+
+ /** */
+ private final Query qry;
+
+ /** */
+ Worker(IgniteCache cache, Query qry) {
+ this.cache = cache;
+ this.qry = qry;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void run() {
+ cache.query(qry).getAll();
+ }
+ }
+
+ /**
+ * Test metrics if queries executed from several threads.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testQueryMetricsMultithreaded() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ Collection<Worker> workers = new ArrayList<>();
+
+ int repeat = 10;
+
+ for (int k = 0; k < repeat; k++) {
+ // Execute as match queries as history size to avoid eviction.
+ for (int i = 1; i <= QRY_DETAIL_METRICS_SIZE; i++)
+ workers.add(new Worker(cache, new SqlFieldsQuery("select * from String limit " + i)));
+ }
+
+ for (Worker worker : workers)
+ worker.start();
+
+ for (Worker worker : workers)
+ worker.join();
+
+ for (int i = 0; i < QRY_DETAIL_METRICS_SIZE; i++)
+ checkMetrics(cache, QRY_DETAIL_METRICS_SIZE, i, repeat, repeat, 0, false);
+ }
+
+ /**
+ * Test metrics for Scan queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testScanQueryMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ ScanQuery<Integer, String> qry = new ScanQuery<>();
+
+ checkQueryMetrics(cache, qry);
+ }
+
+ /**
+ * Test metrics for Scan queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testScanQueryNotFullyFetchedMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ ScanQuery<Integer, String> qry = new ScanQuery<>();
+ qry.setPageSize(10);
+
+ checkQueryNotFullyFetchedMetrics(cache, qry, true);
+ }
+
+ /**
+ * Test metrics for failed Scan queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testScanQueryFailedMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ ScanQuery<Integer, String> qry = new ScanQuery<>(Integer.MAX_VALUE);
+
+ checkQueryFailedMetrics(cache, qry);
+ }
+
+ /**
+ * Test metrics for Scan queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testSqlQueryMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ SqlQuery<Integer, String> qry = new SqlQuery<>("String", "from String");
+
+ checkQueryMetrics(cache, qry);
+ }
+
+ /**
+ * Test metrics for Scan queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testSqlQueryNotFullyFetchedMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ SqlQuery<Integer, String> qry = new SqlQuery<>("String", "from String");
+ qry.setPageSize(10);
+
+ checkQueryNotFullyFetchedMetrics(cache, qry, true);
+ }
+
+ /**
+ * Test metrics for failed Scan queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testSqlQueryFailedMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ SqlQuery<Integer, String> qry = new SqlQuery<>("Long", "from Long");
+
+ checkQueryFailedMetrics(cache, qry);
+ }
+
+ /**
+ * Test metrics for Sql queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testTextQueryMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ TextQuery qry = new TextQuery<>("String", "1");
+
+ checkQueryMetrics(cache, qry);
+ }
+
+ /**
+ * Test metrics for Sql queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testTextQueryNotFullyFetchedMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ TextQuery qry = new TextQuery<>("String", "1");
+ qry.setPageSize(10);
+
+ checkQueryNotFullyFetchedMetrics(cache, qry, true);
+ }
+
+ /**
+ * Test metrics for failed Scan queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testTextQueryFailedMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ TextQuery qry = new TextQuery<>("Unknown", "zzz");
+
+ checkQueryFailedMetrics(cache, qry);
+ }
+
+ /**
+ * Test metrics for SQL cross cache queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testSqlFieldsCrossCacheQueryMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ SqlFieldsQuery qry = new SqlFieldsQuery("select * from \"B\".String");
+
+ checkQueryMetrics(cache, qry);
+ }
+
+ /**
+ * Test metrics for SQL cross cache queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testSqlFieldsCrossCacheQueryNotFullyFetchedMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ SqlFieldsQuery qry = new SqlFieldsQuery("select * from \"B\".String");
+ qry.setPageSize(10);
+
+ checkQueryNotFullyFetchedMetrics(cache, qry, false);
+ }
+
+ /**
+ * Test metrics for failed SQL cross cache queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testSqlFieldsCrossCacheQueryFailedMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ SqlFieldsQuery qry = new SqlFieldsQuery("select * from \"G\".String");
+
+ checkQueryFailedMetrics(cache, qry);
+ }
+
+ /**
+ * Check metrics.
+ *
+ * @param cache Cache to check metrics.
+ * @param sz Expected size of metrics.
+ * @param idx Index of metrics to check.
+ * @param execs Expected number of executions.
+ * @param completions Expected number of completions.
+ * @param failures Expected number of failures.
+ * @param first {@code true} if metrics checked for first query only.
+ */
+ private void checkMetrics(IgniteCache<Integer, String> cache, int sz, int idx, int execs,
+ int completions, int failures, boolean first) {
+ Collection<? extends QueryDetailMetrics> metrics = cache.queryDetailMetrics();
+
+ assertNotNull(metrics);
+ assertEquals(sz, metrics.size());
+
+ QueryDetailMetrics m = new ArrayList<>(metrics).get(idx);
+
+ info("Metrics: " + m);
+
+ assertEquals("Executions", execs, m.executions());
+ assertEquals("Completions", completions, m.completions());
+ assertEquals("Failures", failures, m.failures());
+ assertTrue(m.averageTime() >= 0);
+ assertTrue(m.maximumTime() >= 0);
+ assertTrue(m.minimumTime() >= 0);
+
+ if (first)
+ assertTrue("On first execution minTime == maxTime", m.minimumTime() == m.maximumTime());
+ }
+
+ /**
+ * @param cache Cache.
+ * @param qry Query.
+ */
+ private void checkQueryMetrics(IgniteCache<Integer, String> cache, Query qry) {
+ // Execute query.
+ cache.query(qry).getAll();
+
+ checkMetrics(cache, 1, 0, 1, 1, 0, true);
+
+ // Execute again with the same parameters.
+ cache.query(qry).getAll();
+
+ checkMetrics(cache, 1, 0, 2, 2, 0, false);
+ }
+
+ /**
+ * @param cache Cache.
+ * @param qry Query.
+ * @param waitingForCompletion Waiting for query completion.
+ */
+ private void checkQueryNotFullyFetchedMetrics(IgniteCache<Integer, String> cache, Query qry,
+ boolean waitingForCompletion) throws IgniteInterruptedCheckedException {
+ // Execute query.
+ cache.query(qry).iterator().next();
+
+ if (waitingForCompletion)
+ waitingFor(cache, "completions", 1);
+
+ checkMetrics(cache, 1, 0, 1, 1, 0, true);
+
+ // Execute again with the same parameters.
+ cache.query(qry).iterator().next();
+
+ if (waitingForCompletion)
+ waitingFor(cache, "completions", 2);
+
+ checkMetrics(cache, 1, 0, 2, 2, 0, false);
+ }
+
+ /**
+ * @param cache Cache.
+ * @param qry Query.
+ */
+ private void checkQueryFailedMetrics(IgniteCache<Integer, String> cache, Query qry) {
+ try {
+ // Execute invalid query.
+ cache.query(qry).getAll();
+ }
+ catch (Exception ignored) {
+ // No-op.
+ }
+
+ checkMetrics(cache, 1, 0, 1, 0, 1, true);
+
+ try {
+ // Execute invalid query again with the same parameters.
+ cache.query(qry).getAll();
+ }
+ catch (Exception ignored) {
+ // No-op.
+ }
+
+ checkMetrics(cache, 1, 0, 2, 0, 2, true);
+ }
+
+ /**
+ * @param cache Cache.
+ * @param cond Condition to check.
+ * @param exp Expected value.
+ */
+ private static void waitingFor(final IgniteCache<Integer, String> cache,
+ final String cond, final int exp) throws IgniteInterruptedCheckedException {
+ GridTestUtils.waitForCondition(new GridAbsPredicate() {
+ @Override public boolean apply() {
+ Collection<? extends QueryDetailMetrics> metrics = cache.queryDetailMetrics();
+
+ switch (cond) {
+ case "size":
+ return metrics.size() == exp;
+
+ case "completions":
+ int completions = 0;
+
+ for (QueryDetailMetrics m : metrics)
+ completions += m.completions();
+
+ return completions == exp;
+
+ default:
+ return true;
+ }
+ }
+ }, 5000);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheAbstractQueryMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheAbstractQueryMetricsSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheAbstractQueryMetricsSelfTest.java
index 10f7612..e5845d3 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheAbstractQueryMetricsSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheAbstractQueryMetricsSelfTest.java
@@ -17,11 +17,15 @@
package org.apache.ignite.internal.processors.cache;
+import java.util.ArrayList;
+import java.util.Collection;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.query.Query;
import org.apache.ignite.cache.query.ScanQuery;
import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.cache.query.SqlQuery;
+import org.apache.ignite.cache.query.TextQuery;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
@@ -52,15 +56,13 @@ public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstra
@Override protected void beforeTest() throws Exception {
startGridsMultiThreaded(gridCnt);
- IgniteCache<String, Integer> cacheA = grid(0).cache("A");
+ IgniteCache<Integer, String> cacheA = grid(0).cache("A");
+ IgniteCache<Integer, String> cacheB = grid(0).cache("B");
- for (int i = 0; i < 100; i++)
- cacheA.put(String.valueOf(i), i);
-
- IgniteCache<String, Integer> cacheB = grid(0).cache("B");
-
- for (int i = 0; i < 100; i++)
- cacheB.put(String.valueOf(i), i);
+ for (int i = 0; i < 100; i++) {
+ cacheA.put(i, String.valueOf(i));
+ cacheB.put(i, String.valueOf(i));
+ }
}
/** {@inheritDoc} */
@@ -78,20 +80,20 @@ public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstra
cfg.setDiscoverySpi(disco);
- CacheConfiguration<String, Integer> cacheCfg1 = defaultCacheConfiguration();
+ CacheConfiguration<Integer, String> cacheCfg1 = defaultCacheConfiguration();
cacheCfg1.setName("A");
cacheCfg1.setCacheMode(cacheMode);
cacheCfg1.setWriteSynchronizationMode(FULL_SYNC);
- cacheCfg1.setIndexedTypes(String.class, Integer.class);
+ cacheCfg1.setIndexedTypes(Integer.class, String.class);
cacheCfg1.setStatisticsEnabled(true);
- CacheConfiguration<String, Integer> cacheCfg2 = defaultCacheConfiguration();
+ CacheConfiguration<Integer, String> cacheCfg2 = defaultCacheConfiguration();
cacheCfg2.setName("B");
cacheCfg2.setCacheMode(cacheMode);
cacheCfg2.setWriteSynchronizationMode(FULL_SYNC);
- cacheCfg2.setIndexedTypes(String.class, Integer.class);
+ cacheCfg2.setIndexedTypes(Integer.class, String.class);
cacheCfg2.setStatisticsEnabled(true);
cfg.setCacheConfiguration(cacheCfg1, cacheCfg2);
@@ -105,11 +107,11 @@ public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstra
* @throws Exception In case of error.
*/
public void testSqlFieldsQueryMetrics() throws Exception {
- IgniteCache<String, Integer> cache = grid(0).context().cache().jcache("A");
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
- SqlFieldsQuery qry = new SqlFieldsQuery("select * from Integer");
+ SqlFieldsQuery qry = new SqlFieldsQuery("select * from String");
- testQueryMetrics(cache, qry);
+ checkQueryMetrics(cache, qry);
}
/**
@@ -118,12 +120,12 @@ public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstra
* @throws Exception In case of error.
*/
public void testSqlFieldsQueryNotFullyFetchedMetrics() throws Exception {
- IgniteCache<String, Integer> cache = grid(0).context().cache().jcache("A");
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
- SqlFieldsQuery qry = new SqlFieldsQuery("select * from Integer");
+ SqlFieldsQuery qry = new SqlFieldsQuery("select * from String");
qry.setPageSize(10);
- testQueryNotFullyFetchedMetrics(cache, qry, false);
+ checkQueryNotFullyFetchedMetrics(cache, qry, false);
}
/**
@@ -132,11 +134,11 @@ public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstra
* @throws Exception In case of error.
*/
public void testSqlFieldsQueryFailedMetrics() throws Exception {
- IgniteCache<String, Integer> cache = grid(0).context().cache().jcache("A");
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
SqlFieldsQuery qry = new SqlFieldsQuery("select * from UNKNOWN");
- testQueryFailedMetrics(cache, qry);
+ checkQueryFailedMetrics(cache, qry);
}
/**
@@ -145,11 +147,11 @@ public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstra
* @throws Exception In case of error.
*/
public void testScanQueryMetrics() throws Exception {
- IgniteCache<String, Integer> cache = grid(0).context().cache().jcache("A");
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
- ScanQuery<String, Integer> qry = new ScanQuery<>();
+ ScanQuery<Integer, String> qry = new ScanQuery<>();
- testQueryMetrics(cache, qry);
+ checkQueryMetrics(cache, qry);
}
/**
@@ -158,12 +160,12 @@ public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstra
* @throws Exception In case of error.
*/
public void testScanQueryNotFullyFetchedMetrics() throws Exception {
- IgniteCache<String, Integer> cache = grid(0).context().cache().jcache("A");
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
- ScanQuery<String, Integer> qry = new ScanQuery<>();
+ ScanQuery<Integer, String> qry = new ScanQuery<>();
qry.setPageSize(10);
- testQueryNotFullyFetchedMetrics(cache, qry, true);
+ checkQueryNotFullyFetchedMetrics(cache, qry, true);
}
/**
@@ -172,11 +174,91 @@ public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstra
* @throws Exception In case of error.
*/
public void testScanQueryFailedMetrics() throws Exception {
- IgniteCache<String, Integer> cache = grid(0).context().cache().jcache("A");
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ ScanQuery<Integer, String> qry = new ScanQuery<>(Integer.MAX_VALUE);
+
+ checkQueryFailedMetrics(cache, qry);
+ }
+
+ /**
+ * Test metrics for Sql queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testSqlQueryMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ SqlQuery qry = new SqlQuery<>("String", "from String");
+
+ checkQueryMetrics(cache, qry);
+ }
+
+ /**
+ * Test metrics for Sql queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testSqlQueryNotFullyFetchedMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ SqlQuery qry = new SqlQuery<>("String", "from String");
+ qry.setPageSize(10);
+
+ checkQueryNotFullyFetchedMetrics(cache, qry, true);
+ }
+
+ /**
+ * Test metrics for failed Scan queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testSqlQueryFailedMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
- ScanQuery<String, Integer> qry = new ScanQuery<>(Integer.MAX_VALUE);
+ SqlQuery qry = new SqlQuery<>("Long", "from Long");
- testQueryFailedMetrics(cache, qry);
+ checkQueryFailedMetrics(cache, qry);
+ }
+
+ /**
+ * Test metrics for Sql queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testTextQueryMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ TextQuery qry = new TextQuery<>("String", "1");
+
+ checkQueryMetrics(cache, qry);
+ }
+
+ /**
+ * Test metrics for Sql queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testTextQueryNotFullyFetchedMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ TextQuery qry = new TextQuery<>("String", "1");
+ qry.setPageSize(10);
+
+ checkQueryNotFullyFetchedMetrics(cache, qry, true);
+ }
+
+ /**
+ * Test metrics for failed Scan queries.
+ *
+ * @throws Exception In case of error.
+ */
+ public void testTextQueryFailedMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ TextQuery qry = new TextQuery<>("Unknown", "zzz");
+
+ checkQueryFailedMetrics(cache, qry);
}
/**
@@ -184,12 +266,12 @@ public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstra
*
* @throws Exception In case of error.
*/
- public void testSqlCrossCacheQueryMetrics() throws Exception {
- IgniteCache<String, Integer> cache = grid(0).context().cache().jcache("A");
+ public void testSqlFieldsCrossCacheQueryMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
- SqlFieldsQuery qry = new SqlFieldsQuery("select * from \"B\".Integer");
+ SqlFieldsQuery qry = new SqlFieldsQuery("select * from \"B\".String");
- testQueryMetrics(cache, qry);
+ checkQueryMetrics(cache, qry);
}
/**
@@ -197,13 +279,13 @@ public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstra
*
* @throws Exception In case of error.
*/
- public void testSqlCrossCacheQueryNotFullyFetchedMetrics() throws Exception {
- IgniteCache<String, Integer> cache = grid(0).context().cache().jcache("A");
+ public void testSqlFieldsCrossCacheQueryNotFullyFetchedMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
- SqlFieldsQuery qry = new SqlFieldsQuery("select * from \"B\".Integer");
+ SqlFieldsQuery qry = new SqlFieldsQuery("select * from \"B\".String");
qry.setPageSize(10);
- testQueryNotFullyFetchedMetrics(cache, qry, false);
+ checkQueryNotFullyFetchedMetrics(cache, qry, false);
}
/**
@@ -211,46 +293,102 @@ public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstra
*
* @throws Exception In case of error.
*/
- public void testSqlCrossCacheQueryFailedMetrics() throws Exception {
- IgniteCache<String, Integer> cache = grid(0).context().cache().jcache("A");
+ public void testSqlFieldsCrossCacheQueryFailedMetrics() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+
+ SqlFieldsQuery qry = new SqlFieldsQuery("select * from \"G\".String");
+
+ checkQueryFailedMetrics(cache, qry);
+ }
+
+ /** */
+ private static class Worker extends Thread {
+ /** */
+ private final IgniteCache cache;
+
+ /** */
+ private final Query qry;
- SqlFieldsQuery qry = new SqlFieldsQuery("select * from \"G\".Integer");
+ /** */
+ Worker(IgniteCache cache, Query qry) {
+ this.cache = cache;
+ this.qry = qry;
+ }
- testQueryFailedMetrics(cache, qry);
+ /** {@inheritDoc} */
+ @Override public void run() {
+ cache.query(qry).getAll();
+ }
}
/**
- * @param cache Cache.
- * @param qry Query.
+ * Test metrics if queries executed from several threads.
+ *
+ * @throws Exception In case of error.
*/
- private void testQueryMetrics(IgniteCache<String, Integer> cache, Query qry) {
- cache.query(qry).getAll();
+ public void testQueryMetricsMultithreaded() throws Exception {
+ IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
+ Collection<CacheAbstractQueryMetricsSelfTest.Worker> workers = new ArrayList<>();
+
+ int repeat = 100;
+
+ for (int i = 0; i < repeat; i++) {
+ workers.add(new CacheAbstractQueryMetricsSelfTest.Worker(cache, new SqlFieldsQuery("select * from String limit " + i)));
+ workers.add(new CacheAbstractQueryMetricsSelfTest.Worker(cache, new SqlQuery("String", "from String")));
+ workers.add(new CacheAbstractQueryMetricsSelfTest.Worker(cache, new ScanQuery()));
+ workers.add(new CacheAbstractQueryMetricsSelfTest.Worker(cache, new TextQuery("String", "1")));
+ }
+
+ for (CacheAbstractQueryMetricsSelfTest.Worker worker : workers)
+ worker.start();
+
+ for (CacheAbstractQueryMetricsSelfTest.Worker worker : workers)
+ worker.join();
+
+ checkMetrics(cache, repeat * 4, repeat * 4, 0, false);
+ }
+
+ /**
+ * Check metrics.
+ *
+ * @param cache Cache to check metrics.
+ * @param execs Expected number of executions.
+ * @param completions Expected number of completions.
+ * @param failures Expected number of failures.
+ * @param first {@code true} if metrics checked for first query only.
+ */
+ private void checkMetrics(IgniteCache<Integer, String> cache, int execs, int completions, int failures, boolean first) {
GridCacheQueryMetricsAdapter m = (GridCacheQueryMetricsAdapter)cache.queryMetrics();
+ assertNotNull(m);
+
info("Metrics: " + m);
- assertEquals(1, m.executions());
- assertEquals(1, m.completedExecutions());
- assertEquals(0, m.fails());
+ assertEquals("Executions", execs, m.executions());
+ assertEquals("Completions", completions, m.completedExecutions());
+ assertEquals("Failures", failures, m.fails());
assertTrue(m.averageTime() >= 0);
assertTrue(m.maximumTime() >= 0);
assertTrue(m.minimumTime() >= 0);
- assertTrue("On first execution minTime == maxTime", m.minimumTime() == m.maximumTime());
- // Execute again with the same parameters.
+ if (first)
+ assertTrue("On first execution minTime == maxTime", m.minimumTime() == m.maximumTime());
+ }
+
+ /**
+ * @param cache Cache.
+ * @param qry Query.
+ */
+ private void checkQueryMetrics(IgniteCache<Integer, String> cache, Query qry) {
cache.query(qry).getAll();
- m = (GridCacheQueryMetricsAdapter)cache.queryMetrics();
+ checkMetrics(cache, 1, 1, 0, true);
- info("Metrics: " + m);
+ // Execute again with the same parameters.
+ cache.query(qry).getAll();
- assertEquals(2, m.executions());
- assertEquals(2, m.completedExecutions());
- assertEquals(0, m.fails());
- assertTrue(m.averageTime() >= 0);
- assertTrue(m.maximumTime() >= 0);
- assertTrue(m.minimumTime() >= 0);
+ checkMetrics(cache, 2, 2, 0, false);
}
/**
@@ -258,24 +396,14 @@ public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstra
* @param qry Query.
* @param waitingForCompletion Waiting for query completion.
*/
- private void testQueryNotFullyFetchedMetrics(IgniteCache<String, Integer> cache, Query qry,
+ private void checkQueryNotFullyFetchedMetrics(IgniteCache<Integer, String> cache, Query qry,
boolean waitingForCompletion) throws IgniteInterruptedCheckedException {
cache.query(qry).iterator().next();
if (waitingForCompletion)
waitingForCompletion(cache, 1);
- GridCacheQueryMetricsAdapter m = (GridCacheQueryMetricsAdapter)cache.queryMetrics();
-
- info("Metrics: " + m);
-
- assertEquals(1, m.executions());
- assertEquals(1, m.completedExecutions());
- assertEquals(0, m.fails());
- assertTrue(m.averageTime() >= 0);
- assertTrue(m.maximumTime() >= 0);
- assertTrue(m.minimumTime() >= 0);
- assertTrue("On first execution minTime == maxTime", m.minimumTime() == m.maximumTime());
+ checkMetrics(cache, 1, 1, 0, true);
// Execute again with the same parameters.
cache.query(qry).iterator().next();
@@ -283,23 +411,14 @@ public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstra
if (waitingForCompletion)
waitingForCompletion(cache, 2);
- m = (GridCacheQueryMetricsAdapter)cache.queryMetrics();
-
- info("Metrics: " + m);
-
- assertEquals(2, m.executions());
- assertEquals(2, m.completedExecutions());
- assertEquals(0, m.fails());
- assertTrue(m.averageTime() >= 0);
- assertTrue(m.maximumTime() >= 0);
- assertTrue(m.minimumTime() >= 0);
+ checkMetrics(cache, 2, 2, 0, false);
}
/**
* @param cache Cache.
* @param qry Query.
*/
- private void testQueryFailedMetrics(IgniteCache<String, Integer> cache, Query qry) {
+ private void checkQueryFailedMetrics(IgniteCache<Integer, String> cache, Query qry) {
try {
cache.query(qry).getAll();
}
@@ -307,16 +426,7 @@ public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstra
// No-op.
}
- GridCacheQueryMetricsAdapter m = (GridCacheQueryMetricsAdapter)cache.queryMetrics();
-
- info("Metrics: " + m);
-
- assertEquals(1, m.executions());
- assertEquals(0, m.completedExecutions());
- assertEquals(1, m.fails());
- assertTrue(m.averageTime() == 0);
- assertTrue(m.maximumTime() == 0);
- assertTrue(m.minimumTime() == 0);
+ checkMetrics(cache, 1, 0, 1, true);
// Execute again with the same parameters.
try {
@@ -326,23 +436,14 @@ public abstract class CacheAbstractQueryMetricsSelfTest extends GridCommonAbstra
// No-op.
}
- m = (GridCacheQueryMetricsAdapter)cache.queryMetrics();
-
- info("Metrics: " + m);
-
- assertEquals(2, m.executions());
- assertEquals(0, m.completedExecutions());
- assertEquals(2, m.fails());
- assertTrue(m.averageTime() == 0);
- assertTrue(m.maximumTime() == 0);
- assertTrue(m.minimumTime() == 0);
+ checkMetrics(cache, 2, 0, 2, true);
}
/**
* @param cache Cache.
* @param exp Expected.
*/
- private static void waitingForCompletion(final IgniteCache<String, Integer> cache,
+ private static void waitingForCompletion(final IgniteCache<Integer, String> cache,
final int exp) throws IgniteInterruptedCheckedException {
GridTestUtils.waitForCondition(new GridAbsPredicate() {
@Override public boolean apply() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheLocalQueryDetailMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheLocalQueryDetailMetricsSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheLocalQueryDetailMetricsSelfTest.java
new file mode 100644
index 0000000..7797120
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheLocalQueryDetailMetricsSelfTest.java
@@ -0,0 +1,33 @@
+/*
+ * 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 static org.apache.ignite.cache.CacheMode.LOCAL;
+
+/**
+ * Tests for local cache query metrics.
+ */
+public class CacheLocalQueryDetailMetricsSelfTest extends CacheAbstractQueryDetailMetricsSelfTest {
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ gridCnt = 1;
+ cacheMode = LOCAL;
+
+ super.beforeTest();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CachePartitionedQueryDetailMetricsDistributedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CachePartitionedQueryDetailMetricsDistributedSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CachePartitionedQueryDetailMetricsDistributedSelfTest.java
new file mode 100644
index 0000000..c924487
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CachePartitionedQueryDetailMetricsDistributedSelfTest.java
@@ -0,0 +1,33 @@
+/*
+ * 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 static org.apache.ignite.cache.CacheMode.PARTITIONED;
+
+/**
+ * Tests for partitioned distributed cache query metrics.
+ */
+public class CachePartitionedQueryDetailMetricsDistributedSelfTest extends CacheAbstractQueryDetailMetricsSelfTest {
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ gridCnt = 2;
+ cacheMode = PARTITIONED;
+
+ super.beforeTest();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CachePartitionedQueryDetailMetricsLocalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CachePartitionedQueryDetailMetricsLocalSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CachePartitionedQueryDetailMetricsLocalSelfTest.java
new file mode 100644
index 0000000..4ffba3e
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CachePartitionedQueryDetailMetricsLocalSelfTest.java
@@ -0,0 +1,33 @@
+/*
+ * 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 static org.apache.ignite.cache.CacheMode.PARTITIONED;
+
+/**
+ * Tests for partitioned local cache query metrics.
+ */
+public class CachePartitionedQueryDetailMetricsLocalSelfTest extends CacheAbstractQueryDetailMetricsSelfTest {
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ gridCnt = 1;
+ cacheMode = PARTITIONED;
+
+ super.beforeTest();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheReplicatedQueryDetailMetricsDistributedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheReplicatedQueryDetailMetricsDistributedSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheReplicatedQueryDetailMetricsDistributedSelfTest.java
new file mode 100644
index 0000000..32edb66
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheReplicatedQueryDetailMetricsDistributedSelfTest.java
@@ -0,0 +1,33 @@
+/*
+ * 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 static org.apache.ignite.cache.CacheMode.REPLICATED;
+
+/**
+ * Tests for replicated distributed cache query metrics.
+ */
+public class CacheReplicatedQueryDetailMetricsDistributedSelfTest extends CacheAbstractQueryDetailMetricsSelfTest {
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ gridCnt = 2;
+ cacheMode = REPLICATED;
+
+ super.beforeTest();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheReplicatedQueryDetailMetricsLocalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheReplicatedQueryDetailMetricsLocalSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheReplicatedQueryDetailMetricsLocalSelfTest.java
new file mode 100644
index 0000000..65c372d
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheReplicatedQueryDetailMetricsLocalSelfTest.java
@@ -0,0 +1,33 @@
+/*
+ * 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 static org.apache.ignite.cache.CacheMode.REPLICATED;
+
+/**
+ * Tests for replicated local cache query metrics.
+ */
+public class CacheReplicatedQueryDetailMetricsLocalSelfTest extends CacheAbstractQueryDetailMetricsSelfTest {
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ gridCnt = 1;
+ cacheMode = REPLICATED;
+
+ super.beforeTest();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite2.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite2.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite2.java
index be7523f..21f6864 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite2.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite2.java
@@ -18,12 +18,17 @@
package org.apache.ignite.testsuites;
import junit.framework.TestSuite;
+import org.apache.ignite.internal.processors.cache.CacheLocalQueryDetailMetricsSelfTest;
import org.apache.ignite.internal.processors.cache.CacheLocalQueryMetricsSelfTest;
import org.apache.ignite.internal.processors.cache.CacheOffheapBatchIndexingSingleTypeTest;
+import org.apache.ignite.internal.processors.cache.CachePartitionedQueryDetailMetricsDistributedSelfTest;
+import org.apache.ignite.internal.processors.cache.CachePartitionedQueryDetailMetricsLocalSelfTest;
import org.apache.ignite.internal.processors.cache.CachePartitionedQueryMetricsDistributedSelfTest;
import org.apache.ignite.internal.processors.cache.CachePartitionedQueryMetricsLocalSelfTest;
import org.apache.ignite.internal.processors.cache.CacheQueryNewClientSelfTest;
import org.apache.ignite.internal.processors.cache.CacheQueryOffheapEvictDataLostTest;
+import org.apache.ignite.internal.processors.cache.CacheReplicatedQueryDetailMetricsDistributedSelfTest;
+import org.apache.ignite.internal.processors.cache.CacheReplicatedQueryDetailMetricsLocalSelfTest;
import org.apache.ignite.internal.processors.cache.CacheReplicatedQueryMetricsDistributedSelfTest;
import org.apache.ignite.internal.processors.cache.CacheReplicatedQueryMetricsLocalSelfTest;
import org.apache.ignite.internal.processors.cache.CacheScanPartitionQueryFallbackSelfTest;
@@ -93,6 +98,13 @@ public class IgniteCacheQuerySelfTestSuite2 extends TestSuite {
suite.addTestSuite(CacheReplicatedQueryMetricsDistributedSelfTest.class);
suite.addTestSuite(CacheReplicatedQueryMetricsLocalSelfTest.class);
+ // Cache query metrics.
+ suite.addTestSuite(CacheLocalQueryDetailMetricsSelfTest.class);
+ suite.addTestSuite(CachePartitionedQueryDetailMetricsDistributedSelfTest.class);
+ suite.addTestSuite(CachePartitionedQueryDetailMetricsLocalSelfTest.class);
+ suite.addTestSuite(CacheReplicatedQueryDetailMetricsDistributedSelfTest.class);
+ suite.addTestSuite(CacheReplicatedQueryDetailMetricsLocalSelfTest.class);
+
// Unmarshalling query test.
suite.addTestSuite(IgniteCacheP2pUnmarshallingQueryErrorTest.class);
suite.addTestSuite(IgniteCacheNoClassQuerySelfTest.class);
http://git-wip-us.apache.org/repos/asf/ignite/blob/0234f673/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
index 1fa185f..04a68ae 100755
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
@@ -22,7 +22,8 @@ import java.util.{Collection => JavaCollection, Collections, UUID}
import org.apache.ignite._
import org.apache.ignite.cluster.ClusterNode
-import org.apache.ignite.internal.util.typedef._
+import org.apache.ignite.internal.util.lang.{GridFunc => F}
+import org.apache.ignite.internal.util.typedef.X
import org.apache.ignite.internal.visor.cache._
import org.apache.ignite.internal.visor.util.VisorTaskUtils._
import org.apache.ignite.lang.IgniteBiTuple
@@ -287,7 +288,7 @@ class VisorCacheCommand {
if (hasArgFlag("scan", argLst))
VisorCacheScanCommand().scan(argLst, node)
else {
- if (aggrData.nonEmpty && !aggrData.exists(cache => safeEquals(cache.name(), name) && cache.system())) {
+ if (aggrData.nonEmpty && !aggrData.exists(cache => F.eq(cache.name(), name) && cache.system())) {
if (hasArgFlag("clear", argLst))
VisorCacheClearCommand().clear(argLst, node)
else if (hasArgFlag("swap", argLst))
@@ -470,7 +471,7 @@ class VisorCacheCommand {
println(" Total number of executions: " + ad.execsQuery)
println(" Total number of failures: " + ad.failsQuery)
- gCfg.foreach(ccfgs => ccfgs.find(ccfg => safeEquals(ccfg.name(), ad.name()))
+ gCfg.foreach(ccfgs => ccfgs.find(ccfg => F.eq(ccfg.name(), ad.name()))
.foreach(ccfg => {
nl()
[10/50] [abbrv] ignite git commit: IGNITE-500
CacheLoadingConcurrentGridStartSelfTest fails (DataStreamer data loss at
unstable topology in !allowOverwrite mode fixed)
Posted by sb...@apache.org.
IGNITE-500 CacheLoadingConcurrentGridStartSelfTest fails (DataStreamer data loss at unstable topology in !allowOverwrite mode fixed)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b7499828
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b7499828
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b7499828
Branch: refs/heads/master
Commit: b7499828c928e02e8e554f960f3754e4d08bfbe0
Parents: 8b59f4e
Author: Anton Vinogradov <av...@apache.org>
Authored: Thu Nov 10 16:10:21 2016 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Thu Nov 10 16:10:21 2016 +0300
----------------------------------------------------------------------
.../org/apache/ignite/IgniteDataStreamer.java | 2 +-
.../processors/cache/GridCacheMapEntry.java | 5 +-
.../processors/cache/GridCacheMvccManager.java | 77 +++
.../GridCachePartitionExchangeManager.java | 5 +
.../cache/GridCacheSharedContext.java | 1 +
.../datastreamer/DataStreamProcessor.java | 104 +++-
.../datastreamer/DataStreamerImpl.java | 603 ++++++++++++++-----
.../ignite/internal/util/GridLogThrottle.java | 29 +-
.../cache/IgniteCacheDynamicStopSelfTest.java | 48 +-
...CacheLoadingConcurrentGridStartSelfTest.java | 251 +++++++-
...ncurrentGridStartSelfTestAllowOverwrite.java | 30 +
.../DataStreamProcessorSelfTest.java | 4 +-
.../datastreamer/DataStreamerImplSelfTest.java | 170 ++++--
.../DataStreamerMultiThreadedSelfTest.java | 2 -
.../datastreamer/DataStreamerTimeoutTest.java | 92 ++-
.../testsuites/IgniteCacheTestSuite2.java | 2 +
16 files changed, 1120 insertions(+), 305 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7499828/modules/core/src/main/java/org/apache/ignite/IgniteDataStreamer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteDataStreamer.java b/modules/core/src/main/java/org/apache/ignite/IgniteDataStreamer.java
index 484fee9..4e00d66 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteDataStreamer.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteDataStreamer.java
@@ -291,7 +291,7 @@ public interface IgniteDataStreamer<K, V> extends AutoCloseable {
* @throws IllegalStateException If grid has been concurrently stopped or
* {@link #close(boolean)} has already been called on streamer.
*/
- public IgniteFuture<?> removeData(K key) throws CacheException, IgniteInterruptedException, IllegalStateException;
+ public IgniteFuture<?> removeData(K key) throws CacheException, IgniteInterruptedException, IllegalStateException;
/**
* Adds data for streaming on remote node. This method can be called from multiple
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7499828/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index 5996672..950153f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -3444,11 +3444,8 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
if (val == null) {
skipQryNtf = true;
- if (cctx.deferredDelete() && !isInternal()) {
- assert !deletedUnlocked();
-
+ if (cctx.deferredDelete() && !deletedUnlocked() && !isInternal())
deletedUnlocked(true);
- }
}
else if (deletedUnlocked())
deletedUnlocked(false);
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7499828/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
index c4db01e..c57e17c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
@@ -46,6 +46,7 @@ import org.apache.ignite.internal.processors.cache.transactions.IgniteTxKey;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.util.GridBoundedConcurrentLinkedHashSet;
import org.apache.ignite.internal.util.GridConcurrentFactory;
+import org.apache.ignite.internal.util.GridConcurrentHashSet;
import org.apache.ignite.internal.util.future.GridCompoundFuture;
import org.apache.ignite.internal.util.future.GridFinishedFuture;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
@@ -108,6 +109,9 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
private final ConcurrentMap<GridCacheVersion, GridCacheAtomicFuture<?>> atomicFuts =
new ConcurrentHashMap8<>();
+ /** Pending data streamer futures. */
+ private final GridConcurrentHashSet<DataStreamerFuture> dataStreamerFuts = new GridConcurrentHashSet<>();
+
/** */
private final ConcurrentMap<IgniteUuid, GridCacheFuture<?>> futs = new ConcurrentHashMap8<>();
@@ -446,6 +450,13 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
}
/**
+ * @return Collection of pending data streamer futures.
+ */
+ public Collection<DataStreamerFuture> dataStreamerFutures() {
+ return dataStreamerFuts;
+ }
+
+ /**
* Gets future by given future ID.
*
* @param futVer Future ID.
@@ -476,6 +487,21 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
}
/**
+ * @param topVer Topology version.
+ */
+ public GridFutureAdapter addDataStreamerFuture(AffinityTopologyVersion topVer) {
+ final DataStreamerFuture fut = new DataStreamerFuture(topVer);
+
+ boolean add = dataStreamerFuts.add(fut);
+
+ assert add;
+
+ return fut;
+ }
+
+ /**
+
+ /**
* Adds future.
*
* @param fut Future.
@@ -1056,6 +1082,22 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
}
/**
+ *
+ * @return Finish update future.
+ */
+ @SuppressWarnings("unchecked")
+ public IgniteInternalFuture<?> finishDataStreamerUpdates() {
+ GridCompoundFuture<Object, Object> res = new GridCompoundFuture<>();
+
+ for (IgniteInternalFuture fut : dataStreamerFuts)
+ res.add(fut);
+
+ res.markInitialized();
+
+ return res;
+ }
+
+ /**
* @param keys Key for which locks should be released.
* @param cacheId Cache ID.
* @param topVer Topology version.
@@ -1294,4 +1336,39 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
CachePartialUpdateCheckedException.class.isAssignableFrom(cls);
}
}
+
+ /**
+ *
+ */
+ private class DataStreamerFuture extends GridFutureAdapter<Void> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Topology version. Instance field for toString method only. */
+ @GridToStringInclude
+ private final AffinityTopologyVersion topVer;
+
+ /**
+ * @param topVer Topology version.
+ */
+ DataStreamerFuture(AffinityTopologyVersion topVer) {
+ this.topVer = topVer;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean onDone(@Nullable Void res, @Nullable Throwable err) {
+ if (super.onDone(res, err)) {
+ dataStreamerFuts.remove(this);
+
+ return true;
+ }
+
+ return false;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(DataStreamerFuture.class, this, super.toString());
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7499828/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
index a901e2a..00d2d16 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
@@ -1309,6 +1309,11 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
for (GridCacheFuture<?> fut : mvcc.atomicFutures())
U.warn(log, ">>> " + fut);
+ U.warn(log, "Pending data streamer futures:");
+
+ for (IgniteInternalFuture<?> fut : mvcc.dataStreamerFutures())
+ U.warn(log, ">>> " + fut);
+
if (tm != null) {
U.warn(log, "Pending transaction deadlock detection futures:");
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7499828/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
index 8f39235..117a5c3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
@@ -636,6 +636,7 @@ public class GridCacheSharedContext<K, V> {
f.add(mvcc().finishExplicitLocks(topVer));
f.add(tm().finishTxs(topVer));
f.add(mvcc().finishAtomicUpdates(topVer));
+ f.add(mvcc().finishDataStreamerUpdates());
f.markInitialized();
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7499828/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessor.java
index 7663735..32fda87 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessor.java
@@ -21,6 +21,7 @@ import java.util.Collection;
import java.util.UUID;
import java.util.concurrent.DelayQueue;
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteException;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
@@ -29,13 +30,18 @@ import org.apache.ignite.internal.managers.communication.GridMessageListener;
import org.apache.ignite.internal.managers.deployment.GridDeployment;
import org.apache.ignite.internal.processors.GridProcessorAdapter;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTopologyFuture;
import org.apache.ignite.internal.util.GridConcurrentHashSet;
import org.apache.ignite.internal.util.GridSpinBusyLock;
+import org.apache.ignite.internal.util.future.GridFutureAdapter;
import org.apache.ignite.internal.util.typedef.CI1;
import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.internal.util.worker.GridWorker;
import org.apache.ignite.lang.IgniteFuture;
+import org.apache.ignite.lang.IgniteInClosure;
import org.apache.ignite.marshaller.Marshaller;
import org.apache.ignite.stream.StreamReceiver;
import org.apache.ignite.thread.IgniteThread;
@@ -288,32 +294,94 @@ public class DataStreamProcessor<K, V> extends GridProcessorAdapter {
return;
}
- Collection<DataStreamerEntry> col = req.entries();
+ localUpdate(nodeId, req, updater, topic);
+ }
+ finally {
+ busyLock.leaveBusy();
+ }
+ }
- DataStreamerUpdateJob job = new DataStreamerUpdateJob(ctx,
- log,
- req.cacheName(),
- col,
- req.ignoreDeploymentOwnership(),
- req.skipStore(),
- req.keepBinary(),
- updater);
+ /**
+ * @param nodeId Node id.
+ * @param req Request.
+ * @param updater Updater.
+ * @param topic Topic.
+ */
+ private void localUpdate(final UUID nodeId,
+ final DataStreamerRequest req,
+ final StreamReceiver<K, V> updater,
+ final Object topic) {
+ final boolean allowOverwrite = !(updater instanceof DataStreamerImpl.IsolatedUpdater);
- Exception err = null;
+ try {
+ GridCacheAdapter cache = ctx.cache().internalCache(req.cacheName());
+
+ if (cache == null)
+ throw new IgniteCheckedException("Cache not created or already destroyed.");
+
+ GridCacheContext cctx = cache.context();
+
+ DataStreamerUpdateJob job = null;
+
+ GridFutureAdapter waitFut = null;
+
+ if (!allowOverwrite)
+ cctx.topology().readLock();
try {
- job.call();
- }
- catch (Exception e) {
- U.error(log, "Failed to finish update job.", e);
+ GridDhtTopologyFuture fut = cctx.topologyVersionFuture();
- err = e;
+ AffinityTopologyVersion topVer = fut.topologyVersion();
+
+ if (!allowOverwrite && !topVer.equals(req.topologyVersion())) {
+ Exception err = new IgniteCheckedException(
+ "DataStreamer will retry data transfer at stable topology " +
+ "[reqTop=" + req.topologyVersion() + ", topVer=" + topVer + ", node=remote]");
+
+ sendResponse(nodeId, topic, req.requestId(), err, req.forceLocalDeployment());
+ }
+ else if (allowOverwrite || fut.isDone()) {
+ job = new DataStreamerUpdateJob(ctx,
+ log,
+ req.cacheName(),
+ req.entries(),
+ req.ignoreDeploymentOwnership(),
+ req.skipStore(),
+ req.keepBinary(),
+ updater);
+
+ waitFut = allowOverwrite ? null : cctx.mvcc().addDataStreamerFuture(topVer);
+ }
+ else {
+ fut.listen(new IgniteInClosure<IgniteInternalFuture<AffinityTopologyVersion>>() {
+ @Override public void apply(IgniteInternalFuture<AffinityTopologyVersion> e) {
+ localUpdate(nodeId, req, updater, topic);
+ }
+ });
+ }
+ }
+ finally {
+ if (!allowOverwrite)
+ cctx.topology().readUnlock();
}
- sendResponse(nodeId, topic, req.requestId(), err, req.forceLocalDeployment());
+ if (job != null) {
+ try {
+ job.call();
+
+ sendResponse(nodeId, topic, req.requestId(), null, req.forceLocalDeployment());
+ }
+ finally {
+ if (waitFut != null)
+ waitFut.onDone();
+ }
+ }
}
- finally {
- busyLock.leaveBusy();
+ catch (Throwable e) {
+ sendResponse(nodeId, topic, req.requestId(), e, req.forceLocalDeployment());
+
+ if (e instanceof Error)
+ throw (Error)e;
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7499828/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
index a6065dd..443783b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
@@ -29,6 +29,7 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Queue;
import java.util.UUID;
+import java.util.concurrent.ConcurrentLinkedDeque;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.DelayQueue;
import java.util.concurrent.Delayed;
@@ -39,15 +40,15 @@ import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
import javax.cache.CacheException;
import javax.cache.expiry.ExpiryPolicy;
-
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.IgniteDataStreamerTimeoutException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteInterruptedException;
import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.IgniteDataStreamerTimeoutException;
+import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.cluster.ClusterTopologyException;
import org.apache.ignite.configuration.CacheConfiguration;
@@ -72,11 +73,13 @@ import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
import org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedException;
+import org.apache.ignite.internal.processors.cache.GridCacheGateway;
import org.apache.ignite.internal.processors.cache.GridCacheUtils;
import org.apache.ignite.internal.processors.cache.IgniteCacheFutureImpl;
import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtInvalidPartitionException;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTopologyFuture;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessor;
import org.apache.ignite.internal.processors.dr.GridDrType;
@@ -92,6 +95,8 @@ import org.apache.ignite.internal.util.typedef.CI1;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.A;
import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.apache.ignite.internal.util.typedef.internal.GPC;
+import org.apache.ignite.internal.util.typedef.internal.LT;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteClosure;
@@ -102,6 +107,7 @@ import org.apache.ignite.plugin.security.SecurityPermission;
import org.apache.ignite.stream.StreamReceiver;
import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentHashMap8;
+import org.jsr166.LongAdder8;
import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
@@ -113,12 +119,15 @@ import static org.apache.ignite.internal.managers.communication.GridIoPolicy.PUB
*/
@SuppressWarnings("unchecked")
public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed {
- /** Default policy reoslver. */
+ /** Default policy resolver. */
private static final DefaultIoPolicyResolver DFLT_IO_PLC_RSLVR = new DefaultIoPolicyResolver();
/** Isolated receiver. */
private static final StreamReceiver ISOLATED_UPDATER = new IsolatedUpdater();
+ /** Amount of permissions should be available to continue new data processing. */
+ private static final int REMAP_SEMAPHORE_PERMISSIONS_COUNT = Integer.MAX_VALUE;
+
/** Cache receiver. */
private StreamReceiver<K, V> rcvr = ISOLATED_UPDATER;
@@ -178,6 +187,9 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
/** {@code True} if data loader has been cancelled. */
private volatile boolean cancelled;
+ /** Fail counter. */
+ private final LongAdder8 failCntr = new LongAdder8();
+
/** Active futures of this data loader. */
@GridToStringInclude
private final Collection<IgniteInternalFuture<?>> activeFuts = new GridConcurrentHashSet<>();
@@ -189,6 +201,16 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
boolean rmv = activeFuts.remove(t);
assert rmv;
+
+ Throwable err = t.error();
+
+ if (err != null && !(err instanceof IgniteClientDisconnectedCheckedException)) {
+ LT.error(log, t.error(), "DataStreamer operation failed.", true);
+
+ failCntr.increment();
+
+ cancelled = true;
+ }
}
};
@@ -231,6 +253,15 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
/** Whether a warning at {@link DataStreamerImpl#allowOverwrite()} printed */
private static boolean isWarningPrinted;
+ /** Allows to pause new data processing while failed data processing in progress. */
+ private final Semaphore remapSem = new Semaphore(REMAP_SEMAPHORE_PERMISSIONS_COUNT);
+
+ /** */
+ private final ConcurrentLinkedDeque<Runnable> dataToRemap = new ConcurrentLinkedDeque<>();
+
+ /** */
+ private final AtomicBoolean remapOwning = new AtomicBoolean();
+
/**
* @param ctx Grid kernal context.
* @param cacheName Cache name.
@@ -301,7 +332,7 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
Buffer buf = bufMappings.get(nodeId);
if (buf != null)
- buf.onResponse(res);
+ buf.onResponse(res, nodeId);
else if (log.isDebugEnabled())
log.debug("Ignoring response since node has left [nodeId=" + nodeId + ", ");
@@ -314,6 +345,17 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
fut = new DataStreamerFuture(this);
publicFut = new IgniteCacheFutureImpl<>(fut);
+
+ GridCacheAdapter cache = ctx.cache().internalCache(cacheName);
+
+ if (cache == null) { // Possible, cache is not configured on node.
+ assert ccfg != null;
+
+ if (ccfg.getCacheMode() == CacheMode.LOCAL)
+ throw new CacheException("Impossible to load Local cache configured remotely.");
+
+ ctx.grid().getOrCreateCache(ccfg);
+ }
}
/**
@@ -358,6 +400,11 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
throw new IllegalStateException("Data streamer has been closed.");
}
+ else if (cancelled) {
+ busyLock.leaveBusy();
+
+ throw new IllegalStateException("Data streamer has been closed.");
+ }
}
/**
@@ -633,6 +680,37 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
}
/**
+ *
+ */
+ private void acquireRemapSemaphore() throws IgniteInterruptedCheckedException {
+ try {
+ if (remapSem.availablePermits() != REMAP_SEMAPHORE_PERMISSIONS_COUNT) {
+ if (timeout == DFLT_UNLIMIT_TIMEOUT) {
+ // Wait until failed data being processed.
+ remapSem.acquire(REMAP_SEMAPHORE_PERMISSIONS_COUNT);
+
+ remapSem.release(REMAP_SEMAPHORE_PERMISSIONS_COUNT);
+ }
+ else {
+ // Wait until failed data being processed.
+ boolean res = remapSem.tryAcquire(REMAP_SEMAPHORE_PERMISSIONS_COUNT, timeout, TimeUnit.MILLISECONDS);
+
+ if (res)
+ remapSem.release(REMAP_SEMAPHORE_PERMISSIONS_COUNT);
+ else
+ throw new IgniteDataStreamerTimeoutException("Data streamer exceeded timeout " +
+ "while was waiting for failed data resending finished.");
+ }
+ }
+ }
+ catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+
+ throw new IgniteInterruptedCheckedException(e);
+ }
+ }
+
+ /**
* @param entries Entries.
* @param resFut Result future.
* @param activeKeys Active keys.
@@ -644,170 +722,266 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
@Nullable final Collection<KeyCacheObjectWrapper> activeKeys,
final int remaps
) {
- assert entries != null;
+ try {
+ assert entries != null;
- if (!isWarningPrinted) {
- synchronized (this) {
- if (!allowOverwrite() && !isWarningPrinted) {
- U.warn(log, "Data streamer will not overwrite existing cache entries for better performance " +
- "(to change, set allowOverwrite to true)");
- }
+ final boolean remap = remaps > 0;
- isWarningPrinted = true;
+ if (!remap) { // Failed data should be processed prior to new data.
+ acquireRemapSemaphore();
}
- }
- Map<ClusterNode, Collection<DataStreamerEntry>> mappings = new HashMap<>();
+ if (!isWarningPrinted) {
+ synchronized (this) {
+ if (!allowOverwrite() && !isWarningPrinted) {
+ U.warn(log, "Data streamer will not overwrite existing cache entries for better performance " +
+ "(to change, set allowOverwrite to true)");
+ }
- boolean initPda = ctx.deploy().enabled() && jobPda == null;
+ isWarningPrinted = true;
+ }
+ }
- AffinityTopologyVersion topVer = ctx.cache().context().exchange().readyAffinityVersion();
+ Map<ClusterNode, Collection<DataStreamerEntry>> mappings = new HashMap<>();
- for (DataStreamerEntry entry : entries) {
- List<ClusterNode> nodes;
+ boolean initPda = ctx.deploy().enabled() && jobPda == null;
- try {
- KeyCacheObject key = entry.getKey();
+ GridCacheAdapter cache = ctx.cache().internalCache(cacheName);
- assert key != null;
+ if (cache == null)
+ throw new IgniteCheckedException("Cache not created or already destroyed.");
- if (initPda) {
- if (cacheObjCtx.addDeploymentInfo())
- jobPda = new DataStreamerPda(key.value(cacheObjCtx, false),
- entry.getValue() != null ? entry.getValue().value(cacheObjCtx, false) : null,
- rcvr);
- else if (rcvr != null)
- jobPda = new DataStreamerPda(rcvr);
+ GridCacheContext cctx = cache.context();
- initPda = false;
- }
+ GridCacheGateway gate = null;
- nodes = nodes(key, topVer);
- }
- catch (IgniteCheckedException e) {
- resFut.onDone(e);
+ if (!allowOverwrite() && !cctx.isLocal()) { // Cases where cctx required.
+ gate = cctx.gate();
- return;
+ gate.enter();
}
- if (F.isEmpty(nodes)) {
- resFut.onDone(new ClusterTopologyException("Failed to map key to node " +
- "(no nodes with cache found in topology) [infos=" + entries.size() +
- ", cacheName=" + cacheName + ']'));
-
- return;
- }
+ try {
+ AffinityTopologyVersion topVer = allowOverwrite() || cctx.isLocal() ?
+ ctx.cache().context().exchange().readyAffinityVersion() :
+ cctx.topology().topologyVersion();
- for (ClusterNode node : nodes) {
- Collection<DataStreamerEntry> col = mappings.get(node);
+ for (DataStreamerEntry entry : entries) {
+ List<ClusterNode> nodes;
- if (col == null)
- mappings.put(node, col = new ArrayList<>());
+ try {
+ KeyCacheObject key = entry.getKey();
- col.add(entry);
- }
- }
+ assert key != null;
- for (final Map.Entry<ClusterNode, Collection<DataStreamerEntry>> e : mappings.entrySet()) {
- final UUID nodeId = e.getKey().id();
+ if (initPda) {
+ if (cacheObjCtx.addDeploymentInfo())
+ jobPda = new DataStreamerPda(key.value(cacheObjCtx, false),
+ entry.getValue() != null ? entry.getValue().value(cacheObjCtx, false) : null,
+ rcvr);
+ else if (rcvr != null)
+ jobPda = new DataStreamerPda(rcvr);
- Buffer buf = bufMappings.get(nodeId);
+ initPda = false;
+ }
- if (buf == null) {
- Buffer old = bufMappings.putIfAbsent(nodeId, buf = new Buffer(e.getKey()));
+ nodes = nodes(key, topVer, cctx);
+ }
+ catch (IgniteCheckedException e) {
+ resFut.onDone(e);
- if (old != null)
- buf = old;
- }
+ return;
+ }
- final Collection<DataStreamerEntry> entriesForNode = e.getValue();
+ if (F.isEmpty(nodes)) {
+ resFut.onDone(new ClusterTopologyException("Failed to map key to node " +
+ "(no nodes with cache found in topology) [infos=" + entries.size() +
+ ", cacheName=" + cacheName + ']'));
- IgniteInClosure<IgniteInternalFuture<?>> lsnr = new IgniteInClosure<IgniteInternalFuture<?>>() {
- @Override public void apply(IgniteInternalFuture<?> t) {
- try {
- t.get();
+ return;
+ }
- if (activeKeys != null) {
- for (DataStreamerEntry e : entriesForNode)
- activeKeys.remove(new KeyCacheObjectWrapper(e.getKey()));
+ for (ClusterNode node : nodes) {
+ Collection<DataStreamerEntry> col = mappings.get(node);
- if (activeKeys.isEmpty())
- resFut.onDone();
- }
- else {
- assert entriesForNode.size() == 1;
+ if (col == null)
+ mappings.put(node, col = new ArrayList<>());
- // That has been a single key,
- // so complete result future right away.
- resFut.onDone();
- }
+ col.add(entry);
}
- catch (IgniteClientDisconnectedCheckedException e1) {
- if (log.isDebugEnabled())
- log.debug("Future finished with disconnect error [nodeId=" + nodeId + ", err=" + e1 + ']');
+ }
- resFut.onDone(e1);
+ for (final Map.Entry<ClusterNode, Collection<DataStreamerEntry>> e : mappings.entrySet()) {
+ final UUID nodeId = e.getKey().id();
+
+ Buffer buf = bufMappings.get(nodeId);
+
+ if (buf == null) {
+ Buffer old = bufMappings.putIfAbsent(nodeId, buf = new Buffer(e.getKey()));
+
+ if (old != null)
+ buf = old;
}
- catch (IgniteCheckedException e1) {
- if (log.isDebugEnabled())
- log.debug("Future finished with error [nodeId=" + nodeId + ", err=" + e1 + ']');
- if (cancelled) {
- resFut.onDone(new IgniteCheckedException("Data streamer has been cancelled: " +
- DataStreamerImpl.this, e1));
+ final Collection<DataStreamerEntry> entriesForNode = e.getValue();
+
+ IgniteInClosure<IgniteInternalFuture<?>> lsnr = new IgniteInClosure<IgniteInternalFuture<?>>() {
+ @Override public void apply(IgniteInternalFuture<?> t) {
+ try {
+ t.get();
+
+ if (activeKeys != null) {
+ for (DataStreamerEntry e : entriesForNode)
+ activeKeys.remove(new KeyCacheObjectWrapper(e.getKey()));
+
+ if (activeKeys.isEmpty())
+ resFut.onDone();
+ }
+ else {
+ assert entriesForNode.size() == 1;
+
+ // That has been a single key,
+ // so complete result future right away.
+ resFut.onDone();
+ }
+ }
+ catch (IgniteClientDisconnectedCheckedException e1) {
+ if (log.isDebugEnabled())
+ log.debug("Future finished with disconnect error [nodeId=" + nodeId + ", err=" + e1 + ']');
+
+ resFut.onDone(e1);
+ }
+ catch (IgniteCheckedException e1) {
+ if (log.isDebugEnabled())
+ log.debug("Future finished with error [nodeId=" + nodeId + ", err=" + e1 + ']');
+
+ if (cancelled) {
+ resFut.onDone(new IgniteCheckedException("Data streamer has been cancelled: " +
+ DataStreamerImpl.this, e1));
+ }
+ else if (remaps + 1 > maxRemapCnt) {
+ resFut.onDone(new IgniteCheckedException("Failed to finish operation (too many remaps): "
+ + remaps, e1));
+ }
+ else {
+ try {
+ remapSem.acquire();
+
+ final Runnable r = new Runnable() {
+ @Override public void run() {
+ try {
+ if (cancelled)
+ throw new IllegalStateException("DataStreamer closed.");
+
+ load0(entriesForNode, resFut, activeKeys, remaps + 1);
+ }
+ catch (Throwable ex) {
+ resFut.onDone(
+ new IgniteCheckedException("DataStreamer remapping failed. ", ex));
+ }
+ finally {
+ remapSem.release();
+ }
+ }
+ };
+
+ dataToRemap.add(r);
+
+ if (!remapOwning.get() && remapOwning.compareAndSet(false, true)) {
+ ctx.closure().callLocalSafe(new GPC<Boolean>() {
+ @Override public Boolean call() {
+ boolean locked = true;
+
+ while (locked || !dataToRemap.isEmpty()) {
+ if (!locked && !remapOwning.compareAndSet(false, true))
+ return false;
+
+ try {
+ Runnable r = dataToRemap.poll();
+
+ if (r != null)
+ r.run();
+ }
+ finally {
+ if (!dataToRemap.isEmpty())
+ locked = true;
+ else {
+ remapOwning.set(false);
+
+ locked = false;
+ }
+ }
+ }
+
+ return true;
+ }
+ }, true);
+ }
+ }
+ catch (InterruptedException e2) {
+ resFut.onDone(e2);
+ }
+ }
+ }
}
- else if (remaps + 1 > maxRemapCnt) {
- resFut.onDone(new IgniteCheckedException("Failed to finish operation (too many remaps): "
- + remaps), e1);
- }
- else
- load0(entriesForNode, resFut, activeKeys, remaps + 1);
- }
- }
- };
+ };
- final GridFutureAdapter<?> f;
+ final GridFutureAdapter<?> f;
- try {
- f = buf.update(entriesForNode, topVer, lsnr);
- }
- catch (IgniteInterruptedCheckedException e1) {
- resFut.onDone(e1);
+ try {
+ f = buf.update(entriesForNode, topVer, lsnr, remap);
+ }
+ catch (IgniteInterruptedCheckedException e1) {
+ resFut.onDone(e1);
- return;
- }
+ return;
+ }
- if (ctx.discovery().node(nodeId) == null) {
- if (bufMappings.remove(nodeId, buf)) {
- final Buffer buf0 = buf;
+ if (ctx.discovery().node(nodeId) == null) {
+ if (bufMappings.remove(nodeId, buf)) {
+ final Buffer buf0 = buf;
- waitAffinityAndRun(new Runnable() {
- @Override public void run() {
- buf0.onNodeLeft();
+ waitAffinityAndRun(new Runnable() {
+ @Override public void run() {
+ buf0.onNodeLeft();
- if (f != null)
- f.onDone(new ClusterTopologyCheckedException("Failed to wait for request completion " +
- "(node has left): " + nodeId));
+ if (f != null)
+ f.onDone(new ClusterTopologyCheckedException("Failed to wait for request completion " +
+ "(node has left): " + nodeId));
+ }
+ }, ctx.discovery().topologyVersion(), false);
}
- }, ctx.discovery().topologyVersion(), false);
+ }
}
}
+ finally {
+ if (gate != null)
+ gate.leave();
+ }
+ }
+ catch (Exception ex) {
+ resFut.onDone(new IgniteCheckedException("DataStreamer data loading failed.", ex));
}
}
/**
* @param key Key to map.
* @param topVer Topology version.
+ * @param cctx Context.
* @return Nodes to send requests to.
* @throws IgniteCheckedException If failed.
*/
- private List<ClusterNode> nodes(KeyCacheObject key, AffinityTopologyVersion topVer) throws IgniteCheckedException {
+ private List<ClusterNode> nodes(KeyCacheObject key,
+ AffinityTopologyVersion topVer,
+ GridCacheContext cctx) throws IgniteCheckedException {
GridAffinityProcessor aff = ctx.affinity();
List<ClusterNode> res = null;
if (!allowOverwrite())
- res = aff.mapKeyToPrimaryAndBackups(cacheName, key, topVer);
+ res = cctx.isLocal() ?
+ aff.mapKeyToPrimaryAndBackups(cacheName, key, topVer) :
+ cctx.topology().nodes(cctx.affinity().partition(key), topVer);
else {
ClusterNode node = aff.mapKeyToNode(cacheName, key, topVer);
@@ -992,7 +1166,10 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
* @throws IgniteCheckedException If failed.
*/
public void closeEx(boolean cancel) throws IgniteCheckedException {
- closeEx(cancel, null);
+ IgniteCheckedException err = closeEx(cancel, null);
+
+ if (err != null)
+ throw err; // Throws at close().
}
/**
@@ -1000,9 +1177,9 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
* @param err Error.
* @throws IgniteCheckedException If failed.
*/
- public void closeEx(boolean cancel, IgniteCheckedException err) throws IgniteCheckedException {
+ private IgniteCheckedException closeEx(boolean cancel, IgniteCheckedException err) throws IgniteCheckedException {
if (!closed.compareAndSet(false, true))
- return;
+ return null;
busyLock.block();
@@ -1029,7 +1206,14 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
throw e;
}
+ long failed = failCntr.longValue();
+
+ if (failed > 0 && err == null)
+ err = new IgniteCheckedException("Some of DataStreamer operations failed [failedCount=" + failed + "]");
+
fut.onDone(err);
+
+ return err;
}
/**
@@ -1139,6 +1323,9 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
/** */
private final Semaphore sem;
+ /** Batch topology. */
+ private AffinityTopologyVersion batchTopVer;
+
/** Closure to signal on task finish. */
@GridToStringExclude
private final IgniteInClosure<IgniteInternalFuture<Object>> signalC = new IgniteInClosure<IgniteInternalFuture<Object>>() {
@@ -1169,37 +1356,64 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
}
/**
+ * @param remap Remapping flag.
+ */
+ private void renewBatch(boolean remap) {
+ entries = newEntries();
+ curFut = new GridFutureAdapter<>();
+
+ batchTopVer = null;
+
+ if (!remap)
+ curFut.listen(signalC);
+ }
+
+ /**
* @param newEntries Infos.
* @param topVer Topology version.
* @param lsnr Listener for the operation future.
+ * @param remap Remapping flag.
* @return Future for operation.
* @throws IgniteInterruptedCheckedException If failed.
*/
@Nullable GridFutureAdapter<?> update(Iterable<DataStreamerEntry> newEntries,
AffinityTopologyVersion topVer,
- IgniteInClosure<IgniteInternalFuture<?>> lsnr) throws IgniteInterruptedCheckedException {
+ IgniteInClosure<IgniteInternalFuture<?>> lsnr,
+ boolean remap) throws IgniteInterruptedCheckedException {
List<DataStreamerEntry> entries0 = null;
+
GridFutureAdapter<Object> curFut0;
+ AffinityTopologyVersion curBatchTopVer;
+
synchronized (this) {
curFut0 = curFut;
curFut0.listen(lsnr);
+ if (batchTopVer == null)
+ batchTopVer = topVer;
+
+ curBatchTopVer = batchTopVer;
+
for (DataStreamerEntry entry : newEntries)
entries.add(entry);
if (entries.size() >= bufSize) {
entries0 = entries;
- entries = newEntries();
- curFut = new GridFutureAdapter<>();
- curFut.listen(signalC);
+ renewBatch(remap);
}
}
- if (entries0 != null) {
- submit(entries0, topVer, curFut0);
+ if (!allowOverwrite() && !topVer.equals(curBatchTopVer)) {
+ renewBatch(remap);
+
+ curFut0.onDone(null, new IgniteCheckedException("Topology changed during batch preparation." +
+ "[batchTopVer=" + curBatchTopVer + ", topVer=" + topVer + "]"));
+ }
+ else if (entries0 != null) {
+ submit(entries0, curBatchTopVer, curFut0, remap);
if (cancelled)
curFut0.onDone(new IgniteCheckedException("Data streamer has been cancelled: " +
@@ -1227,6 +1441,8 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
List<DataStreamerEntry> entries0 = null;
GridFutureAdapter<Object> curFut0 = null;
+ acquireRemapSemaphore();
+
synchronized (this) {
if (!entries.isEmpty()) {
entries0 = entries;
@@ -1239,7 +1455,7 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
}
if (entries0 != null)
- submit(entries0, null, curFut0);
+ submit(entries0, batchTopVer, curFut0, false);
// Create compound future for this flush.
GridCompoundFuture<Object, Object> res = null;
@@ -1290,25 +1506,113 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
}
/**
+ * @param entries Entries.
+ * @param reqTopVer Request topology version.
+ * @param curFut Current future.
+ */
+ private void localUpdate(final Collection<DataStreamerEntry> entries,
+ final AffinityTopologyVersion reqTopVer,
+ final GridFutureAdapter<Object> curFut) {
+ try {
+ GridCacheContext cctx = ctx.cache().internalCache(cacheName).context();
+
+ final boolean allowOverwrite = allowOverwrite();
+ final boolean loc = cctx.isLocal();
+
+ if (!loc && !allowOverwrite)
+ cctx.topology().readLock();
+
+ try {
+ GridDhtTopologyFuture fut = loc ? null : cctx.topologyVersionFuture();
+
+ AffinityTopologyVersion topVer = loc ? reqTopVer : fut.topologyVersion();
+
+ if (!allowOverwrite && !topVer.equals(reqTopVer)) {
+ curFut.onDone(new IgniteCheckedException(
+ "DataStreamer will retry data transfer at stable topology. " +
+ "[reqTop=" + reqTopVer + " ,topVer=" + topVer + ", node=local]"));
+ }
+ else if (loc || allowOverwrite || fut.isDone()) {
+ IgniteInternalFuture<Object> callFut = ctx.closure().callLocalSafe(
+ new DataStreamerUpdateJob(
+ ctx,
+ log,
+ cacheName,
+ entries,
+ false,
+ skipStore,
+ keepBinary,
+ rcvr),
+ false);
+
+ locFuts.add(callFut);
+
+ final GridFutureAdapter waitFut = (loc || allowOverwrite) ?
+ null :
+ cctx.mvcc().addDataStreamerFuture(topVer);
+
+ callFut.listen(new IgniteInClosure<IgniteInternalFuture<Object>>() {
+ @Override public void apply(IgniteInternalFuture<Object> t) {
+ try {
+ boolean rmv = locFuts.remove(t);
+
+ assert rmv;
+
+ curFut.onDone(t.get());
+ }
+ catch (IgniteCheckedException e) {
+ curFut.onDone(e);
+ }
+ finally {
+ if (waitFut != null)
+ waitFut.onDone();
+ }
+ }
+ });
+ }
+ else {
+ fut.listen(new IgniteInClosure<IgniteInternalFuture<AffinityTopologyVersion>>() {
+ @Override public void apply(IgniteInternalFuture<AffinityTopologyVersion> e) {
+ localUpdate(entries, reqTopVer, curFut);
+ }
+ });
+ }
+ }
+ finally {
+ if (!loc && !allowOverwrite)
+ cctx.topology().readUnlock();
+ }
+ }
+ catch (Throwable ex) {
+ curFut.onDone(new IgniteCheckedException("DataStreamer data handling failed.", ex));
+ }
+ }
+
+ /**
* @param entries Entries to submit.
* @param topVer Topology version.
* @param curFut Current future.
+ * @param remap Remapping flag.
* @throws IgniteInterruptedCheckedException If interrupted.
*/
private void submit(final Collection<DataStreamerEntry> entries,
@Nullable AffinityTopologyVersion topVer,
- final GridFutureAdapter<Object> curFut)
+ final GridFutureAdapter<Object> curFut,
+ boolean remap)
throws IgniteInterruptedCheckedException {
assert entries != null;
assert !entries.isEmpty();
assert curFut != null;
- try {
- incrementActiveTasks();
- }
- catch (IgniteDataStreamerTimeoutException e) {
- curFut.onDone(e);
- throw e;
+ if (!remap) {
+ try {
+ incrementActiveTasks();
+ }
+ catch (IgniteDataStreamerTimeoutException e) {
+ curFut.onDone(e);
+
+ throw e;
+ }
}
IgniteInternalFuture<Object> fut;
@@ -1318,27 +1622,8 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
if (plc == null)
plc = PUBLIC_POOL;
- if (isLocNode && plc == GridIoPolicy.PUBLIC_POOL) {
- fut = ctx.closure().callLocalSafe(
- new DataStreamerUpdateJob(ctx, log, cacheName, entries, false, skipStore, keepBinary, rcvr), false);
-
- locFuts.add(fut);
-
- fut.listen(new IgniteInClosure<IgniteInternalFuture<Object>>() {
- @Override public void apply(IgniteInternalFuture<Object> t) {
- try {
- boolean rmv = locFuts.remove(t);
-
- assert rmv;
-
- curFut.onDone(t.get());
- }
- catch (IgniteCheckedException e) {
- curFut.onDone(e);
- }
- }
- });
- }
+ if (isLocNode && plc == GridIoPolicy.PUBLIC_POOL)
+ localUpdate(entries, topVer, curFut);
else {
try {
for (DataStreamerEntry e : entries) {
@@ -1466,8 +1751,9 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
/**
* @param res Response.
+ * @param nodeId Node id.
*/
- void onResponse(DataStreamerResponse res) {
+ void onResponse(DataStreamerResponse res, UUID nodeId) {
if (log.isDebugEnabled())
log.debug("Received data load response: " + res);
@@ -1488,9 +1774,10 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
try {
GridPeerDeployAware jobPda0 = jobPda;
- err = U.unmarshal(ctx,
- errBytes,
- U.resolveClassLoader(jobPda0 != null ? jobPda0.classLoader() : null, ctx.config()));
+ err = new IgniteCheckedException("DataStreamer request failed [node=" + nodeId + "]",
+ (Throwable)U.unmarshal(ctx,
+ errBytes,
+ U.resolveClassLoader(jobPda0 != null ? jobPda0.classLoader() : null, ctx.config())));
}
catch (IgniteCheckedException e) {
f.onDone(null, new IgniteCheckedException("Failed to unmarshal response.", e));
@@ -1613,7 +1900,7 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
/**
* Isolated receiver which only loads entry initial value.
*/
- private static class IsolatedUpdater implements StreamReceiver<KeyCacheObject, CacheObject>,
+ protected static class IsolatedUpdater implements StreamReceiver<KeyCacheObject, CacheObject>,
DataStreamerCacheUpdaters.InternalUpdater {
/** */
private static final long serialVersionUID = 0L;
@@ -1630,7 +1917,9 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
GridCacheContext cctx = internalCache.context();
- AffinityTopologyVersion topVer = cctx.affinity().affinityTopologyVersion();
+ AffinityTopologyVersion topVer = cctx.isLocal() ?
+ cctx.affinity().affinityTopologyVersion() :
+ cctx.topology().topologyVersion();
GridCacheVersion ver = cctx.versions().isolatedStreamerVersion();
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7499828/modules/core/src/main/java/org/apache/ignite/internal/util/GridLogThrottle.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/GridLogThrottle.java b/modules/core/src/main/java/org/apache/ignite/internal/util/GridLogThrottle.java
index 745619a..ce6783a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/GridLogThrottle.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/GridLogThrottle.java
@@ -72,7 +72,21 @@ public class GridLogThrottle {
public static void error(@Nullable IgniteLogger log, @Nullable Throwable e, String msg) {
assert !F.isEmpty(msg);
- log(log, e, msg, null, LogLevel.ERROR, false);
+ log(log, e, msg, null, LogLevel.ERROR, false, false);
+ }
+
+ /**
+ * Logs error if needed.
+ *
+ * @param log Logger.
+ * @param e Error (optional).
+ * @param msg Message.
+ * @param byMessage Errors group by message, not by tuple(error, msg).
+ */
+ public static void error(@Nullable IgniteLogger log, @Nullable Throwable e, String msg, boolean byMessage) {
+ assert !F.isEmpty(msg);
+
+ log(log, e, msg, null, LogLevel.ERROR, false, byMessage);
}
/**
@@ -85,7 +99,7 @@ public class GridLogThrottle {
public static void warn(@Nullable IgniteLogger log, @Nullable Throwable e, String msg) {
assert !F.isEmpty(msg);
- log(log, e, msg, null, LogLevel.WARN, false);
+ log(log, e, msg, null, LogLevel.WARN, false, false);
}
/**
@@ -99,7 +113,7 @@ public class GridLogThrottle {
public static void warn(@Nullable IgniteLogger log, @Nullable Throwable e, String msg, boolean quite) {
assert !F.isEmpty(msg);
- log(log, e, msg, null, LogLevel.WARN, quite);
+ log(log, e, msg, null, LogLevel.WARN, quite, false);
}
/**
@@ -113,7 +127,7 @@ public class GridLogThrottle {
public static void warn(@Nullable IgniteLogger log, @Nullable Throwable e, String longMsg, @Nullable String shortMsg) {
assert !F.isEmpty(longMsg);
- log(log, e, longMsg, shortMsg, LogLevel.WARN, false);
+ log(log, e, longMsg, shortMsg, LogLevel.WARN, false, false);
}
/**
@@ -126,7 +140,7 @@ public class GridLogThrottle {
public static void info(@Nullable IgniteLogger log, String msg, boolean quite) {
assert !F.isEmpty(msg);
- log(log, null, msg, null, LogLevel.INFO, quite);
+ log(log, null, msg, null, LogLevel.INFO, quite, false);
}
/**
@@ -154,14 +168,15 @@ public class GridLogThrottle {
* @param longMsg Long message (or just message).
* @param shortMsg Short message for quite logging.
* @param level Level where messages should appear.
+ * @param byMessage Errors group by message, not by tuple(error, msg).
*/
@SuppressWarnings({"RedundantTypeArguments"})
private static void log(@Nullable IgniteLogger log, @Nullable Throwable e, String longMsg, @Nullable String shortMsg,
- LogLevel level, boolean quiet) {
+ LogLevel level, boolean quiet, boolean byMessage) {
assert !F.isEmpty(longMsg);
IgniteBiTuple<Class<? extends Throwable>, String> tup =
- e != null ? F.<Class<? extends Throwable>, String>t(e.getClass(), e.getMessage()) :
+ e != null && !byMessage ? F.<Class<? extends Throwable>, String>t(e.getClass(), e.getMessage()) :
F.<Class<? extends Throwable>, String>t(null, longMsg);
while (true) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7499828/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDynamicStopSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDynamicStopSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDynamicStopSelfTest.java
index 5bd6074..c92ea9e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDynamicStopSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDynamicStopSelfTest.java
@@ -78,27 +78,37 @@ public class IgniteCacheDynamicStopSelfTest extends GridCommonAbstractTest {
IgniteInternalFuture<Object> fut = GridTestUtils.runAsync(new Callable<Object>() {
/** {@inheritDoc} */
@Override public Object call() throws Exception {
- try (IgniteDataStreamer<Integer, Integer> str = ignite(0).dataStreamer(null)) {
- str.allowOverwrite(allowOverwrite);
-
- int i = 0;
-
- while (!stop.get()) {
- str.addData(i % 10_000, i).listen(new CI1<IgniteFuture<?>>() {
- @Override public void apply(IgniteFuture<?> f) {
- try {
- f.get();
- }
- catch (CacheException ignore) {
- // This may be debugged.
- }
+ while (!stop.get()) {
+ try (IgniteDataStreamer<Integer, Integer> str = ignite(0).dataStreamer(null)) {
+ str.allowOverwrite(allowOverwrite);
+
+ int i = 0;
+
+ while (!stop.get()) {
+ try {
+ str.addData(i % 10_000, i).listen(new CI1<IgniteFuture<?>>() {
+ @Override public void apply(IgniteFuture<?> f) {
+ try {
+ f.get();
+ }
+ catch (CacheException ignore) {
+ // This may be debugged.
+ }
+ }
+ });
+ }
+ catch (IllegalStateException ignored) {
+ break;
}
- });
- if (i > 0 && i % 10000 == 0)
- info("Added: " + i);
+ if (i > 0 && i % 10000 == 0)
+ info("Added: " + i);
- i++;
+ i++;
+ }
+ }
+ catch (IllegalStateException | CacheException ignored) {
+ // This may be debugged.
}
}
@@ -114,6 +124,8 @@ public class IgniteCacheDynamicStopSelfTest extends GridCommonAbstractTest {
Thread.sleep(500);
ignite(0).createCache(ccfg);
+
+ Thread.sleep(1000);
}
finally {
stop.set(true);
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7499828/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLoadingConcurrentGridStartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLoadingConcurrentGridStartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLoadingConcurrentGridStartSelfTest.java
index 9da6cf7..0801691 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLoadingConcurrentGridStartSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLoadingConcurrentGridStartSelfTest.java
@@ -18,6 +18,9 @@
package org.apache.ignite.internal.processors.cache.distributed;
import java.io.Serializable;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.Set;
import java.util.concurrent.Callable;
import javax.cache.Cache;
import javax.cache.configuration.FactoryBuilder;
@@ -28,32 +31,47 @@ import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteDataStreamer;
import org.apache.ignite.cache.CachePeekMode;
import org.apache.ignite.cache.store.CacheStoreAdapter;
+import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.util.typedef.G;
+import org.apache.ignite.internal.util.typedef.P1;
+import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiInClosure;
+import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgniteInClosure;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.jetbrains.annotations.Nullable;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_GRID_NAME;
+import static org.apache.ignite.testframework.GridTestUtils.runAsync;
/**
* Tests for cache data loading during simultaneous grids start.
*/
-public class CacheLoadingConcurrentGridStartSelfTest extends GridCommonAbstractTest {
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-500");
- }
-
+public class CacheLoadingConcurrentGridStartSelfTest extends GridCommonAbstractTest implements Serializable {
/** Grids count */
private static int GRIDS_CNT = 5;
/** Keys count */
private static int KEYS_CNT = 1_000_000;
+ /** Client. */
+ private volatile boolean client;
+
+ /** Config. */
+ private volatile boolean configured;
+
+ /** Allow override. */
+ protected volatile boolean allowOverwrite;
+
+ /** Restarts. */
+ protected volatile boolean restarts;
+
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
@@ -67,7 +85,24 @@ public class CacheLoadingConcurrentGridStartSelfTest extends GridCommonAbstractT
ccfg.setCacheStoreFactory(new FactoryBuilder.SingletonFactory(new TestCacheStoreAdapter()));
- cfg.setCacheConfiguration(ccfg);
+ if (getTestGridName(0).equals(gridName)) {
+ if (client)
+ cfg.setClientMode(true);
+
+ if (configured)
+ cfg.setCacheConfiguration(ccfg);
+ }
+ else
+ cfg.setCacheConfiguration(ccfg);
+
+ if (!configured)
+ ccfg.setNodeFilter(new P1<ClusterNode>() {
+ @Override public boolean apply(ClusterNode node) {
+ String name = node.attribute(ATTR_GRID_NAME).toString();
+
+ return !getTestGridName(0).equals(name);
+ }
+ });
return cfg;
}
@@ -81,22 +116,35 @@ public class CacheLoadingConcurrentGridStartSelfTest extends GridCommonAbstractT
* @throws Exception if failed
*/
public void testLoadCacheWithDataStreamer() throws Exception {
- IgniteInClosure<Ignite> f = new IgniteInClosure<Ignite>() {
- @Override public void apply(Ignite grid) {
- try (IgniteDataStreamer<Integer, String> dataStreamer = grid.dataStreamer(null)) {
- for (int i = 0; i < KEYS_CNT; i++)
- dataStreamer.addData(i, Integer.toString(i));
+ configured = true;
+
+ try {
+ IgniteInClosure<Ignite> f = new IgniteInClosure<Ignite>() {
+ @Override public void apply(Ignite grid) {
+ try (IgniteDataStreamer<Integer, String> dataStreamer = grid.dataStreamer(null)) {
+ dataStreamer.allowOverwrite(allowOverwrite);
+
+ for (int i = 0; i < KEYS_CNT; i++)
+ dataStreamer.addData(i, Integer.toString(i));
+ }
+
+ log.info("Data loaded.");
}
- }
- };
+ };
- loadCache(f);
+ loadCache(f);
+ }
+ finally {
+ configured = false;
+ }
}
/**
* @throws Exception if failed
*/
public void testLoadCacheFromStore() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-4210");
+
loadCache(new IgniteInClosure<Ignite>() {
@Override public void apply(Ignite grid) {
grid.cache(null).loadCache(null);
@@ -105,12 +153,177 @@ public class CacheLoadingConcurrentGridStartSelfTest extends GridCommonAbstractT
}
/**
+ * @throws Exception if failed
+ */
+ public void testLoadCacheWithDataStreamerSequentialClient() throws Exception {
+ client = true;
+
+ try {
+ loadCacheWithDataStreamerSequential();
+ }
+ finally {
+ client = false;
+ }
+ }
+
+ /**
+ * @throws Exception if failed
+ */
+ public void testLoadCacheWithDataStreamerSequentialClientWithConfig() throws Exception {
+ client = true;
+ configured = true;
+
+ try {
+ loadCacheWithDataStreamerSequential();
+ }
+ finally {
+ client = false;
+ configured = false;
+ }
+ }
+
+ /**
+ * @throws Exception if failed
+ */
+ public void testLoadCacheWithDataStreamerSequential() throws Exception {
+ loadCacheWithDataStreamerSequential();
+ }
+
+ /**
+ * @throws Exception if failed
+ */
+ public void testLoadCacheWithDataStreamerSequentialWithConfigAndRestarts() throws Exception {
+ restarts = true;
+ configured = true;
+
+ try {
+ loadCacheWithDataStreamerSequential();
+ }
+ finally {
+ restarts = false;
+ configured = false;
+ }
+ }
+
+ /**
+ * @throws Exception if failed
+ */
+ public void testLoadCacheWithDataStreamerSequentialWithConfig() throws Exception {
+ configured = true;
+
+ try {
+ loadCacheWithDataStreamerSequential();
+ }
+ finally {
+ configured = false;
+ }
+ }
+
+ /**
+ * @throws Exception if failed
+ */
+ private void loadCacheWithDataStreamerSequential() throws Exception {
+ startGrid(1);
+
+ Ignite g0 = startGrid(0);
+
+ IgniteInternalFuture<Object> restartFut = runAsync(new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ while (restarts) {
+ stopGrid(1);
+
+ startGrid(1);
+
+ U.sleep(100);
+ }
+
+ return null;
+ }
+ });
+
+ IgniteInternalFuture<Object> fut = runAsync(new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ for (int i = 2; i < GRIDS_CNT; i++)
+ startGrid(i);
+
+ return null;
+ }
+ });
+
+ final HashSet<IgniteFuture> set = new HashSet<>();
+
+ IgniteInClosure<Ignite> f = new IgniteInClosure<Ignite>() {
+ @Override public void apply(Ignite grid) {
+ try (IgniteDataStreamer<Integer, String> dataStreamer = grid.dataStreamer(null)) {
+ dataStreamer.allowOverwrite(allowOverwrite);
+
+ for (int i = 0; i < KEYS_CNT; i++) {
+ set.add(dataStreamer.addData(i, "Data"));
+
+ if (i % 100000 == 0)
+ log.info("Streaming " + i + "'th entry.");
+ }
+ }
+ }
+ };
+
+ f.apply(g0);
+
+ log.info("Data loaded.");
+
+ restarts = false;
+
+ fut.get();
+ restartFut.get();
+
+ for (IgniteFuture res : set)
+ assertNull(res.get());
+
+ IgniteCache<Integer, String> cache = grid(0).cache(null);
+
+ long size = cache.size(CachePeekMode.PRIMARY);
+
+ if (size != KEYS_CNT) {
+ Set<Integer> failedKeys = new LinkedHashSet<>();
+
+ for (int i = 0; i < KEYS_CNT; i++)
+ if (!cache.containsKey(i)) {
+ log.info("Actual cache size: " + size);
+
+ for (Ignite ignite : G.allGrids()) {
+ IgniteEx igniteEx = (IgniteEx)ignite;
+
+ log.info("Missed key info:" +
+ igniteEx.localNode().id() +
+ " primary=" +
+ ignite.affinity(null).isPrimary(igniteEx.localNode(), i) +
+ " backup=" +
+ ignite.affinity(null).isBackup(igniteEx.localNode(), i) +
+ " local peek=" +
+ ignite.cache(null).localPeek(i, CachePeekMode.ONHEAP));
+ }
+
+ for (int j = i; j < i + 10000; j++) {
+ if (!cache.containsKey(j))
+ failedKeys.add(j);
+ }
+
+ break;
+ }
+
+ assert failedKeys.isEmpty() : "Some failed keys: " + failedKeys.toString();
+ }
+
+ assertCacheSize();
+ }
+
+ /**
* Loads cache using closure and asserts cache size.
*
* @param f cache loading closure
* @throws Exception if failed
*/
- private void loadCache(IgniteInClosure<Ignite> f) throws Exception {
+ protected void loadCache(IgniteInClosure<Ignite> f) throws Exception {
Ignite g0 = startGrid(0);
IgniteInternalFuture fut = GridTestUtils.runAsync(new Callable<Ignite>() {
@@ -130,17 +343,17 @@ public class CacheLoadingConcurrentGridStartSelfTest extends GridCommonAbstractT
}
/** Asserts cache size. */
- private void assertCacheSize() {
+ protected void assertCacheSize() {
IgniteCache<Integer, String> cache = grid(0).cache(null);
- assertEquals(KEYS_CNT, cache.size(CachePeekMode.PRIMARY));
+ assertEquals("Data lost.", KEYS_CNT, cache.size(CachePeekMode.PRIMARY));
int total = 0;
for (int i = 0; i < GRIDS_CNT; i++)
total += grid(i).cache(null).localSize(CachePeekMode.PRIMARY);
- assertEquals(KEYS_CNT, total);
+ assertEquals("Data lost.", KEYS_CNT, total);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7499828/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLoadingConcurrentGridStartSelfTestAllowOverwrite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLoadingConcurrentGridStartSelfTestAllowOverwrite.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLoadingConcurrentGridStartSelfTestAllowOverwrite.java
new file mode 100644
index 0000000..c9cd9fa
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLoadingConcurrentGridStartSelfTestAllowOverwrite.java
@@ -0,0 +1,30 @@
+/*
+ * 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;
+
+/**
+ *
+ */
+public class CacheLoadingConcurrentGridStartSelfTestAllowOverwrite extends CacheLoadingConcurrentGridStartSelfTest {
+ /**
+ * Default constructor.
+ */
+ public CacheLoadingConcurrentGridStartSelfTestAllowOverwrite() {
+ allowOverwrite = true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7499828/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorSelfTest.java
index 9fedc35..0f8ae29 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorSelfTest.java
@@ -29,9 +29,9 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import javax.cache.Cache;
+import javax.cache.CacheException;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
-import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteDataStreamer;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.CachePeekMode;
@@ -194,7 +194,7 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
assert false;
}
- catch (IgniteCheckedException e) {
+ catch (CacheException e) {
// Cannot load local cache configured remotely.
info("Caught expected exception: " + e);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7499828/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImplSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImplSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImplSelfTest.java
index 0c6686f..a6a9f54 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImplSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImplSelfTest.java
@@ -22,13 +22,17 @@ import java.util.Map;
import java.util.Random;
import java.util.concurrent.Callable;
import java.util.concurrent.CyclicBarrier;
+import javax.cache.CacheException;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.cache.CacheServerNotFoundException;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
@@ -50,6 +54,16 @@ public class DataStreamerImplSelfTest extends GridCommonAbstractTest {
/** Started grid counter. */
private static int cnt;
+ /** No nodes filter. */
+ private static volatile boolean noNodesFilter;
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ super.afterTest();
+
+ stopAllGrids();
+ }
+
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
@@ -72,88 +86,149 @@ public class DataStreamerImplSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testNullPointerExceptionUponDataStreamerClosing() throws Exception {
- try {
- startGrids(5);
+ startGrids(5);
- final CyclicBarrier barrier = new CyclicBarrier(2);
+ final CyclicBarrier barrier = new CyclicBarrier(2);
- multithreadedAsync(new Callable<Object>() {
- @Override public Object call() throws Exception {
- U.awaitQuiet(barrier);
+ multithreadedAsync(new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ U.awaitQuiet(barrier);
- G.stopAll(true);
+ G.stopAll(true);
- return null;
- }
- }, 1);
+ return null;
+ }
+ }, 1);
- Ignite g4 = grid(4);
+ Ignite g4 = grid(4);
- IgniteDataStreamer<Object, Object> dataLdr = g4.dataStreamer(null);
+ IgniteDataStreamer<Object, Object> dataLdr = g4.dataStreamer(null);
- dataLdr.perNodeBufferSize(32);
+ dataLdr.perNodeBufferSize(32);
- for (int i = 0; i < 100000; i += 2) {
- dataLdr.addData(i, i);
- dataLdr.removeData(i + 1);
- }
+ for (int i = 0; i < 100000; i += 2) {
+ dataLdr.addData(i, i);
+ dataLdr.removeData(i + 1);
+ }
- U.awaitQuiet(barrier);
+ U.awaitQuiet(barrier);
- info("Closing data streamer.");
+ info("Closing data streamer.");
- try {
- dataLdr.close(true);
- }
- catch (IllegalStateException ignore) {
- // This is ok to ignore this exception as test is racy by it's nature -
- // grid is stopping in different thread.
- }
+ try {
+ dataLdr.close(true);
}
- finally {
- G.stopAll(true);
+ catch (CacheException | IllegalStateException ignore) {
+ // This is ok to ignore this exception as test is racy by it's nature -
+ // grid is stopping in different thread.
}
}
/**
* Data streamer should correctly load entries from HashMap in case of grids with more than one node
- * and with GridOptimizedMarshaller that requires serializable.
+ * and with GridOptimizedMarshaller that requires serializable.
*
* @throws Exception If failed.
*/
public void testAddDataFromMap() throws Exception {
- try {
- cnt = 0;
+ cnt = 0;
- startGrids(2);
+ startGrids(2);
- Ignite g0 = grid(0);
+ Ignite g0 = grid(0);
- IgniteDataStreamer<Integer, String> dataLdr = g0.dataStreamer(null);
+ IgniteDataStreamer<Integer, String> dataLdr = g0.dataStreamer(null);
- Map<Integer, String> map = U.newHashMap(KEYS_COUNT);
+ Map<Integer, String> map = U.newHashMap(KEYS_COUNT);
- for (int i = 0; i < KEYS_COUNT; i ++)
- map.put(i, String.valueOf(i));
+ for (int i = 0; i < KEYS_COUNT; i++)
+ map.put(i, String.valueOf(i));
- dataLdr.addData(map);
+ dataLdr.addData(map);
- dataLdr.close();
+ dataLdr.close();
- Random rnd = new Random();
+ Random rnd = new Random();
- IgniteCache<Integer, String> c = g0.cache(null);
+ IgniteCache<Integer, String> c = g0.cache(null);
- for (int i = 0; i < KEYS_COUNT; i ++) {
- Integer k = rnd.nextInt(KEYS_COUNT);
+ for (int i = 0; i < KEYS_COUNT; i++) {
+ Integer k = rnd.nextInt(KEYS_COUNT);
- String v = c.get(k);
+ String v = c.get(k);
+
+ assertEquals(k.toString(), v);
+ }
+ }
+
+ /**
+ * Test logging on {@code DataStreamer.addData()} method when cache have no data nodes
+ *
+ * @throws Exception If fail.
+ */
+ public void testNoDataNodesOnClose() throws Exception {
+ boolean failed = false;
+
+ cnt = 0;
+
+ noNodesFilter = true;
+
+ try {
+ Ignite ignite = startGrid(1);
- assertEquals(k.toString(), v);
+ try (IgniteDataStreamer<Integer, String> streamer = ignite.dataStreamer(null)) {
+ streamer.addData(1, "1");
+ }
+ catch (CacheException ex) {
+ failed = true;
}
}
finally {
- G.stopAll(true);
+ noNodesFilter = false;
+
+ assertTrue(failed);
+ }
+ }
+
+ /**
+ * Test logging on {@code DataStreamer.addData()} method when cache have no data nodes
+ *
+ * @throws Exception If fail.
+ */
+ public void testNoDataNodesOnFlush() throws Exception {
+ boolean failed = false;
+
+ cnt = 0;
+
+ noNodesFilter = true;
+
+ try {
+ Ignite ignite = startGrid(1);
+
+ IgniteFuture fut = null;
+
+ try (IgniteDataStreamer<Integer, String> streamer = ignite.dataStreamer(null)) {
+ fut = streamer.addData(1, "1");
+
+ streamer.flush();
+ }
+ catch (IllegalStateException ex) {
+ try {
+ fut.get();
+
+ fail("DataStreamer ignores failed streaming.");
+ }
+ catch (CacheServerNotFoundException ignored) {
+ // No-op.
+ }
+
+ failed = true;
+ }
+ }
+ finally {
+ noNodesFilter = false;
+
+ assertTrue(failed);
}
}
@@ -169,6 +244,9 @@ public class DataStreamerImplSelfTest extends GridCommonAbstractTest {
cacheCfg.setBackups(1);
cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
+ if (noNodesFilter)
+ cacheCfg.setNodeFilter(F.alwaysFalse());
+
return cacheCfg;
}
[29/50] [abbrv] ignite git commit: Merged ignite-1.7.3 into
ignite-1.7.4.
Posted by sb...@apache.org.
Merged ignite-1.7.3 into ignite-1.7.4.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3eacc0b5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3eacc0b5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3eacc0b5
Branch: refs/heads/master
Commit: 3eacc0b59c27be6b4b3aaa09f84b867ba42b449f
Parents: e39888a f8aa957
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Mon Nov 21 17:28:56 2016 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Mon Nov 21 17:28:56 2016 +0700
----------------------------------------------------------------------
.../hadoop/fs/v1/IgniteHadoopFileSystem.java | 2 +-
.../hadoop/fs/v2/IgniteHadoopFileSystem.java | 2 +-
.../hadoop/delegate/HadoopDelegateUtils.java | 4 ++--
...doopIgfsSecondaryFileSystemDelegateImpl.java | 3 +--
...KerberosHadoopFileSystemFactorySelfTest.java | 3 ++-
.../igfs/HadoopFIleSystemFactorySelfTest.java | 2 +-
...adoopIgfsSecondaryFileSystemTestAdapter.java | 3 +--
...oopSecondaryFileSystemConfigurationTest.java | 4 ++--
.../h2/twostep/GridReduceQueryExecutor.java | 25 ++++++++++++++------
pom.xml | 1 +
10 files changed, 30 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
[39/50] [abbrv] ignite git commit: Merged ignite-1.6.11 into
ignite-1.7.4.
Posted by sb...@apache.org.
Merged ignite-1.6.11 into ignite-1.7.4.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f2dc1d71
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f2dc1d71
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f2dc1d71
Branch: refs/heads/master
Commit: f2dc1d71705b86428a04a69c4f2d4ee3a82ed1bd
Parents: 551f90d 6e36a79
Author: sboikov <sb...@gridgain.com>
Authored: Mon Nov 21 18:12:27 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Nov 21 18:12:27 2016 +0300
----------------------------------------------------------------------
bin/ignite.bat | 5 +
.../org/apache/ignite/IgniteDataStreamer.java | 2 +-
.../apache/ignite/IgniteSystemProperties.java | 13 +
.../internal/ComputeTaskInternalFuture.java | 11 +
.../internal/binary/BinaryClassDescriptor.java | 37 +-
.../ignite/internal/binary/BinaryContext.java | 13 +-
.../internal/binary/BinaryObjectExImpl.java | 57 +-
.../internal/binary/BinaryObjectImpl.java | 23 +
.../binary/BinaryObjectOffheapImpl.java | 24 +-
.../ignite/internal/binary/BinaryUtils.java | 4 +
.../binary/builder/BinaryObjectBuilderImpl.java | 6 +-
.../processors/affinity/AffinityAssignment.java | 88 +++
.../affinity/GridAffinityAssignment.java | 8 +-
.../affinity/GridAffinityAssignmentCache.java | 35 +-
.../affinity/GridAffinityProcessor.java | 89 ++-
.../processors/affinity/GridAffinityUtils.java | 8 +-
.../affinity/HistoryAffinityAssignment.java | 169 ++++++
.../cache/CacheAffinitySharedManager.java | 57 +-
.../cache/DynamicCacheChangeBatch.java | 7 +
.../cache/GridCacheAffinityManager.java | 6 +-
.../processors/cache/GridCacheContext.java | 8 +
.../processors/cache/GridCacheMapEntry.java | 5 +-
.../processors/cache/GridCacheMvccManager.java | 77 +++
.../GridCachePartitionExchangeManager.java | 299 +++++++--
.../processors/cache/GridCacheProcessor.java | 5 +-
.../cache/GridCacheSharedContext.java | 1 +
.../processors/cache/GridCacheUtils.java | 67 --
.../dht/GridClientPartitionTopology.java | 33 +-
.../dht/GridDhtPartitionTopology.java | 3 +-
.../dht/GridDhtPartitionTopologyImpl.java | 31 +-
.../dht/preloader/GridDhtPartitionFullMap.java | 18 +
.../dht/preloader/GridDhtPartitionMap2.java | 53 +-
.../GridDhtPartitionsAbstractMessage.java | 40 +-
.../GridDhtPartitionsExchangeFuture.java | 84 +--
.../preloader/GridDhtPartitionsFullMessage.java | 150 ++++-
.../GridDhtPartitionsSingleMessage.java | 132 +++-
.../GridDhtPartitionsSingleRequest.java | 4 +-
.../dht/preloader/GridDhtPreloader.java | 4 +-
.../query/GridCacheQueryMetricsAdapter.java | 2 +-
.../continuous/GridContinuousProcessor.java | 4 +-
.../datastreamer/DataStreamProcessor.java | 104 +++-
.../datastreamer/DataStreamerImpl.java | 607 ++++++++++++++-----
.../internal/processors/igfs/IgfsProcessor.java | 15 +
.../ignite/internal/util/GridLogThrottle.java | 29 +-
.../ignite/internal/util/IgniteUtils.java | 111 +++-
.../internal/util/future/GridFutureAdapter.java | 12 +-
.../util/offheap/unsafe/GridUnsafeMemory.java | 33 +-
.../visor/misc/VisorResolveHostNameTask.java | 4 +-
.../security/SecurityBasicPermissionSet.java | 107 ++++
.../security/SecurityPermissionSetBuilder.java | 222 +++++++
.../ignite/spi/discovery/tcp/ClientImpl.java | 38 +-
.../ignite/spi/discovery/tcp/ServerImpl.java | 510 +++++++++++++---
.../spi/discovery/tcp/TcpDiscoveryImpl.java | 59 +-
.../messages/TcpDiscoveryAbstractMessage.java | 7 +
.../messages/TcpDiscoveryClientAckResponse.java | 5 +
.../TcpDiscoveryClientHeartbeatMessage.java | 7 +-
.../TcpDiscoveryConnectionCheckMessage.java | 5 +
.../messages/TcpDiscoveryHeartbeatMessage.java | 5 +
.../TcpDiscoveryNodeAddFinishedMessage.java | 11 +
.../messages/TcpDiscoveryNodeAddedMessage.java | 33 +-
.../binary/BinaryMarshallerSelfTest.java | 343 ++++++++++-
...CacheExchangeMessageDuplicatedStateTest.java | 393 ++++++++++++
.../cache/IgniteCacheDynamicStopSelfTest.java | 48 +-
.../cache/IgniteCachePeekModesAbstractTest.java | 2 +-
...CacheLoadingConcurrentGridStartSelfTest.java | 251 +++++++-
...ncurrentGridStartSelfTestAllowOverwrite.java | 30 +
.../distributed/IgniteCacheGetRestartTest.java | 3 +
...cingDelayedPartitionMapExchangeSelfTest.java | 8 +-
.../GridCacheRebalancingSyncSelfTest.java | 18 +-
.../GridCacheSyncReplicatedPreloadSelfTest.java | 3 -
.../IgniteCacheSyncRebalanceModeSelfTest.java | 2 +-
...ContinuousQueryFailoverAbstractSelfTest.java | 2 +-
...ComputeJobExecutionErrorToLogManualTest.java | 88 +++
.../IgniteNoCustomEventsOnNodeStart.java | 7 +
.../DataStreamProcessorSelfTest.java | 4 +-
.../datastreamer/DataStreamerImplSelfTest.java | 170 ++++--
.../DataStreamerMultiThreadedSelfTest.java | 2 -
.../datastreamer/DataStreamerTimeoutTest.java | 92 ++-
.../igfs/IgfsProcessorValidationSelfTest.java | 30 +
...IpcEndpointRegistrationAbstractSelfTest.java | 76 ++-
...dpointRegistrationOnLinuxAndMacSelfTest.java | 11 +-
.../SecurityPermissionSetBuilderTest.java | 110 ++++
.../spi/discovery/tcp/TcpDiscoverySelfTest.java | 134 +++-
.../junits/common/GridCommonAbstractTest.java | 25 +-
.../ignite/testsuites/IgniteBasicTestSuite.java | 3 +
.../testsuites/IgniteCacheTestSuite2.java | 5 +
...opClientProtocolMultipleServersSelfTest.java | 102 ++--
.../query/h2/GridH2ResultSetIterator.java | 62 +-
.../processors/query/h2/IgniteH2Indexing.java | 4 +-
.../query/h2/opt/GridH2ValueCacheObject.java | 10 +-
.../query/h2/twostep/GridMapQueryExecutor.java | 34 +-
.../query/h2/twostep/GridMergeIndex.java | 49 +-
.../h2/twostep/GridReduceQueryExecutor.java | 2 +-
.../cache/CacheSqlQueryValueCopySelfTest.java | 226 +++++++
.../cache/IgniteCacheOffheapEvictQueryTest.java | 7 +
.../IgniteCacheQueryMultiThreadedSelfTest.java | 59 ++
...lientQueryReplicatedNodeRestartSelfTest.java | 7 +
...butedQueryStopOnCancelOrTimeoutSelfTest.java | 7 +
.../query/IgniteSqlSplitterSelfTest.java | 2 +
.../query/h2/sql/GridQueryParsingTest.java | 11 +-
.../IgniteCacheQuerySelfTestSuite2.java | 2 +
modules/platforms/cpp/DEVNOTES.txt | 22 +-
modules/platforms/cpp/README.txt | 10 +-
modules/platforms/cpp/binary/Makefile.am | 4 +-
.../cpp/binary/project/vs/binary.vcxproj | 2 -
.../cpp/common/project/vs/common.vcxproj | 1 -
modules/platforms/cpp/core/Makefile.am | 4 +-
.../platforms/cpp/core/project/vs/core.vcxproj | 2 -
modules/platforms/cpp/examples/README.txt | 9 +-
.../cpp/examples/odbc-example/Makefile.am | 4 +-
.../cpp/examples/putget-example/Makefile.am | 4 +-
.../cpp/examples/query-example/Makefile.am | 4 +-
modules/platforms/cpp/ignite/Makefile.am | 4 +-
.../cpp/ignite/project/vs/ignite.vcxproj | 4 +-
modules/platforms/cpp/jni/Makefile.am | 4 +-
.../platforms/cpp/jni/project/vs/jni.vcxproj | 1 -
.../platforms/cpp/odbc-test/include/test_type.h | 42 +-
.../cpp/odbc-test/src/api_robustness_test.cpp | 63 ++
.../cpp/odbc-test/src/queries_test.cpp | 153 ++++-
.../cpp/odbc-test/src/sql_outer_join_test.cpp | 2 +-
modules/platforms/cpp/odbc/Makefile.am | 4 +-
modules/platforms/cpp/odbc/README.txt | 23 +-
.../cpp/odbc/include/ignite/odbc/statement.h | 42 ++
.../cpp/odbc/install/ignite-odbc-amd64.wxs | 114 ++++
.../cpp/odbc/install/ignite-odbc-x86.wxs | 114 ++++
.../platforms/cpp/odbc/project/vs/odbc.vcxproj | 4 +-
.../odbc/src/app/application_data_buffer.cpp | 34 +-
modules/platforms/cpp/odbc/src/odbc.cpp | 116 +---
modules/platforms/cpp/odbc/src/statement.cpp | 151 +++++
.../Dataload/DataStreamerTestTopologyChange.cs | 27 +-
.../Apache.Ignite.Core/Impl/PlatformTarget.cs | 2 +-
.../src/test/config/incorrect-store-cache.xml | 2 +
.../src/test/config/jdbc-pojo-store-builtin.xml | 3 +
.../src/test/config/jdbc-pojo-store-obj.xml | 3 +
modules/spring/src/test/config/node.xml | 2 +
modules/spring/src/test/config/node1.xml | 2 +
.../test/config/pojo-incorrect-store-cache.xml | 2 +
modules/spring/src/test/config/store-cache.xml | 2 +
modules/spring/src/test/config/store-cache1.xml | 2 +
.../IgniteStartFromStreamConfigurationTest.java | 18 +-
pom.xml | 8 +
141 files changed, 5973 insertions(+), 1091 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2dc1d71/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2dc1d71/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityManager.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2dc1d71/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2dc1d71/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2dc1d71/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2dc1d71/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
index 558a654,f3751ac..ab573bd
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
@@@ -1475,10 -1507,25 +1478,25 @@@ class GridDhtPartitionTopologyImpl impl
lock.readLock().lock();
try {
- Map<Integer, Long> res = new HashMap<>(cntrMap);
+ Map<Integer, Long> res;
+
+ if (skipZeros) {
+ res = U.newHashMap(cntrMap.size());
+
+ for (Map.Entry<Integer, Long> e : cntrMap.entrySet()) {
+ Long cntr = e.getValue();
+
+ if (ZERO.equals(cntr))
+ continue;
+
+ res.put(e.getKey(), cntr);
+ }
+ }
+ else
+ res = new HashMap<>(cntrMap);
- for (int i = 0; i < locParts.length; i++) {
- GridDhtLocalPartition part = locParts[i];
+ for (int i = 0; i < locParts.length(); i++) {
+ GridDhtLocalPartition part = locParts.get(i);
if (part == null)
continue;
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2dc1d71/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2dc1d71/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryMetricsAdapter.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2dc1d71/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2dc1d71/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2dc1d71/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2dc1d71/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java
----------------------------------------------------------------------
diff --cc modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java
index cb83a73,d6e0743..0805be1
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java
@@@ -86,14 -88,25 +86,27 @@@ public class HadoopClientProtocolMultip
}
/** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- super.beforeTest();
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
- clearConnectionMap();
+ clearClients();
+
+ super.afterTest();
}
+ /**
+ * @throws IgniteCheckedException If failed.
+ */
+ private void clearConnectionMap() throws IgniteCheckedException {
+ ConcurrentHashMap<String, IgniteInternalFuture<GridClient>> cliMap =
+ GridTestUtils.getFieldValue(IgniteHadoopClientProtocolProvider.class, "cliMap");
+
+ for(IgniteInternalFuture<GridClient> fut : cliMap.values())
+ fut.get().close();
+
+ cliMap.clear();
+ }
+
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2dc1d71/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2dc1d71/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2ValueCacheObject.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2dc1d71/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
----------------------------------------------------------------------
diff --cc modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
index 0314b3d,7e4d5b6..ac1a6a6
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMapQueryExecutor.java
@@@ -56,9 -52,7 +56,10 @@@ import org.apache.ignite.internal.proce
import org.apache.ignite.internal.processors.cache.query.GridCacheSqlQuery;
import org.apache.ignite.internal.processors.query.GridQueryCancel;
import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
+import org.apache.ignite.internal.processors.query.h2.opt.GridH2QueryContext;
+import org.apache.ignite.internal.processors.query.h2.opt.GridH2RetryException;
+import org.apache.ignite.internal.processors.query.h2.opt.GridH2Table;
+ import org.apache.ignite.internal.processors.query.h2.opt.GridH2ValueCacheObject;
import org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryCancelRequest;
import org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryFailResponse;
import org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryNextPageRequest;
@@@ -933,9 -757,12 +934,12 @@@ public class GridMapQueryExecutor
private int page;
/** */
- private final int rowCount;
+ private final int rowCnt;
/** */
+ private boolean cpNeeded;
+
+ /** */
private volatile boolean closed;
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2dc1d71/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridMergeIndex.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2dc1d71/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2dc1d71/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest.java
----------------------------------------------------------------------
diff --cc modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest.java
index a92bf2b,072a081..80c4a08
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest.java
@@@ -96,9 -95,16 +96,16 @@@ public class IgniteCacheDistributedQuer
g.cache(null).removeAll();
}
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ stopAllGrids();
+
+ super.afterTestsStopped();
+ }
+
/** */
public void testRemoteQueryExecutionTimeout() throws Exception {
- testQuery(CACHE_SIZE, VAL_SIZE, QUERY_1, 500, TimeUnit.MILLISECONDS, true);
+ testQueryCancel(CACHE_SIZE, VAL_SIZE, QRY_1, 500, TimeUnit.MILLISECONDS, true);
}
/** */
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2dc1d71/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
----------------------------------------------------------------------
diff --cc modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
index 50f2ef0,56658df..e72c9cb
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
@@@ -30,12 -28,9 +30,14 @@@ import javax.cache.CacheException
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheKeyConfiguration;
import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.CachePeekMode;
+import org.apache.ignite.cache.affinity.AffinityKeyMapped;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cache.query.QueryCursor;
+ import org.apache.ignite.cache.affinity.Affinity;
+ import org.apache.ignite.cache.query.QueryCursor;
import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.cluster.ClusterNode;
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2dc1d71/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2dc1d71/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite2.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2dc1d71/modules/platforms/cpp/examples/README.txt
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2dc1d71/modules/platforms/cpp/odbc-test/src/queries_test.cpp
----------------------------------------------------------------------
diff --cc modules/platforms/cpp/odbc-test/src/queries_test.cpp
index 21edf4e,a7fc7a9..db9dafb
--- a/modules/platforms/cpp/odbc-test/src/queries_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/queries_test.cpp
@@@ -314,14 -294,9 +316,14 @@@ BOOST_AUTO_TEST_CASE(TestConnectionProt
Connect("DRIVER={Apache Ignite};ADDRESS=127.0.0.1:11110;CACHE=cache;PROTOCOL_VERSION=1.6.0");
}
+BOOST_AUTO_TEST_CASE(TestConnectionProtocolVersion_1_8_0)
+{
+ Connect("DRIVER={Apache Ignite};ADDRESS=127.0.0.1:11110;CACHE=cache;PROTOCOL_VERSION=1.8.0");
+}
+
BOOST_AUTO_TEST_CASE(TestTwoRowsInt8)
{
- CheckTwoRowsInt<int8_t>(SQL_C_STINYINT);
+ CheckTwoRowsInt<signed char>(SQL_C_STINYINT);
}
BOOST_AUTO_TEST_CASE(TestTwoRowsUint8)
@@@ -693,131 -674,115 +701,242 @@@ BOOST_AUTO_TEST_CASE(TestDataAtExecutio
BOOST_CHECK(ret == SQL_NO_DATA);
}
+ BOOST_AUTO_TEST_CASE(TestNullFields)
+ {
+ Connect("DRIVER={Apache Ignite};ADDRESS=127.0.0.1:11110;CACHE=cache");
+
+ SQLRETURN ret;
+
+ TestType in(1, 2, 3, 4, "5", 6.0f, 7.0, true, Guid(8, 9), BinaryUtils::MakeDateGmt(1987, 6, 5),
+ BinaryUtils::MakeTimestampGmt(1998, 12, 27, 1, 2, 3, 456));
+
+ TestType inNull;
+
+ inNull.allNulls = true;
+
+ testCache.Put(1, in);
+ testCache.Put(2, inNull);
+ testCache.Put(3, in);
+
+ const size_t columnsCnt = 10;
+
+ SQLLEN columnLens[columnsCnt] = { 0 };
+
+ int8_t i8Column;
+ int16_t i16Column;
+ int32_t i32Column;
+ int64_t i64Column;
+ char strColumn[ODBC_BUFFER_SIZE];
+ float floatColumn;
+ double doubleColumn;
+ bool boolColumn;
+ SQL_DATE_STRUCT dateColumn;
+ SQL_TIMESTAMP_STRUCT timestampColumn;
+
+ // Binding columns.
+ ret = SQLBindCol(stmt, 1, SQL_C_STINYINT, &i8Column, 0, &columnLens[0]);
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ ret = SQLBindCol(stmt, 2, SQL_C_SSHORT, &i16Column, 0, &columnLens[1]);
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ ret = SQLBindCol(stmt, 3, SQL_C_SLONG, &i32Column, 0, &columnLens[2]);
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ ret = SQLBindCol(stmt, 4, SQL_C_SBIGINT, &i64Column, 0, &columnLens[3]);
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ ret = SQLBindCol(stmt, 5, SQL_C_CHAR, &strColumn, ODBC_BUFFER_SIZE, &columnLens[4]);
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ ret = SQLBindCol(stmt, 6, SQL_C_FLOAT, &floatColumn, 0, &columnLens[5]);
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ ret = SQLBindCol(stmt, 7, SQL_C_DOUBLE, &doubleColumn, 0, &columnLens[6]);
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ ret = SQLBindCol(stmt, 8, SQL_C_BIT, &boolColumn, 0, &columnLens[7]);
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ ret = SQLBindCol(stmt, 9, SQL_C_DATE, &dateColumn, 0, &columnLens[8]);
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ ret = SQLBindCol(stmt, 10, SQL_C_TIMESTAMP, ×tampColumn, 0, &columnLens[9]);
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ SQLCHAR request[] = "SELECT i8Field, i16Field, i32Field, i64Field, strField, "
+ "floatField, doubleField, boolField, dateField, timestampField FROM TestType ORDER BY _key";
+
+ ret = SQLExecDirect(stmt, request, SQL_NTS);
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ // Fetching the first non-null row.
+ ret = SQLFetch(stmt);
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ // Checking that columns are not null.
+ for (SQLSMALLINT i = 0; i < columnsCnt; ++i)
+ BOOST_CHECK_NE(columnLens[i], SQL_NULL_DATA);
+
+ // Fetching null row.
+ ret = SQLFetch(stmt);
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ // Checking that columns are null.
+ for (SQLSMALLINT i = 0; i < columnsCnt; ++i)
+ BOOST_CHECK_EQUAL(columnLens[i], SQL_NULL_DATA);
+
+ // Fetching the last non-null row.
+ ret = SQLFetch(stmt);
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ // Checking that columns are not null.
+ for (SQLSMALLINT i = 0; i < columnsCnt; ++i)
+ BOOST_CHECK_NE(columnLens[i], SQL_NULL_DATA);
+
+ ret = SQLFetch(stmt);
+ BOOST_CHECK(ret == SQL_NO_DATA);
+ }
+
++
+BOOST_AUTO_TEST_CASE(TestDistributedJoins)
+{
+ // Starting additional node.
+ Ignite node1 = StartAdditionalNode("Node1");
+ Ignite node2 = StartAdditionalNode("Node2");
+
+ const int entriesNum = 1000;
+
+ // Filling cache with data.
+ for (int i = 0; i < entriesNum; ++i)
+ {
+ TestType entry;
+
+ entry.i32Field = i;
+ entry.i64Field = entriesNum - i - 1;
+
+ testCache.Put(i, entry);
+ }
+
+ Connect("DRIVER={Apache Ignite};ADDRESS=127.0.0.1:11110;CACHE=cache");
+
+ SQLRETURN ret;
+
+ const size_t columnsCnt = 2;
+
+ SQLBIGINT columns[columnsCnt] = { 0 };
+
+ // Binding colums.
+ for (SQLSMALLINT i = 0; i < columnsCnt; ++i)
+ {
+ ret = SQLBindCol(stmt, i + 1, SQL_C_SLONG, &columns[i], 0, 0);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+ }
+
+ SQLCHAR request[] =
+ "SELECT T0.i32Field, T1.i64Field FROM TestType AS T0 "
+ "INNER JOIN TestType AS T1 "
+ "ON (T0.i32Field = T1.i64Field)";
+
+ ret = SQLExecDirect(stmt, request, SQL_NTS);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ int rowsNum = CountRows(stmt);
+
+ BOOST_CHECK_GT(rowsNum, 0);
+ BOOST_CHECK_LT(rowsNum, entriesNum);
+
+ Disconnect();
+
+ Connect("DRIVER={Apache Ignite};ADDRESS=127.0.0.1:11110;CACHE=cache;DISTRIBUTED_JOINS=true;");
+
+ // Binding colums.
+ for (SQLSMALLINT i = 0; i < columnsCnt; ++i)
+ {
+ ret = SQLBindCol(stmt, i + 1, SQL_C_SLONG, &columns[i], 0, 0);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+ }
+
+ ret = SQLExecDirect(stmt, request, SQL_NTS);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ rowsNum = CountRows(stmt);
+
+ BOOST_CHECK_EQUAL(rowsNum, entriesNum);
+}
+
+BOOST_AUTO_TEST_CASE(TestDistributedJoinsWithOldVersion)
+{
+ // Starting additional node.
+ Ignite node1 = StartAdditionalNode("Node1");
+ Ignite node2 = StartAdditionalNode("Node2");
+
+ const int entriesNum = 1000;
+
+ // Filling cache with data.
+ for (int i = 0; i < entriesNum; ++i)
+ {
+ TestType entry;
+
+ entry.i32Field = i;
+ entry.i64Field = entriesNum - i - 1;
+
+ testCache.Put(i, entry);
+ }
+
+ Connect("DRIVER={Apache Ignite};ADDRESS=127.0.0.1:11110;CACHE=cache;DISTRIBUTED_JOINS=true;PROTOCOL_VERSION=1.6.0");
+
+ SQLRETURN ret;
+
+ const size_t columnsCnt = 2;
+
+ SQLBIGINT columns[columnsCnt] = { 0 };
+
+ // Binding colums.
+ for (SQLSMALLINT i = 0; i < columnsCnt; ++i)
+ {
+ ret = SQLBindCol(stmt, i + 1, SQL_C_SLONG, &columns[i], 0, 0);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+ }
+
+ SQLCHAR request[] =
+ "SELECT T0.i32Field, T1.i64Field FROM TestType AS T0 "
+ "INNER JOIN TestType AS T1 "
+ "ON (T0.i32Field = T1.i64Field)";
+
+ ret = SQLExecDirect(stmt, request, SQL_NTS);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ int rowsNum = CountRows(stmt);
+
+ BOOST_CHECK_GT(rowsNum, 0);
+ BOOST_CHECK_LT(rowsNum, entriesNum);
+}
+
-
BOOST_AUTO_TEST_SUITE_END()
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2dc1d71/modules/platforms/cpp/odbc/project/vs/odbc.vcxproj
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2dc1d71/modules/platforms/cpp/odbc/src/odbc.cpp
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2dc1d71/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
----------------------------------------------------------------------
diff --cc modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
index bafc759,f7906ff..f4a07f6
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
@@@ -483,82 -483,7 +483,82 @@@ namespace Apache.Ignite.Core.Imp
}
}
}
-
+
+ /// <summary>
+ /// Perform out-in operation with a single stream.
+ /// </summary>
+ /// <typeparam name="TR">The type of the r.</typeparam>
+ /// <param name="type">Operation type.</param>
+ /// <param name="outAction">Out action.</param>
+ /// <param name="inAction">In action.</param>
+ /// <param name="inErrorAction">The action to read an error.</param>
+ /// <returns>
+ /// Result.
+ /// </returns>
+ protected TR DoOutInOpX<TR>(int type, Action<BinaryWriter> outAction, Func<IBinaryStream, long, TR> inAction,
+ Func<IBinaryStream, Exception> inErrorAction)
+ {
+ Debug.Assert(inErrorAction != null);
+
+ using (var stream = IgniteManager.Memory.Allocate().GetStream())
+ {
+ var writer = _marsh.StartMarshal(stream);
+
+ outAction(writer);
+
+ FinishMarshal(writer);
+
+ var res = UU.TargetInStreamOutLong(_target, type, stream.SynchronizeOutput());
+
+ if (res != Error && inAction == null)
+ return default(TR); // quick path for void operations
+
+ stream.SynchronizeInput();
+
+ stream.Seek(0, SeekOrigin.Begin);
+
+ if (res != Error)
+ return inAction != null ? inAction(stream, res) : default(TR);
+
+ throw inErrorAction(stream);
+ }
+ }
+
+ /// <summary>
+ /// Perform out-in operation with a single stream.
+ /// </summary>
+ /// <param name="type">Operation type.</param>
+ /// <param name="outAction">Out action.</param>
+ /// <param name="inErrorAction">The action to read an error.</param>
+ /// <returns>
+ /// Result.
+ /// </returns>
- protected bool DoOutInOpX(int type, Action<BinaryWriter> outAction,
++ protected bool DoOutInOpX(int type, Action<BinaryWriter> outAction,
+ Func<IBinaryStream, Exception> inErrorAction)
+ {
+ Debug.Assert(inErrorAction != null);
+
+ using (var stream = IgniteManager.Memory.Allocate().GetStream())
+ {
+ var writer = _marsh.StartMarshal(stream);
+
+ outAction(writer);
+
+ FinishMarshal(writer);
+
+ var res = UU.TargetInStreamOutLong(_target, type, stream.SynchronizeOutput());
+
+ if (res != Error)
+ return res == True;
+
+ stream.SynchronizeInput();
+
+ stream.Seek(0, SeekOrigin.Begin);
+
+ throw inErrorAction(stream);
+ }
+ }
+
/// <summary>
/// Perform out-in operation.
/// </summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f2dc1d71/pom.xml
----------------------------------------------------------------------
[38/50] [abbrv] ignite git commit: Merge remote-tracking branch
'community/ignite-1.7.4' into ignite-1.7.4
Posted by sb...@apache.org.
Merge remote-tracking branch 'community/ignite-1.7.4' into ignite-1.7.4
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/551f90db
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/551f90db
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/551f90db
Branch: refs/heads/master
Commit: 551f90dbeebcad35a0e3aac07229fb67578f2ab7
Parents: 6e4a279 51ca24f
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Mon Nov 21 19:16:49 2016 +0500
Committer: tledkov-gridgain <tl...@gridgain.com>
Committed: Mon Nov 21 19:16:49 2016 +0500
----------------------------------------------------------------------
.../communication/GridIoMessageFactory.java | 10 +-
.../processors/cache/GridCacheIoManager.java | 25 +-
.../GridDhtAtomicAbstractUpdateFuture.java | 57 +-
.../GridDhtAtomicAbstractUpdateRequest.java | 287 ++++++++
.../dht/atomic/GridDhtAtomicCache.java | 17 +-
.../atomic/GridDhtAtomicSingleUpdateFuture.java | 61 ++
.../GridDhtAtomicSingleUpdateRequest.java | 678 +++++++++++++++++++
.../dht/atomic/GridDhtAtomicUpdateFuture.java | 26 +
.../dht/atomic/GridDhtAtomicUpdateRequest.java | 312 +++------
.../GridNearAtomicAbstractUpdateRequest.java | 5 +
.../atomic/GridNearAtomicFullUpdateRequest.java | 108 +--
.../GridNearAtomicSingleUpdateRequest.java | 5 +
.../distributed/near/GridNearAtomicCache.java | 8 +-
.../GridCacheAtomicMessageCountSelfTest.java | 6 +-
...eAtomicInvalidPartitionHandlingSelfTest.java | 2 +-
15 files changed, 1292 insertions(+), 315 deletions(-)
----------------------------------------------------------------------
[47/50] [abbrv] ignite git commit: IGNITE-4100: Fix for DEVNOTES
paths.
Posted by sb...@apache.org.
IGNITE-4100: Fix for DEVNOTES paths.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c34d2742
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c34d2742
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c34d2742
Branch: refs/heads/master
Commit: c34d27423a0c45c61341c1fcb3f56727fb91498f
Parents: ba99df1
Author: Igor Sapego <is...@gridgain.com>
Authored: Tue Nov 22 14:13:28 2016 +0300
Committer: Igor Sapego <is...@gridgain.com>
Committed: Tue Nov 22 14:13:28 2016 +0300
----------------------------------------------------------------------
modules/platforms/cpp/DEVNOTES.txt | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c34d2742/modules/platforms/cpp/DEVNOTES.txt
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/DEVNOTES.txt b/modules/platforms/cpp/DEVNOTES.txt
index 5d0b2eb..473af23 100644
--- a/modules/platforms/cpp/DEVNOTES.txt
+++ b/modules/platforms/cpp/DEVNOTES.txt
@@ -5,7 +5,8 @@ stand-alone node binary. To build examples you need to build and install core Ap
Ignite library then refer to $IGNITE_HOME/platforms/cpp/example/README.txt for
further instructions.
-For details on ODBC driver installation and usage please refer to odbc/README.txt.
+For details on ODBC driver installation and usage please refer to
+$IGNITE_HOME/platforms/cpp/odbc/README.txt.
Building on Linux With Autotools
----------------------------------
[25/50] [abbrv] ignite git commit: Fixed
IgniteStartFromStreamConfigurationTest to stop started node.
Posted by sb...@apache.org.
Fixed IgniteStartFromStreamConfigurationTest to stop started node.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a2a3bedc
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a2a3bedc
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a2a3bedc
Branch: refs/heads/master
Commit: a2a3bedce1a232c0c1db6f5e2b737ab47be250b0
Parents: c3e8a83
Author: sboikov <sb...@gridgain.com>
Authored: Mon Nov 14 09:44:48 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Nov 14 09:44:48 2016 +0300
----------------------------------------------------------------------
.../IgniteStartFromStreamConfigurationTest.java | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a2a3bedc/modules/spring/src/test/java/org/apache/ignite/spring/IgniteStartFromStreamConfigurationTest.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/spring/IgniteStartFromStreamConfigurationTest.java b/modules/spring/src/test/java/org/apache/ignite/spring/IgniteStartFromStreamConfigurationTest.java
index 0ef08f1..421011f 100644
--- a/modules/spring/src/test/java/org/apache/ignite/spring/IgniteStartFromStreamConfigurationTest.java
+++ b/modules/spring/src/test/java/org/apache/ignite/spring/IgniteStartFromStreamConfigurationTest.java
@@ -30,21 +30,25 @@ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
* Checks starts from Stream.
*/
public class IgniteStartFromStreamConfigurationTest extends GridCommonAbstractTest {
- /** Tests starts from Stream. */
+ /**
+ * Tests starts from stream.
+ *
+ * @throws Exception If failed.
+ */
public void testStartFromStream() throws Exception {
String cfg = "examples/config/example-cache.xml";
URL cfgLocation = U.resolveIgniteUrl(cfg);
- Ignite grid = Ignition.start(new FileInputStream(cfgLocation.getFile()));
+ try (Ignite grid = Ignition.start(new FileInputStream(cfgLocation.getFile()))) {
+ grid.cache(null).put("1", "1");
- grid.cache(null).put("1", "1");
+ assert grid.cache(null).get("1").equals("1");
- assert grid.cache(null).get("1").equals("1");
+ IgniteConfiguration icfg = Ignition.loadSpringBean(new FileInputStream(cfgLocation.getFile()), "ignite.cfg");
- IgniteConfiguration icfg = Ignition.loadSpringBean(new FileInputStream(cfgLocation.getFile()), "ignite.cfg");
-
- assert icfg.getCacheConfiguration()[0].getAtomicityMode() == CacheAtomicityMode.ATOMIC;
+ assert icfg.getCacheConfiguration()[0].getAtomicityMode() == CacheAtomicityMode.ATOMIC;
+ }
}
}
\ No newline at end of file
[37/50] [abbrv] ignite git commit: IGNITE-2355: fix test - clear
client connections before and after a test.
Posted by sb...@apache.org.
IGNITE-2355: fix test - clear client connections before and after a test.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6e4a279e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6e4a279e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6e4a279e
Branch: refs/heads/master
Commit: 6e4a279e34584881469a7d841432e6c38db2f06f
Parents: 88f38ac
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Mon Nov 21 19:15:17 2016 +0500
Committer: tledkov-gridgain <tl...@gridgain.com>
Committed: Mon Nov 21 19:15:17 2016 +0500
----------------------------------------------------------------------
...opClientProtocolMultipleServersSelfTest.java | 24 ++++++++++++++++++++
1 file changed, 24 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6e4a279e/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java
index 0e51938..cb83a73 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java
@@ -23,6 +23,7 @@ import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.concurrent.Callable;
+import java.util.concurrent.ConcurrentHashMap;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
@@ -44,6 +45,8 @@ import org.apache.ignite.IgniteFileSystem;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.hadoop.mapreduce.IgniteHadoopClientProtocolProvider;
import org.apache.ignite.igfs.IgfsPath;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.client.GridClient;
import org.apache.ignite.internal.client.GridServerUnreachableException;
import org.apache.ignite.internal.processors.hadoop.impl.HadoopAbstractSelfTest;
import org.apache.ignite.internal.processors.hadoop.impl.HadoopUtils;
@@ -76,9 +79,18 @@ public class HadoopClientProtocolMultipleServersSelfTest extends HadoopAbstractS
}
/** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ super.beforeTest();
+
+ clearClients();
+ }
+
+ /** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
stopAllGrids();
+ clearClients();
+
super.afterTest();
}
@@ -92,6 +104,18 @@ public class HadoopClientProtocolMultipleServersSelfTest extends HadoopAbstractS
}
/**
+ *
+ */
+ private void clearClients() {
+ ConcurrentHashMap<String, IgniteInternalFuture<GridClient>> cliMap = GridTestUtils.getFieldValue(
+ IgniteHadoopClientProtocolProvider.class,
+ IgniteHadoopClientProtocolProvider.class,
+ "cliMap");
+
+ cliMap.clear();
+ }
+
+ /**
* @throws Exception If failed.
*/
private void beforeJob() throws Exception {
[03/50] [abbrv] ignite git commit: IGNITE-4183: ODBC Fixed
null-values fetching issue.
Posted by sb...@apache.org.
IGNITE-4183: ODBC Fixed null-values fetching issue.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ac660dca
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ac660dca
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ac660dca
Branch: refs/heads/master
Commit: ac660dcaa5bf8eb20e7dd4e442e97c1cf548a827
Parents: d88f422
Author: Igor Sapego <is...@gridgain.com>
Authored: Wed Nov 9 15:29:06 2016 +0300
Committer: Igor Sapego <is...@gridgain.com>
Committed: Wed Nov 9 15:29:06 2016 +0300
----------------------------------------------------------------------
.../platforms/cpp/odbc-test/include/test_type.h | 42 ++++--
.../cpp/odbc-test/src/queries_test.cpp | 139 +++++++++++++++++--
.../cpp/odbc-test/src/sql_outer_join_test.cpp | 2 +-
.../odbc/src/app/application_data_buffer.cpp | 34 ++++-
4 files changed, 187 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ac660dca/modules/platforms/cpp/odbc-test/include/test_type.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/include/test_type.h b/modules/platforms/cpp/odbc-test/include/test_type.h
index 2a4a979..0e08251 100644
--- a/modules/platforms/cpp/odbc-test/include/test_type.h
+++ b/modules/platforms/cpp/odbc-test/include/test_type.h
@@ -28,6 +28,7 @@ namespace ignite
struct TestType
{
TestType() :
+ allNulls(false),
i8Field(0),
i16Field(0),
i32Field(0),
@@ -45,6 +46,7 @@ namespace ignite
int64_t i64Field, const std::string& strField, float floatField,
double doubleField, bool boolField, const Guid& guidField,
const Date& dateField, const Timestamp& timestampField) :
+ allNulls(false),
i8Field(i8Field),
i16Field(i16Field),
i32Field(i32Field),
@@ -60,6 +62,7 @@ namespace ignite
// No-op.
}
+ bool allNulls;
int8_t i8Field;
int16_t i16Field;
int32_t i32Field;
@@ -91,17 +94,34 @@ namespace ignite
void Write(BinaryWriter& writer, TestType obj)
{
- writer.WriteInt8("i8Field", obj.i8Field);
- writer.WriteInt16("i16Field", obj.i16Field);
- writer.WriteInt32("i32Field", obj.i32Field);
- writer.WriteInt64("i64Field", obj.i64Field);
- writer.WriteString("strField", obj.strField);
- writer.WriteFloat("floatField", obj.floatField);
- writer.WriteDouble("doubleField", obj.doubleField);
- writer.WriteBool("boolField", obj.boolField);
- writer.WriteGuid("guidField", obj.guidField);
- writer.WriteDate("dateField", obj.dateField);
- writer.WriteTimestamp("timestampField", obj.timestampField);
+ if (!obj.allNulls)
+ {
+ writer.WriteInt8("i8Field", obj.i8Field);
+ writer.WriteInt16("i16Field", obj.i16Field);
+ writer.WriteInt32("i32Field", obj.i32Field);
+ writer.WriteInt64("i64Field", obj.i64Field);
+ writer.WriteString("strField", obj.strField);
+ writer.WriteFloat("floatField", obj.floatField);
+ writer.WriteDouble("doubleField", obj.doubleField);
+ writer.WriteBool("boolField", obj.boolField);
+ writer.WriteGuid("guidField", obj.guidField);
+ writer.WriteDate("dateField", obj.dateField);
+ writer.WriteTimestamp("timestampField", obj.timestampField);
+ }
+ else
+ {
+ writer.WriteNull("i8Field");
+ writer.WriteNull("i16Field");
+ writer.WriteNull("i32Field");
+ writer.WriteNull("i64Field");
+ writer.WriteNull("strField");
+ writer.WriteNull("floatField");
+ writer.WriteNull("doubleField");
+ writer.WriteNull("boolField");
+ writer.WriteNull("guidField");
+ writer.WriteNull("dateField");
+ writer.WriteNull("timestampField");
+ }
}
TestType Read(BinaryReader& reader)
http://git-wip-us.apache.org/repos/asf/ignite/blob/ac660dca/modules/platforms/cpp/odbc-test/src/queries_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/queries_test.cpp b/modules/platforms/cpp/odbc-test/src/queries_test.cpp
index 82e9972..a7fc7a9 100644
--- a/modules/platforms/cpp/odbc-test/src/queries_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/queries_test.cpp
@@ -250,14 +250,14 @@ struct QueriesTestSuiteFixture
BOOST_CHECK_EQUAL(columns[9], 0);
BOOST_CHECK_EQUAL(columns[10], 0);
- BOOST_CHECK_EQUAL(columnLens[0], 0);
- BOOST_CHECK_EQUAL(columnLens[1], 0);
- BOOST_CHECK_EQUAL(columnLens[2], 0);
- BOOST_CHECK_EQUAL(columnLens[3], 0);
- BOOST_CHECK_EQUAL(columnLens[4], 0);
- BOOST_CHECK_EQUAL(columnLens[5], 0);
- BOOST_CHECK_EQUAL(columnLens[6], 0);
- BOOST_CHECK_EQUAL(columnLens[7], 0);
+ BOOST_CHECK_EQUAL(columnLens[0], static_cast<SQLLEN>(sizeof(T)));
+ BOOST_CHECK_EQUAL(columnLens[1], static_cast<SQLLEN>(sizeof(T)));
+ BOOST_CHECK_EQUAL(columnLens[2], static_cast<SQLLEN>(sizeof(T)));
+ BOOST_CHECK_EQUAL(columnLens[3], static_cast<SQLLEN>(sizeof(T)));
+ BOOST_CHECK_EQUAL(columnLens[4], static_cast<SQLLEN>(sizeof(T)));
+ BOOST_CHECK_EQUAL(columnLens[5], static_cast<SQLLEN>(sizeof(T)));
+ BOOST_CHECK_EQUAL(columnLens[6], static_cast<SQLLEN>(sizeof(T)));
+ BOOST_CHECK_EQUAL(columnLens[7], static_cast<SQLLEN>(sizeof(T)));
BOOST_CHECK_EQUAL(columnLens[8], SQL_NO_TOTAL);
BOOST_CHECK_EQUAL(columnLens[9], SQL_NO_TOTAL);
BOOST_CHECK_EQUAL(columnLens[10], SQL_NO_TOTAL);
@@ -296,32 +296,32 @@ BOOST_AUTO_TEST_CASE(TestConnectionProtocolVersion_1_6_0)
BOOST_AUTO_TEST_CASE(TestTwoRowsInt8)
{
- CheckTwoRowsInt<int8_t>(SQL_C_STINYINT);
+ CheckTwoRowsInt<signed char>(SQL_C_STINYINT);
}
BOOST_AUTO_TEST_CASE(TestTwoRowsUint8)
{
- CheckTwoRowsInt<uint8_t>(SQL_C_UTINYINT);
+ CheckTwoRowsInt<unsigned char>(SQL_C_UTINYINT);
}
BOOST_AUTO_TEST_CASE(TestTwoRowsInt16)
{
- CheckTwoRowsInt<int16_t>(SQL_C_SSHORT);
+ CheckTwoRowsInt<signed short>(SQL_C_SSHORT);
}
BOOST_AUTO_TEST_CASE(TestTwoRowsUint16)
{
- CheckTwoRowsInt<uint16_t>(SQL_C_USHORT);
+ CheckTwoRowsInt<unsigned short>(SQL_C_USHORT);
}
BOOST_AUTO_TEST_CASE(TestTwoRowsInt32)
{
- CheckTwoRowsInt<int32_t>(SQL_C_SLONG);
+ CheckTwoRowsInt<signed long>(SQL_C_SLONG);
}
BOOST_AUTO_TEST_CASE(TestTwoRowsUint32)
{
- CheckTwoRowsInt<uint32_t>(SQL_C_ULONG);
+ CheckTwoRowsInt<unsigned long>(SQL_C_ULONG);
}
BOOST_AUTO_TEST_CASE(TestTwoRowsInt64)
@@ -674,4 +674,115 @@ BOOST_AUTO_TEST_CASE(TestDataAtExecution)
BOOST_CHECK(ret == SQL_NO_DATA);
}
+BOOST_AUTO_TEST_CASE(TestNullFields)
+{
+ Connect("DRIVER={Apache Ignite};ADDRESS=127.0.0.1:11110;CACHE=cache");
+
+ SQLRETURN ret;
+
+ TestType in(1, 2, 3, 4, "5", 6.0f, 7.0, true, Guid(8, 9), BinaryUtils::MakeDateGmt(1987, 6, 5),
+ BinaryUtils::MakeTimestampGmt(1998, 12, 27, 1, 2, 3, 456));
+
+ TestType inNull;
+
+ inNull.allNulls = true;
+
+ testCache.Put(1, in);
+ testCache.Put(2, inNull);
+ testCache.Put(3, in);
+
+ const size_t columnsCnt = 10;
+
+ SQLLEN columnLens[columnsCnt] = { 0 };
+
+ int8_t i8Column;
+ int16_t i16Column;
+ int32_t i32Column;
+ int64_t i64Column;
+ char strColumn[ODBC_BUFFER_SIZE];
+ float floatColumn;
+ double doubleColumn;
+ bool boolColumn;
+ SQL_DATE_STRUCT dateColumn;
+ SQL_TIMESTAMP_STRUCT timestampColumn;
+
+ // Binding columns.
+ ret = SQLBindCol(stmt, 1, SQL_C_STINYINT, &i8Column, 0, &columnLens[0]);
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ ret = SQLBindCol(stmt, 2, SQL_C_SSHORT, &i16Column, 0, &columnLens[1]);
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ ret = SQLBindCol(stmt, 3, SQL_C_SLONG, &i32Column, 0, &columnLens[2]);
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ ret = SQLBindCol(stmt, 4, SQL_C_SBIGINT, &i64Column, 0, &columnLens[3]);
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ ret = SQLBindCol(stmt, 5, SQL_C_CHAR, &strColumn, ODBC_BUFFER_SIZE, &columnLens[4]);
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ ret = SQLBindCol(stmt, 6, SQL_C_FLOAT, &floatColumn, 0, &columnLens[5]);
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ ret = SQLBindCol(stmt, 7, SQL_C_DOUBLE, &doubleColumn, 0, &columnLens[6]);
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ ret = SQLBindCol(stmt, 8, SQL_C_BIT, &boolColumn, 0, &columnLens[7]);
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ ret = SQLBindCol(stmt, 9, SQL_C_DATE, &dateColumn, 0, &columnLens[8]);
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ ret = SQLBindCol(stmt, 10, SQL_C_TIMESTAMP, ×tampColumn, 0, &columnLens[9]);
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ SQLCHAR request[] = "SELECT i8Field, i16Field, i32Field, i64Field, strField, "
+ "floatField, doubleField, boolField, dateField, timestampField FROM TestType ORDER BY _key";
+
+ ret = SQLExecDirect(stmt, request, SQL_NTS);
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ // Fetching the first non-null row.
+ ret = SQLFetch(stmt);
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ // Checking that columns are not null.
+ for (SQLSMALLINT i = 0; i < columnsCnt; ++i)
+ BOOST_CHECK_NE(columnLens[i], SQL_NULL_DATA);
+
+ // Fetching null row.
+ ret = SQLFetch(stmt);
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ // Checking that columns are null.
+ for (SQLSMALLINT i = 0; i < columnsCnt; ++i)
+ BOOST_CHECK_EQUAL(columnLens[i], SQL_NULL_DATA);
+
+ // Fetching the last non-null row.
+ ret = SQLFetch(stmt);
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ // Checking that columns are not null.
+ for (SQLSMALLINT i = 0; i < columnsCnt; ++i)
+ BOOST_CHECK_NE(columnLens[i], SQL_NULL_DATA);
+
+ ret = SQLFetch(stmt);
+ BOOST_CHECK(ret == SQL_NO_DATA);
+}
+
BOOST_AUTO_TEST_SUITE_END()
http://git-wip-us.apache.org/repos/asf/ignite/blob/ac660dca/modules/platforms/cpp/odbc-test/src/sql_outer_join_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/sql_outer_join_test.cpp b/modules/platforms/cpp/odbc-test/src/sql_outer_join_test.cpp
index 426041b..56f5219 100644
--- a/modules/platforms/cpp/odbc-test/src/sql_outer_join_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/sql_outer_join_test.cpp
@@ -211,7 +211,7 @@ BOOST_AUTO_TEST_CASE(TestOuterJoinOpsLess)
BOOST_CHECK_NE(columnsLen[0], SQL_NULL_DATA);
BOOST_CHECK_EQUAL(columns[0], 30);
- BOOST_CHECK_EQUAL(columnsLen[1], SQL_NULL_DATA);
+ BOOST_CHECK_NE(columnsLen[1], SQL_NULL_DATA);
ret = SQLFetch(stmt);
BOOST_CHECK(ret == SQL_NO_DATA);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ac660dca/modules/platforms/cpp/odbc/src/app/application_data_buffer.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/app/application_data_buffer.cpp b/modules/platforms/cpp/odbc/src/app/application_data_buffer.cpp
index 1438b0c..078e691 100644
--- a/modules/platforms/cpp/odbc/src/app/application_data_buffer.cpp
+++ b/modules/platforms/cpp/odbc/src/app/application_data_buffer.cpp
@@ -182,6 +182,10 @@ namespace ignite
memcpy(out->val, &uval, std::min<int>(SQL_MAX_NUMERIC_LEN, sizeof(uval)));
}
+
+ if (resLenPtr)
+ *resLenPtr = static_cast<SqlLen>(sizeof(SQL_NUMERIC_STRUCT));
+
break;
}
@@ -237,12 +241,16 @@ namespace ignite
void ApplicationDataBuffer::PutNumToNumBuffer(Tin value)
{
void* dataPtr = GetData();
+ SqlLen* resLenPtr = GetResLen();
if (dataPtr)
{
Tbuf* out = reinterpret_cast<Tbuf*>(dataPtr);
*out = static_cast<Tbuf>(value);
}
+
+ if (resLenPtr)
+ *resLenPtr = static_cast<SqlLen>(sizeof(Tbuf));
}
template<typename CharT, typename Tin>
@@ -448,6 +456,8 @@ namespace ignite
{
using namespace type_traits;
+ SqlLen* resLenPtr = GetResLen();
+
switch (type)
{
case IGNITE_ODBC_C_TYPE_CHAR:
@@ -476,13 +486,14 @@ namespace ignite
for (size_t i = 0; i < sizeof(guid->Data4); ++i)
guid->Data4[i] = (lsb >> (sizeof(guid->Data4) - i - 1) * 8) & 0xFF;
+ if (resLenPtr)
+ *resLenPtr = static_cast<SqlLen>(sizeof(SQLGUID));
+
break;
}
default:
{
- SqlLen* resLenPtr = GetResLen();
-
if (resLenPtr)
*resLenPtr = SQL_NO_TOTAL;
}
@@ -573,6 +584,8 @@ namespace ignite
{
using namespace type_traits;
+ SqlLen* resLenPtr = GetResLen();
+
switch (type)
{
case IGNITE_ODBC_C_TYPE_SIGNED_TINYINT:
@@ -637,6 +650,9 @@ namespace ignite
numeric->sign = unscaled.GetSign() < 0 ? 0 : 1;
numeric->precision = unscaled.GetPrecision();
+ if (resLenPtr)
+ *resLenPtr = static_cast<SqlLen>(sizeof(SQL_NUMERIC_STRUCT));
+
break;
}
@@ -644,8 +660,6 @@ namespace ignite
case IGNITE_ODBC_C_TYPE_BINARY:
default:
{
- SqlLen* resLenPtr = GetResLen();
-
if (resLenPtr)
*resLenPtr = SQL_NO_TOTAL;
}
@@ -716,6 +730,9 @@ namespace ignite
buffer->month = tmTime.tm_mon + 1;
buffer->day = tmTime.tm_mday;
+ if (resLenPtr)
+ *resLenPtr = static_cast<SqlLen>(sizeof(SQL_DATE_STRUCT));
+
break;
}
@@ -731,6 +748,9 @@ namespace ignite
buffer->second = tmTime.tm_sec;
buffer->fraction = 0;
+ if (resLenPtr)
+ *resLenPtr = static_cast<SqlLen>(sizeof(SQL_TIMESTAMP_STRUCT));
+
break;
}
@@ -830,6 +850,9 @@ namespace ignite
buffer->month = tmTime.tm_mon + 1;
buffer->day = tmTime.tm_mday;
+ if (resLenPtr)
+ *resLenPtr = static_cast<SqlLen>(sizeof(SQL_DATE_STRUCT));
+
break;
}
@@ -845,6 +868,9 @@ namespace ignite
buffer->second = tmTime.tm_sec;
buffer->fraction = value.GetSecondFraction();
+ if (resLenPtr)
+ *resLenPtr = static_cast<SqlLen>(sizeof(SQL_TIMESTAMP_STRUCT));
+
break;
}
[21/50] [abbrv] ignite git commit: ignite-4154 Optimize amount of
data stored in discovery history Discovery history optimizations: - remove
discarded message for discovery pending messages - remove duplicated data
from TcpDiscoveryNodeAddedMessage.oldNo
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
index 0663903..6edfd09 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
@@ -26,6 +26,7 @@ import org.apache.ignite.internal.processors.cache.CacheConfigurationLeakTest;
import org.apache.ignite.internal.processors.cache.CacheDhtLocalPartitionAfterRemoveSelfTest;
import org.apache.ignite.internal.processors.cache.CacheEnumOperationsSingleNodeTest;
import org.apache.ignite.internal.processors.cache.CacheEnumOperationsTest;
+import org.apache.ignite.internal.processors.cache.CacheExchangeMessageDuplicatedStateTest;
import org.apache.ignite.internal.processors.cache.CrossCacheTxRandomOperationsTest;
import org.apache.ignite.internal.processors.cache.GridCacheAtomicMessageCountSelfTest;
import org.apache.ignite.internal.processors.cache.GridCacheFinishPartitionsSelfTest;
@@ -264,6 +265,8 @@ public class IgniteCacheTestSuite2 extends TestSuite {
suite.addTest(new TestSuite(IgniteNoCustomEventsOnNodeStart.class));
+ suite.addTest(new TestSuite(CacheExchangeMessageDuplicatedStateTest.class));
+
return suite;
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapEvictQueryTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapEvictQueryTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapEvictQueryTest.java
index f21a279..c24fed4 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapEvictQueryTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapEvictQueryTest.java
@@ -87,6 +87,13 @@ public class IgniteCacheOffheapEvictQueryTest extends GridCommonAbstractTest {
return cfg;
}
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+
+ super.afterTest();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheClientQueryReplicatedNodeRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheClientQueryReplicatedNodeRestartSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheClientQueryReplicatedNodeRestartSelfTest.java
index 5dbb12c..742da7c 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheClientQueryReplicatedNodeRestartSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheClientQueryReplicatedNodeRestartSelfTest.java
@@ -159,6 +159,13 @@ public class IgniteCacheClientQueryReplicatedNodeRestartSelfTest extends GridCom
return c;
}
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+
+ super.afterTest();
+ }
+
/**
*
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest.java
index 0f60db2..072a081 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest.java
@@ -95,6 +95,13 @@ public class IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest extends Gr
g.cache(null).removeAll();
}
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ stopAllGrids();
+
+ super.afterTestsStopped();
+ }
+
/** */
public void testRemoteQueryExecutionTimeout() throws Exception {
testQuery(CACHE_SIZE, VAL_SIZE, QUERY_1, 500, TimeUnit.MILLISECONDS, true);
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
index d559d2e..070acb1 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
@@ -87,13 +87,22 @@ public class GridQueryParsingTest extends GridCommonAbstractTest {
return c;
}
- /** */
+ /** {@inheritDoc} */
@Override protected void beforeTestsStarted() throws Exception {
super.beforeTestsStarted();
ignite = startGrid();
}
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ stopAllGrids();
+
+ ignite = null;
+
+ super.afterTestsStopped();
+ }
+
/**
* @throws Exception If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/spring/src/test/config/incorrect-store-cache.xml
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/config/incorrect-store-cache.xml b/modules/spring/src/test/config/incorrect-store-cache.xml
index 2ccda21..b08f84e 100644
--- a/modules/spring/src/test/config/incorrect-store-cache.xml
+++ b/modules/spring/src/test/config/incorrect-store-cache.xml
@@ -23,6 +23,8 @@
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+ <property name="localHost" value="127.0.0.1"/>
+
<property name="cacheConfiguration">
<list>
<bean class="org.apache.ignite.configuration.CacheConfiguration">
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/spring/src/test/config/jdbc-pojo-store-builtin.xml
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/config/jdbc-pojo-store-builtin.xml b/modules/spring/src/test/config/jdbc-pojo-store-builtin.xml
index d62e76b..dfaf828 100644
--- a/modules/spring/src/test/config/jdbc-pojo-store-builtin.xml
+++ b/modules/spring/src/test/config/jdbc-pojo-store-builtin.xml
@@ -25,7 +25,10 @@
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd">
<bean class="org.apache.ignite.configuration.IgniteConfiguration">
+ <property name="localHost" value="127.0.0.1"/>
+
<property name="gridName" value="test-cluster"/>
+
<property name="discoverySpi">
<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
<property name="ipFinder">
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/spring/src/test/config/jdbc-pojo-store-obj.xml
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/config/jdbc-pojo-store-obj.xml b/modules/spring/src/test/config/jdbc-pojo-store-obj.xml
index 83e0548..9bc9977 100644
--- a/modules/spring/src/test/config/jdbc-pojo-store-obj.xml
+++ b/modules/spring/src/test/config/jdbc-pojo-store-obj.xml
@@ -25,7 +25,10 @@
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd">
<bean class="org.apache.ignite.configuration.IgniteConfiguration">
+ <property name="localHost" value="127.0.0.1"/>
+
<property name="gridName" value="test-cluster"/>
+
<property name="discoverySpi">
<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
<property name="ipFinder">
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/spring/src/test/config/node.xml
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/config/node.xml b/modules/spring/src/test/config/node.xml
index 6f467eb..e6b0b52 100644
--- a/modules/spring/src/test/config/node.xml
+++ b/modules/spring/src/test/config/node.xml
@@ -25,6 +25,8 @@
<bean id="simpleDataSource" class="org.h2.jdbcx.JdbcDataSource"/>
<bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+ <property name="localHost" value="127.0.0.1"/>
+
<!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
<property name="discoverySpi">
<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/spring/src/test/config/node1.xml
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/config/node1.xml b/modules/spring/src/test/config/node1.xml
index 76539f7..814736a 100644
--- a/modules/spring/src/test/config/node1.xml
+++ b/modules/spring/src/test/config/node1.xml
@@ -25,6 +25,8 @@
<bean id="simpleDataSource" class="org.apache.ignite.cache.store.jdbc.CacheJdbcBlobStoreFactorySelfTest$DummyDataSource"/>
<bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+ <property name="localHost" value="127.0.0.1"/>
+
<property name="gridName" value="ignite1"/>
<!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/spring/src/test/config/pojo-incorrect-store-cache.xml
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/config/pojo-incorrect-store-cache.xml b/modules/spring/src/test/config/pojo-incorrect-store-cache.xml
index 5627bd0..f7f9141 100644
--- a/modules/spring/src/test/config/pojo-incorrect-store-cache.xml
+++ b/modules/spring/src/test/config/pojo-incorrect-store-cache.xml
@@ -23,6 +23,8 @@
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+ <property name="localHost" value="127.0.0.1"/>
+
<property name="cacheConfiguration">
<list>
<bean class="org.apache.ignite.configuration.CacheConfiguration">
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/spring/src/test/config/store-cache.xml
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/config/store-cache.xml b/modules/spring/src/test/config/store-cache.xml
index 07a4ab0..d7bc014 100644
--- a/modules/spring/src/test/config/store-cache.xml
+++ b/modules/spring/src/test/config/store-cache.xml
@@ -25,6 +25,8 @@
<bean id="simpleDataSource" class="org.h2.jdbcx.JdbcDataSource"/>
<bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+ <property name="localHost" value="127.0.0.1"/>
+
<property name="cacheConfiguration">
<list>
<bean class="org.apache.ignite.configuration.CacheConfiguration">
http://git-wip-us.apache.org/repos/asf/ignite/blob/7128a395/modules/spring/src/test/config/store-cache1.xml
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/config/store-cache1.xml b/modules/spring/src/test/config/store-cache1.xml
index a9e58d6..46eef3f 100644
--- a/modules/spring/src/test/config/store-cache1.xml
+++ b/modules/spring/src/test/config/store-cache1.xml
@@ -26,6 +26,8 @@
<bean id="simpleDataSource1" class="org.apache.ignite.cache.store.jdbc.CacheJdbcBlobStoreFactorySelfTest$DummyDataSource"/>
<bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+ <property name="localHost" value="127.0.0.1"/>
+
<property name="gridName" value="ignite1"/>
<property name="cacheConfiguration">