ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject ignite git commit: IGNITE-6528: SQL: detailed warning message when inserted value is not passed to any table. This closes #3923.
Date Mon, 18 Jun 2018 08:59:15 GMT
Repository: ignite
Updated Branches:
  refs/heads/master 6af316706 -> e1963d1a2


IGNITE-6528: SQL: detailed warning message when inserted value is not passed to any table.
This closes #3923.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e1963d1a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e1963d1a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e1963d1a

Branch: refs/heads/master
Commit: e1963d1a2ae3bfc82efc04457960d1694e90ee16
Parents: 6af3167
Author: Ilya Kasnacheev <ilya.kasnacheev@gmail.com>
Authored: Mon Jun 18 11:59:07 2018 +0300
Committer: devozerov <vozerov@gridgain.com>
Committed: Mon Jun 18 11:59:07 2018 +0300

----------------------------------------------------------------------
 .../processors/query/GridQueryProcessor.java    | 104 ++++-
 .../cache/BinaryTypeMismatchLoggingTest.java    | 388 +++++++++++++++++++
 .../IgniteCacheWithIndexingTestSuite.java       |   3 +
 3 files changed, 491 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/e1963d1a/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 a74548a..04d1aa9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -39,6 +39,7 @@ import javax.cache.CacheException;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteDataStreamer;
 import org.apache.ignite.IgniteException;
+import org.apache.ignite.binary.BinaryObject;
 import org.apache.ignite.binary.Binarylizable;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheKeyConfiguration;
@@ -101,6 +102,7 @@ import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.T2;
 import org.apache.ignite.internal.util.typedef.T3;
 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;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.internal.util.worker.GridWorker;
@@ -201,6 +203,9 @@ public class GridQueryProcessor extends GridProcessorAdapter {
     /** */
     private boolean skipFieldLookup;
 
+    /** Cache name - value typeId pairs for which type mismatch message was logged. */
+    private final Set<Long> missedCacheTypes = Collections.newSetFromMap(new ConcurrentHashMap<>());
+
     /**
      * @param ctx Kernal context.
      */
@@ -1689,6 +1694,15 @@ public class GridQueryProcessor extends GridProcessorAdapter {
             }
 
             cacheNames.remove(cacheName);
+
+            Iterator<Long> missedCacheTypeIter = missedCacheTypes.iterator();
+
+            while (missedCacheTypeIter.hasNext()) {
+                long key = missedCacheTypeIter.next();
+
+                if (missedCacheTypeKeyMatches(key, cacheName))
+                    missedCacheTypeIter.remove();
+            }
         }
     }
 
