Merge branch 'ignite-db' of https://github.com/gridgain/apache-ignite into 
ignite-db-1

# Conflicts:
#       
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
#       
modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/BPlusTreeRefIndex.java
#       
modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbSingleNodePutGetSelfTest.java


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

Branch: refs/heads/ignite-db-x-10884
Commit: a020615f2bee3f0e8140ea75e4ca8504fcc96f28
Parents: bf59473 533357d
Author: S.Vladykin <[email protected]>
Authored: Tue Apr 5 08:12:23 2016 +0300
Committer: S.Vladykin <[email protected]>
Committed: Tue Apr 5 08:12:23 2016 +0300

----------------------------------------------------------------------
 .../binary/BinaryObjectOffheapImpl.java         |   1 +
 .../internal/mem/OutOfMemoryException.java      |   3 +
 .../internal/pagemem/impl/PageMemoryImpl.java   |  24 +-
 .../processors/cache/GridCacheMapEntry.java     |  15 +-
 .../processors/cache/GridCacheProcessor.java    |   2 +-
 .../processors/cache/GridCacheSwapManager.java  |  23 +-
 .../dht/GridDhtPartitionTopologyImpl.java       |   2 +-
 .../cache/query/GridCacheQueryManager.java      |  20 +-
 .../processors/query/GridQueryIndexing.java     |  12 +-
 .../processors/query/GridQueryProcessor.java    |  21 +-
 .../processors/query/h2/IgniteH2Indexing.java   |  66 ++--
 .../query/h2/database/BPlusTreeRefIndex.java    |  55 +--
 .../query/h2/database/CompareUtils.java         | 332 +++++++++++++++++++
 .../query/h2/opt/GridH2AbstractKeyValueRow.java |   2 +-
 .../query/h2/opt/GridH2KeyValueRowOnheap.java   |   8 +
 .../query/h2/opt/GridH2RowDescriptor.java       |  11 +-
 .../processors/query/h2/opt/GridH2Table.java    |  21 +-
 .../IgniteCacheQueryMultiThreadedSelfTest.java  |   8 +-
 .../IgniteDbSingleNodePutGetSelfTest.java       |  89 ++++-
 .../h2/GridIndexingSpiAbstractSelfTest.java     |  27 +-
 20 files changed, 617 insertions(+), 125 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/a020615f/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/BPlusTreeRefIndex.java
----------------------------------------------------------------------
diff --cc 
modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/BPlusTreeRefIndex.java
index 8dea5ae,036e2a8..ea56d56
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/BPlusTreeRefIndex.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/BPlusTreeRefIndex.java
@@@ -17,29 -17,21 +17,31 @@@
  
  package org.apache.ignite.internal.processors.query.h2.database;
  
 +import java.nio.ByteBuffer;
 +import java.util.ArrayList;
 +import java.util.Arrays;
 +import java.util.Collections;
 +import java.util.Comparator;
 +import java.util.List;
 +import java.util.concurrent.ThreadLocalRandom;
 +import java.util.concurrent.atomic.AtomicLong;
  import org.apache.ignite.IgniteCheckedException;
  import org.apache.ignite.IgniteException;
 -import org.apache.ignite.IgniteInterruptedException;
 +import org.apache.ignite.internal.IgniteInterruptedCheckedException;
  import org.apache.ignite.internal.pagemem.FullPageId;
  import org.apache.ignite.internal.pagemem.Page;
+ import org.apache.ignite.internal.pagemem.PageIdUtils;
  import org.apache.ignite.internal.pagemem.PageMemory;
  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.version.GridCacheVersion;
  import org.apache.ignite.internal.processors.query.h2.opt.GridH2Row;
+ import org.apache.ignite.internal.processors.query.h2.opt.GridH2RowDescriptor;
  import org.apache.ignite.internal.processors.query.h2.opt.GridH2Table;
 +import org.apache.ignite.internal.util.lang.GridTreePrinter;
  import org.apache.ignite.internal.util.typedef.F;
 +import org.apache.ignite.internal.util.typedef.internal.U;
  import org.h2.engine.Session;
  import org.h2.index.Cursor;
  import org.h2.index.IndexType;

