You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/10/17 10:16:03 UTC

[3/4] ignite git commit: ignite-3478 Tests restructured

ignite-3478 Tests restructured


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

Branch: refs/heads/ignite-5937
Commit: 47ef5c8815da3af36aa717520894f6900562bf6f
Parents: e0897f1
Author: sboikov <sb...@gridgain.com>
Authored: Tue Oct 17 13:02:22 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Oct 17 13:03:16 2017 +0300

----------------------------------------------------------------------
 .../cache/IgniteCacheOffheapManagerImpl.java    | 18 +++----
 .../cache/mvcc/CacheMvccSqlQueriesTest.java     | 51 ++++++++++++++++++++
 2 files changed, 60 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/47ef5c88/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
index e55a4c6..e04f070 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
@@ -1545,15 +1545,15 @@ public class IgniteCacheOffheapManagerImpl implements IgniteCacheOffheapManager
 
                 cleanup(updateRow.cleanupRows(), false);
 
-//                CacheDataRow oldRow = updateRow.oldRow();
-//
-//                if (oldRow != null)
-//                    oldRow.key(key);
-//
-//                GridCacheQueryManager qryMgr = cctx.queries();
-//
-//                if (qryMgr.enabled())
-//                    qryMgr.store(updateRow, oldRow);
+                CacheDataRow oldRow = updateRow.oldRow();
+
+                if (oldRow != null)
+                    oldRow.key(key);
+
+                GridCacheQueryManager qryMgr = cctx.queries();
+
+                if (qryMgr.enabled())
+                    qryMgr.store(updateRow, oldRow);
 
                 return updateRow.activeTransactions();
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/47ef5c88/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlQueriesTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlQueriesTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlQueriesTest.java
index 7ba1b32..33908bf 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlQueriesTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlQueriesTest.java
@@ -17,9 +17,19 @@
 
 package org.apache.ignite.internal.processors.cache.mvcc;
 
+import java.io.Serializable;
+import java.util.List;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.query.SqlQuery;
+import org.apache.ignite.cache.query.annotations.QuerySqlField;
 import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.lang.IgniteInClosure;
 
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
 /**
  *
  */
@@ -36,4 +46,45 @@ public class CacheMvccSqlQueriesTest extends CacheMvccAbstractTest {
         }, false, ReadMode.SQL_ALL);
     }
 
+    /**
+     * @throws Exception If failed.
+     */
+    public void testSqlSimple() throws Exception {
+        Ignite srv0 = startGrid(0);
+
+        IgniteCache<Integer, MvccTestSqlIndexValue> cache =  (IgniteCache)srv0.createCache(
+            cacheConfiguration(PARTITIONED, FULL_SYNC, 0, DFLT_PARTITION_COUNT).
+            setIndexedTypes(Integer.class, MvccTestSqlIndexValue.class));
+
+        cache.put(1, new MvccTestSqlIndexValue(1));
+        cache.put(1, new MvccTestSqlIndexValue(2));
+
+        SqlQuery<Integer, MvccTestSqlIndexValue> qry =
+            new SqlQuery<>(MvccTestSqlIndexValue.class, "_key >= 0");
+
+        List<IgniteCache.Entry<Integer, MvccTestSqlIndexValue>> res = cache.query(qry).getAll();
+
+        assertEquals(1, res.size());
+    }
+
+    /**
+     *
+     */
+    static class MvccTestSqlIndexValue implements Serializable {
+        /** */
+        @QuerySqlField(index = true)
+        private int idxVal1;
+
+        /**
+         * @param idxVal1 Indexed value 1.
+         */
+        public MvccTestSqlIndexValue(int idxVal1) {
+            this.idxVal1 = idxVal1;
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return S.toString(MvccTestSqlIndexValue.class, this);
+        }
+    }
 }