@@ -1827,9 +1841,10 @@ public class GridQueryProcessor extends GridProcessorAdapter {
         assert prevRowAvailable || prevRow == null;
 
         KeyCacheObject key = newRow.key();
+        CacheObject val = newRow.value();
 
         if (log.isDebugEnabled())
-            log.debug("Store [cache=" + cctx.name() + ", key=" + key + ", val=" + newRow.value()
+ "]");
+            log.debug("Store [cache=" + cctx.name() + ", key=" + key + ", val=" + val + "]");
 
         if (idx == null)
             return;
@@ -1842,7 +1857,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
 
             CacheObjectContext coctx = cctx.cacheObjectContext();
 
-            QueryTypeDescriptorImpl desc = typeByValue(cacheName, coctx, key, newRow.value(),
true);
+            QueryTypeDescriptorImpl desc = typeByValue(cacheName, coctx, key, val, true);
 
             if (prevRowAvailable && prevRow != null) {
                 QueryTypeDescriptorImpl prevValDesc = typeByValue(cacheName,
@@ -1860,8 +1875,24 @@ public class GridQueryProcessor extends GridProcessorAdapter {
                 }
             }
 
-            if (desc == null)
+            if (desc == null) {
+                int typeId = ctx.cacheObjects().typeId(val);
+
+                long missedCacheTypeKey = missedCacheTypeKey(cacheName, typeId);
+
+                if (!missedCacheTypes.contains(missedCacheTypeKey)) {
+                    if (missedCacheTypes.add(missedCacheTypeKey)) {
+                        LT.warn(log, "Key-value pair is not inserted into any SQL table [cacheName="
+ cacheName +
+                            ", " + describeTypeMismatch(cacheName, val) + "]");
+
+                        LT.warn(log, "  ^-- Value type(s) are specified via CacheConfiguration.indexedTypes
or CacheConfiguration.queryEntities");
+                        LT.warn(log, "  ^-- Make sure that same type(s) used when adding
Object or BinaryObject to cache");
+                        LT.warn(log, "  ^-- Otherwise, entries will be stored in cache, but
not appear as SQL Table rows");
+                    }
+                }
+
                 return;
+            }
 
             idx.store(cctx, desc, newRow, prevRow, prevRowAvailable);
         }
@@ -1871,6 +1902,47 @@ public class GridQueryProcessor extends GridProcessorAdapter {
     }
 
     /**
+     * Pretty-prints difference between expected and actual value types.
+     *
+     * @param cacheName Cache name.
+     * @param val Value object.
+     * @return Human readable type difference.
+     */
+    private String describeTypeMismatch(String cacheName, Object val) {
+        try {
+            QueryTypeDescriptorImpl indexedType = null;
+
+            for (QueryTypeIdKey typeKey : types.keySet()) {
+                if (typeKey.cacheName().equals(cacheName)) {
+                    if (indexedType != null) {
+                        // More than one type for table - simplified message.
+                        indexedType = null;
+                        break;
+                    }
+
+                    indexedType = types.get(typeKey);
+                }
+            }
+
+            boolean bin = ctx.cacheObjects().isBinaryObject(val);
+
+            if (indexedType != null && bin &&
+                !indexedType.valueTypeName().equals(((BinaryObject)val).type().typeName()))
{
+
+                return "expValType=" + indexedType.valueTypeName()
+                    + ", actualValType=" + ((BinaryObject)val).type().typeName();
+            }
+            else if (bin)
+                return "valType=" + ((BinaryObject)val).type().typeName();
+            else
+                return "val=" + val.toString();
+        }
+        catch (Exception e) {
+            return val.getClass().getName();
+        }
+    }
+
+    /**
      * @param cacheName Cache name.
      * @param coctx Cache context.
      * @param key Key.
@@ -2416,7 +2488,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
      *
      * @param d Type descriptor to update.
      * @param cols Columns to remove.
-     * @throws IgniteCheckedException
+     * @throws IgniteCheckedException If failed.
      */
     private void processDynamicDropColumn(QueryTypeDescriptorImpl d, List<String> cols)
         throws IgniteCheckedException {
@@ -2798,6 +2870,30 @@ public class GridQueryProcessor extends GridProcessorAdapter {
     }
 
     /**
+     * Create missed cache type key.
+     *
+     * @param cacheName Cache name.
+     * @param typeId Type ID.
+     * @return Key.
+     */
+    private static long missedCacheTypeKey(String cacheName, int typeId) {
+        return ((long)CU.cacheId(cacheName) << 32) | typeId;
+    }
+
+    /**
+     * @param key Key.
+     * @param cacheName Cache name.
+     * @return {@code True} if matches.
+     */
+    private static boolean missedCacheTypeKeyMatches(long key, String cacheName) {
+        int cacheId = CU.cacheId(cacheName);
+
+        long cacheIdShifted = ((long)cacheId << 32);
+
+        return (key & cacheIdShifted) == cacheIdShifted;
+    }
+
+    /**
      * Schema operation.
      */
     private class SchemaOperation {

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1963d1a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/BinaryTypeMismatchLoggingTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/BinaryTypeMismatchLoggingTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/BinaryTypeMismatchLoggingTest.java
new file mode 100644
index 0000000..7a41a6a
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/BinaryTypeMismatchLoggingTest.java
@@ -0,0 +1,388 @@
+/*
+ * 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.Arrays;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.concurrent.Callable;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.binary.BinaryInvalidTypeException;
+import org.apache.ignite.cache.QueryEntity;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.cache.query.annotations.QuerySqlField;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.processors.GridProcessorAdapter;
+import org.apache.ignite.testframework.GridStringLogger;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+
+/**
+ * Tests of binary type mismatch logging.
+ */
+public class BinaryTypeMismatchLoggingTest extends GridCommonAbstractTest {
+    /** */
+    public static final String MESSAGE_PAYLOAD_VALUE = "expValType=Payload, actualValType=o.a.i.i.processors.cache.BinaryTypeMismatchLoggingTest$Payload";
+
+    /** */
+    private GridStringLogger capture;
+
+    /**
+     * @throws Exception In case of an error.
+     */
+    public void testValueReadCreateTable() throws Exception {
+        Ignite ignite = startGrid(0);
+
+        IgniteCache def = ignite.createCache("default");
+
+        def.query(new SqlFieldsQuery("CREATE TABLE binary (id INT PRIMARY KEY, str VARCHAR)
" +
+            "WITH \"cache_name=binary, value_type=Payload\"").setSchema("PUBLIC"));
+
+        def.query(new SqlFieldsQuery("INSERT INTO binary (id, str) VALUES (1, 'foo');").setSchema("PUBLIC"));
+        def.query(new SqlFieldsQuery("INSERT INTO binary (id, str) VALUES (2, 'bar');").setSchema("PUBLIC"));
+
+        GridTestUtils.assertThrowsAnyCause(
+            log,
+            new Callable<Object>() {
+                @Override public Object call() {
+                    return ignite.cache("binary").get(1);
+                }
+            },
+            BinaryInvalidTypeException.class,
+            "Payload");
+    }
+
+    /**
+     * @throws Exception In case of an error.
+     */
+    public void testValueReadQueryEntities() throws Exception {
+        Ignite ignite = startGrid(0);
+
+        LinkedHashMap<String, String> fields = new LinkedHashMap<>();
+        fields.put("id", "java.lang.Integer");
+        fields.put("str", "java.lang.String");
+
+        IgniteCache binary = ignite.createCache(new CacheConfiguration<>()
+            .setName("binary").setQueryEntities(Collections.singleton(new QueryEntity()
+                .setKeyFieldName("id").setValueType("Payload").setFields(fields).setTableName("binary"))));
+
+        binary.query(new SqlFieldsQuery("INSERT INTO binary (id, str) VALUES (1, 'foo');"));
+        binary.query(new SqlFieldsQuery("INSERT INTO binary (id, str) VALUES (2, 'bar');"));
+
+        GridTestUtils.assertThrowsAnyCause(
+            log,
+            new Callable<Object>() {
+                @Override public Object call() {
+                    return ignite.cache("binary").get(1);
+                }
+            },
+            BinaryInvalidTypeException.class,
+            "Payload");
+    }
+
+    /**
+     * @throws Exception In case of an error.
+     */
+    public void testEntryReadCreateTable() throws Exception {
+        Ignite ignite = startGrid(0);
+
+        IgniteCache def = ignite.createCache("default");
+
+        def.query(new SqlFieldsQuery("CREATE TABLE binary (id INT PRIMARY KEY, str VARCHAR)
" +
+            "WITH \"cache_name=binary, key_type=IdKey, value_type=Payload\"").setSchema("PUBLIC"));
+
+        def.query(new SqlFieldsQuery("INSERT INTO binary (id, str) VALUES (1, 'foo');").setSchema("PUBLIC"));
+        def.query(new SqlFieldsQuery("INSERT INTO binary (id, str) VALUES (2, 'bar');").setSchema("PUBLIC"));
+
+        GridTestUtils.assertThrowsAnyCause(
+            log,
+            new Callable<Object>() {
+                @Override public Object call() {
+                    return ignite.cache("binary").iterator().next();
+                }
+            },
+            BinaryInvalidTypeException.class,
+            "IdKey");
+    }
+
+    /**
+     * @throws Exception In case of an error.
+     */
+    public void testEntryReadQueryEntities() throws Exception {
+        Ignite ignite = startGrid(0);
+
+        LinkedHashMap<String, String> fields = new LinkedHashMap<>();
+        fields.put("id", "java.lang.Integer");
+        fields.put("str", "java.lang.String");
+
+        IgniteCache binary = ignite.createCache(new CacheConfiguration<>()
+            .setName("binary").setQueryEntities(Collections.singleton(new QueryEntity()
+                .setKeyType("IdKey").setKeyFields(Collections.singleton("id"))
+                .setValueType("Payload").setFields(fields).setTableName("binary"))));
+
+        binary.query(new SqlFieldsQuery("INSERT INTO binary (id, str) VALUES (1, 'foo');"));
+        binary.query(new SqlFieldsQuery("INSERT INTO binary (id, str) VALUES (2, 'bar');"));
+
+        GridTestUtils.assertThrowsAnyCause(
+            log,
+            new Callable<Object>() {
+                @Override public Object call() {
+                    return ignite.cache("binary").iterator().next();
+                }
+            },
+            BinaryInvalidTypeException.class,
+            "IdKey");
+    }
+
+    /**
+     * @throws Exception In case of an error.
+     */
+    public void testValueWriteCreateTable() throws Exception {
+        Ignite ignite = startGridWithLogCapture();
+
+        IgniteCache def = ignite.createCache("default");
+
+        def.query(new SqlFieldsQuery("CREATE TABLE binary (id INT PRIMARY KEY, str VARCHAR)
" +
+            "WITH \"cache_name=binary, value_type=Payload\"").setSchema("PUBLIC"));
+
+        IgniteCache<Integer, Payload> binary = ignite.cache("binary");
+        binary.put(1, new Payload("foo"));
+        binary.put(2, new Payload("bar"));
+
+        assertEquals(0, countRows(binary));
+
+        String capturedMessages = this.capture.toString();
+
+        assertContainsExactlyOnce(capturedMessages,
+            "Key-value pair is not inserted into any SQL table [cacheName=binary, " + MESSAGE_PAYLOAD_VALUE
+ "]");
+        assertContainsExactlyOnce(capturedMessages,
+            "Value type(s) are specified via CacheConfiguration.indexedTypes or CacheConfiguration.queryEntities");
+        assertContainsExactlyOnce(capturedMessages,
+            "Make sure that same type(s) used when adding Object or BinaryObject to cache");
+        assertContainsExactlyOnce(capturedMessages,
+            "Otherwise, entries will be stored in cache, but not appear as SQL Table rows");
+    }
+
+    /**
+     * @throws Exception In case of an error.
+     */
+    public void testValueWriteQueryEntities() throws Exception {
+        Ignite ignite = startGridWithLogCapture();
+
+        LinkedHashMap<String, String> fields = new LinkedHashMap<>();
+        fields.put("id", "java.lang.Integer");
+        fields.put("str", "java.lang.String");
+
+        IgniteCache<Integer, Object> binary = ignite.createCache(new CacheConfiguration<Integer,
Object>()
+            .setName("binary").setQueryEntities(Collections.singleton(new QueryEntity()
+                .setKeyFieldName("id").setValueType("Payload").setFields(fields).setTableName("binary"))));
+
+        binary.put(1, new Payload("foo"));
+        binary.put(2, new IdKey(2));
+
+        assertEquals(0, countRows(binary));
+
+        assertContainsExactlyOnce(capture.toString(), MESSAGE_PAYLOAD_VALUE);
+        assertContainsExactlyOnce(capture.toString(),
+            "expValType=Payload, actualValType=o.a.i.i.processors.cache.BinaryTypeMismatchLoggingTest$IdKey");
+    }
+
+    /**
+     * @throws Exception In case of an error.
+     */
+    public void testEntryWriteCreateTable() throws Exception {
+        Ignite ignite = startGridWithLogCapture();
+
+        IgniteCache def = ignite.createCache("default");
+
+        def.query(new SqlFieldsQuery("CREATE TABLE binary (id INT PRIMARY KEY, str VARCHAR)
" +
+            "WITH \"cache_name=binary, key_type=IdKey, value_type=Payload\"").setSchema("PUBLIC"));
+
+        IgniteCache<Integer, Payload> binary = ignite.cache("binary");
+        binary.put(1, new Payload("foo"));
+        binary.put(2, new Payload("bar"));
+
+        assertEquals(0, countRows(binary));
+
+        assertContainsExactlyOnce(capture.toString(), MESSAGE_PAYLOAD_VALUE);
+
+        capture.reset();
+
+        def.query(new SqlFieldsQuery("CREATE TABLE binary2 (id INT PRIMARY KEY, str VARCHAR)
" +
+            "WITH \"cache_name=binary2, key_type=IdKey, value_type=Payload\"").setSchema("PUBLIC"));
+
+        IgniteCache<Integer, Payload> binary2 = ignite.cache("binary2");
+        binary2.put(1, new Payload("foo"));
+        binary2.put(2, new Payload("bar"));
+
+        assertEquals(0, countRows(binary2));
+
+        assertContainsExactlyOnce(capture.toString(), MESSAGE_PAYLOAD_VALUE);
+    }
+
+    /**
+     * @throws Exception In case of an error.
+     */
+    public void testEntryWriteQueryEntities() throws Exception {
+        Ignite ignite = startGridWithLogCapture();
+
+        LinkedHashMap<String, String> fields = new LinkedHashMap<>();
+        fields.put("id", "java.lang.Integer");
+        fields.put("str", "java.lang.String");
+
+        IgniteCache<IdKey, Payload> binary = ignite.createCache(new CacheConfiguration<IdKey,
Payload>()
+            .setName("binary").setQueryEntities(Collections.singleton(new QueryEntity()
+                .setKeyType("IdKey").setKeyFields(Collections.singleton("id"))
+                .setValueType("Payload").setFields(fields).setTableName("binary"))));
+
+        binary.put(new IdKey(1), new Payload("foo"));
+        binary.put(new IdKey(2), new Payload("bar"));
+
+        assertEquals(0, countRows(binary));
+
+        binary.destroy();
+
+        binary = ignite.createCache(new CacheConfiguration<IdKey, Payload>()
+            .setName("binary").setQueryEntities(Collections.singleton(new QueryEntity()
+                .setKeyType("IdKey").setKeyFields(Collections.singleton("id"))
+                .setValueType("Payload").setFields(fields).setTableName("binary"))));
+
+        binary.put(new IdKey(1), new Payload("foo"));
+        binary.put(new IdKey(2), new Payload("bar"));
+
+        assertEquals(0, countRows(binary));
+
+        assertContainsExactlyOnce(capture.toString(), MESSAGE_PAYLOAD_VALUE);
+    }
+
+    /**
+     * @throws Exception In case of an error.
+     */
+    public void testEntryWriteCacheIsolation() throws Exception {
+        Ignite ignite = startGridWithLogCapture();
+
+        LinkedHashMap<String, String> fields = new LinkedHashMap<>();
+        fields.put("id", "java.lang.Integer");
+        fields.put("str", "java.lang.String");
+
+        IgniteCache<IdKey, Payload> regular = ignite.createCache(new CacheConfiguration<IdKey,
Payload>()
+            .setName("regular").setQueryEntities(Collections.singleton(new QueryEntity()
+                .setKeyType(getClass().getName() + "$IdKey").setKeyFields(Collections.singleton("id"))
+                .setValueType(getClass().getName() + "$Payload").setFields(fields).setTableName("binary"))));
+
+        IgniteCache<IdKey, Payload> binary = ignite.createCache(new CacheConfiguration<IdKey,
Payload>()
+            .setName("binary").setQueryEntities(Collections.singleton(new QueryEntity()
+                .setKeyType("IdKey").setKeyFields(Collections.singleton("id"))
+                .setValueType("Payload").setFields(fields).setTableName("binary"))));
+
+        regular.put(new IdKey(1), new Payload("foo"));
+        regular.put(new IdKey(2), new Payload("bar"));
+
+        binary.put(new IdKey(1), new Payload("foo"));
+        binary.put(new IdKey(2), new Payload("bar"));
+
+        assertEquals(0, countRows(binary));
+        assertEquals(2, countRows(regular));
+
+        assertContainsExactlyOnce(capture.toString(), MESSAGE_PAYLOAD_VALUE);
+    }
+
+    /**
+     * @throws Exception In case of an error.
+     */
+    public void testValueWriteMultipleQueryEntities() throws Exception {
+        Ignite ignite = startGridWithLogCapture();
+
+        LinkedHashMap<String, String> fields = new LinkedHashMap<>();
+        fields.put("id", "java.lang.Integer");
+        fields.put("str", "java.lang.String");
+
+        IgniteCache<Integer, Payload> binary = ignite.createCache(new CacheConfiguration<Integer,
Payload>()
+            .setName("binary").setQueryEntities(Arrays.asList(
+            new QueryEntity().setKeyType("Foo").setKeyFieldName("id")
+                .setValueType("Bar").setFields(fields).setTableName("regular"),
+            new QueryEntity().setKeyFieldName("id").setValueType("Payload").setFields(fields).setTableName("binary"))));
+
+        binary.put(1, new Payload("foo"));
+        binary.put(2, new Payload("bar"));
+
+        assertEquals(0, countRows(binary));
+
+        assertContainsExactlyOnce(capture.toString(),
+            "valType=o.a.i.i.processors.cache.BinaryTypeMismatchLoggingTest$Payload");
+    }
+
+    /** */
+    private <K> int countRows(IgniteCache<K, ?> binary) {
+        SqlFieldsQuery qry = new SqlFieldsQuery("SELECT COUNT(*) FROM binary");
+
+        List<List<?>> result = binary.query(qry).getAll();
+        return Number.class.cast(result.get(0).get(0)).intValue();
+    }
+
+    /** */
+    private void assertContainsExactlyOnce(String capturedMessages, String message) {
+        assertTrue(capturedMessages.contains(message));
+
+        assertEquals(-1, capturedMessages.indexOf(message, capturedMessages.indexOf(message)
+ 1));
+    }
+
+    /** */
+    private IgniteEx startGridWithLogCapture() throws Exception {
+        IgniteEx ignite = startGrid(0);
+
+        this.capture = new GridStringLogger(false, this.log);
+
+        GridTestUtils.setFieldValue(ignite.context().query(), GridProcessorAdapter.class,"log",
capture);
+
+        return ignite;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids();
+    }
+
+    /** */
+    private static class IdKey {
+        /** */
+        @QuerySqlField
+        private final int id;
+
+        /** */
+        public IdKey(int id) {
+            this.id = id;
+        }
+    }
+
+    /** */
+    private static class Payload {
+        /** */
+        @QuerySqlField
+        private final String str;
+
+        /** */
+        public Payload(String str) {
+            this.str = str;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1963d1a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheWithIndexingTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheWithIndexingTestSuite.java
b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheWithIndexingTestSuite.java
index c896736..12851c5 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheWithIndexingTestSuite.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheWithIndexingTestSuite.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.testsuites;
 
 import junit.framework.TestSuite;
+import org.apache.ignite.internal.processors.cache.BinaryTypeMismatchLoggingTest;
 import org.apache.ignite.internal.processors.cache.CacheBinaryKeyConcurrentQueryTest;
 import org.apache.ignite.internal.processors.cache.CacheConfigurationP2PTest;
 import org.apache.ignite.internal.processors.cache.CacheIndexStreamerTest;
@@ -84,6 +85,8 @@ public class IgniteCacheWithIndexingTestSuite extends TestSuite {
 
         suite.addTestSuite(GridCommandHandlerIndexingTest.class);
 
+        suite.addTestSuite(BinaryTypeMismatchLoggingTest.class);
+
         return suite;
     }
 }


Mime
View raw message