http://git-wip-us.apache.org/repos/asf/ignite/blob/a020615f/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbSingleNodePutGetSelfTest.java
----------------------------------------------------------------------
diff --cc 
modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbSingleNodePutGetSelfTest.java
index 58f1549,e481be6..c147379
--- 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbSingleNodePutGetSelfTest.java
+++ 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbSingleNodePutGetSelfTest.java
@@@ -420,93 -430,52 +430,138 @@@ public class IgniteDbSingleNodePutGetSe
          }
      }
  
 +    public void testPutGetRemoveMultipleForward() throws Exception {
 +        IgniteEx ig = grid(0);
 +
 +        final IgniteCache<Integer, DbValue> cache = ig.cache(null);
 +
 +        GridCacheAdapter<Object, Object> internalCache = 
ig.context().cache().internalCache();
 +
 +        int cnt = 100_000;
 +
 +        X.println("Put.");
 +
 +        for (int i = 0; i < cnt; i++) {
 +            DbValue v0 = new DbValue(i, "test-value", i);
 +
 +//            if (i % 100 == 0)
 +//                X.println(" --> " + i);
 +
 +            cache.put(i, v0);
 +
 +            checkEmpty(internalCache, i);
 +
 +            assertEquals(v0, cache.get(i));
 +        }
 +
 +        X.println("Start removing.");
 +
 +        for (int i = 0; i < cnt; i++) {
 +            if (i % 100 == 0) {
 +                X.println("-> " + i);
 +
 +//                assertEquals((long)(cnt - i),
 +//                    cache.query(new SqlFieldsQuery("select count(*) from 
dbvalue")).getAll().get(0).get(0));
 +            }
 +
 +            cache.remove(i);
 +
 +            assertNull(cache.get(i));
 +
 +            if (i + 1 < cnt)
 +                assertEquals(new DbValue(i + 1, "test-value", i + 1), 
cache.get(i + 1));
 +        }
 +    }
 +
 +    public void testPutGetRemoveMultipleBackward() throws Exception {
 +        IgniteEx ig = grid(0);
 +
 +        final IgniteCache<Integer, DbValue> cache = ig.cache(null);
 +
 +        GridCacheAdapter<Object, Object> internalCache = 
ig.context().cache().internalCache();
 +
 +        int cnt = 100_000;
 +
 +        X.println("Put.");
 +
 +        for (int i = 0; i < cnt; i++) {
 +            DbValue v0 = new DbValue(i, "test-value", i);
 +
 +//            if (i % 100 == 0)
 +//                X.println(" --> " + i);
 +
 +            cache.put(i, v0);
 +
 +            checkEmpty(internalCache, i);
 +
 +            assertEquals(v0, cache.get(i));
 +        }
 +
 +        X.println("Start removing in backward direction.");
 +
 +        for (int i = cnt - 1; i >= 0; i--) {
 +            if (i % 100 == 0) {
 +                X.println("-> " + i);
 +
 +//                assertEquals((long)(cnt - i),
 +//                    cache.query(new SqlFieldsQuery("select count(*) from 
dbvalue")).getAll().get(0).get(0));
 +            }
 +
 +            cache.remove(i);
 +
 +            assertNull(cache.get(i));
 +
 +            if (i - 1 >= 0)
 +                assertEquals(new DbValue(i - 1, "test-value", i - 1), 
cache.get(i - 1));
 +        }
 +    }
 +
-     private void checkEmpty(final GridCacheAdapter internalCache, final int 
key) throws Exception {
+     /**
+      * @throws Exception if failed.
+      */
+     public void testObjectKey() throws Exception {
+         IgniteEx ig = grid(0);
+ 
+         final IgniteCache<DbKey, DbValue> cache = ig.cache("non-primitive");
+ 
+         GridCacheAdapter<Object, Object> internalCache = 
ig.context().cache().internalCache("non-primitive");
+ 
+         int cnt = 100_000;
+ 
+         Map<DbKey, DbValue> map = new HashMap<>();
+ 
+         X.println("Put start");
+ 
+         for (int a = 0; a < cnt; a++) {
+             DbValue v0 = new DbValue(a, "test-value", a);
+ 
+ //            if (a % 100 == 0)
+ //                X.println(" --> " + k + " = " + i);
+ 
+             DbKey k0 = new DbKey(a);
+ 
+             map.put(k0, v0);
+             cache.put(k0, v0);
+ 
+             checkEmpty(internalCache, k0);
+ 
+ //            assertEquals(v0, cache.get(k0));
+ //            for (Map.Entry<Integer,DbValue> entry : map.entrySet())
+ //                assertEquals(entry.getValue(), cache.get(entry.getKey()));
+         }
+ 
+         X.println("Get start: " + map.size());
+ 
+         for (DbKey i : map.keySet()) {
+ //            checkEmpty(internalCache, i);
+ 
+ //            X.println(" <-- " + i);
+ 
+             assertEquals(map.get(i), cache.get(i));
+         }
+     }
+ 
+     private void checkEmpty(final GridCacheAdapter internalCache, final 
Object key) throws Exception {
          GridTestUtils.waitForCondition(new PA() {
              @Override public boolean apply() {
                  return internalCache.peekEx(key) == null;

Reply via email to