ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject ignite git commit: ignite-db-x-10884
Date Wed, 20 Apr 2016 15:58:59 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-db-x-10884 35d26f4e4 -> f0757ac32


ignite-db-x-10884


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

Branch: refs/heads/ignite-db-x-10884
Commit: f0757ac3214bec2714addf4e57edc8cb3c3f6448
Parents: 35d26f4
Author: sboikov <sboikov@gridgain.com>
Authored: Wed Apr 20 18:20:24 2016 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Wed Apr 20 18:58:53 2016 +0300

----------------------------------------------------------------------
 .../org/apache/ignite/internal/IgnitionEx.java  |  2 +-
 .../processors/cache/GridCacheMapEntry.java     |  5 +-
 .../cache/IgniteCacheOffheapManager.java        | 64 +++++++++++++++-----
 .../processors/cache/database/CacheDataRow.java |  3 +-
 .../GridDistributedCacheAdapter.java            |  7 +--
 .../IgniteCacheObjectProcessorImpl.java         |  4 +-
 .../cache/database/IgniteDbPutGetTest.java      |  4 ++
 .../processors/query/h2/IgniteH2Indexing.java   |  2 +-
 .../query/h2/database/H2RowStore.java           |  3 +-
 .../processors/query/h2/opt/GridH2Row.java      |  5 +-
 .../query/h2/opt/GridH2RowDescriptor.java       |  3 +-
 11 files changed, 73 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/f0757ac3/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
index 7b7c8a6..0edebb3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
@@ -1902,7 +1902,7 @@ public class IgnitionEx {
                 DatabaseConfiguration dbCfg = new DatabaseConfiguration();
 
                 dbCfg.setConcurrencyLevel(Runtime.getRuntime().availableProcessors() * 4);
-                dbCfg.setPageSize(100 * 1024);
+                dbCfg.setPageSize(32 * 1024);
                 dbCfg.setPageCacheSize(100 * 1024 * 1024);
 
                 myCfg.setDatabaseConfiguration(dbCfg);

http://git-wip-us.apache.org/repos/asf/ignite/blob/f0757ac3/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 6f1799f..267d8bc 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
@@ -935,7 +935,10 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter
impleme
 
                     update(ret, expTime, ttl, nextVer);
 
-                    cctx.offheap0().put(key, ret, nextVer, partition());
+                    if (ret != null)
+                        cctx.offheap0().put(key, ret, nextVer, partition());
+                    else
+                        cctx.offheap0().remove(key);
 
                     touch = true;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/f0757ac3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java
index 068a71f..271d0dd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java
@@ -42,6 +42,8 @@ import org.apache.ignite.internal.processors.cache.database.tree.io.IOVersions;
 import org.apache.ignite.internal.processors.cache.database.tree.io.PageIO;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtInvalidPartitionException;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.GridCloseableIteratorAdapter;
+import org.apache.ignite.internal.util.lang.GridCloseableIterator;
 import org.apache.ignite.internal.util.lang.GridCursor;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.S;
@@ -188,15 +190,7 @@ public class IgniteCacheOffheapManager extends GridCacheManagerAdapter
{
             while (cur.next()) {
                 CacheDataRow row = cur.get();
 
-                try {
-                    KeyCacheObject key = row.key() instanceof KeyCacheObject ? (KeyCacheObject)row.key()
:
-                        cctx.toCacheKeyObject(row.key().valueBytes(cctx.cacheObjectContext()));
-
-                    keys.add(key);
-                }
-                catch (IgniteCheckedException e) {
-                    U.error(log, "Failed to obtain cache key: " + row.key(), e);
-                }
+                keys.add(row.key());
             }
 
             GridCacheVersion obsoleteVer = null;
@@ -288,17 +282,57 @@ public class IgniteCacheOffheapManager extends GridCacheManagerAdapter
{
         return cnt;
     }
 
+    public GridCloseableIterator<KeyCacheObject> iterator(final int part) throws IgniteCheckedException
{
+        if (!enabled)
+            return null;
+
+        final GridCursor<? extends CacheDataRow> cur = dataTree.find(null, null);
+
+        return new GridCloseableIteratorAdapter<KeyCacheObject>() {
+            private KeyCacheObject next;
+
+            private void advance() throws IgniteCheckedException {
+                if (next != null)
+                    return;
+
+                while (cur.next()) {
+                    CacheDataRow row = cur.get();
+
+                    if (row.partition() == part) {
+                        next = (KeyCacheObject)row.key();
+
+                        break;
+                    }
+                }
+            }
+
+            @Override protected KeyCacheObject onNext() throws IgniteCheckedException {
+                KeyCacheObject res = next;
+
+                next = null;
+
+                return res;
+            }
+
+            @Override protected boolean onHasNext() throws IgniteCheckedException {
+                advance();
+
+                return next != null;
+            }
+        };
+    }
+
     /**
      *
      */
     static class KeySearchRow {
         /** */
-        protected final CacheObject key;
+        protected final KeyCacheObject key;
 
         /**
          * @param key Key.
          */
-        public KeySearchRow(CacheObject key) {
+        public KeySearchRow(KeyCacheObject key) {
             this.key = key;
         }
 
@@ -331,7 +365,7 @@ public class IgniteCacheOffheapManager extends GridCacheManagerAdapter
{
          * @param part Partition.
          * @param link Link.
          */
-        public DataRow(CacheObject key, CacheObject val, GridCacheVersion ver, int part,
long link) {
+        public DataRow(KeyCacheObject key, CacheObject val, GridCacheVersion ver, int part,
long link) {
             super(key);
 
             this.val = val;
@@ -341,7 +375,7 @@ public class IgniteCacheOffheapManager extends GridCacheManagerAdapter
{
         }
 
         /** {@inheritDoc} */
-        @Override public CacheObject key() {
+        @Override public KeyCacheObject key() {
             return key;
         }
 
@@ -533,7 +567,7 @@ public class IgniteCacheOffheapManager extends GridCacheManagerAdapter
{
 
             /** {@inheritDoc} */
             @Override public KeySearchRow create(ByteBuffer buf, long link, GridCacheContext
cctx) throws IgniteCheckedException {
-                CacheObject key = cctx.cacheObjects().toCacheObject(cctx.cacheObjectContext(),
buf);
+                KeyCacheObject key = cctx.cacheObjects().toKeyCacheObject(cctx.cacheObjectContext(),
buf);
 
                 return new KeySearchRow(key);
             }
@@ -548,7 +582,7 @@ public class IgniteCacheOffheapManager extends GridCacheManagerAdapter
{
 
             /** {@inheritDoc} */
             @Override public DataRow create(ByteBuffer buf, long link, GridCacheContext cctx)
throws IgniteCheckedException {
-                CacheObject key = cctx.cacheObjects().toCacheObject(cctx.cacheObjectContext(),
buf);
+                KeyCacheObject key = cctx.cacheObjects().toKeyCacheObject(cctx.cacheObjectContext(),
buf);
                 CacheObject val = cctx.cacheObjects().toCacheObject(cctx.cacheObjectContext(),
buf);
 
                 int topVer = buf.getInt();

http://git-wip-us.apache.org/repos/asf/ignite/blob/f0757ac3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/CacheDataRow.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/CacheDataRow.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/CacheDataRow.java
index a4cbd32..2277e31 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/CacheDataRow.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/CacheDataRow.java
@@ -18,13 +18,14 @@
 package org.apache.ignite.internal.processors.cache.database;
 
 import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 
 /**
  *
  */
 public interface CacheDataRow {
-    public CacheObject key();
+    public KeyCacheObject key();
 
     public CacheObject value();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/f0757ac3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java
index 1709b0f..424914e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheAdapter.java
@@ -411,12 +411,11 @@ public abstract class GridDistributedCacheAdapter<K, V> extends
GridCacheAdapter
                                 }
                             }
 
-                            GridCloseableIterator<Map.Entry<byte[], GridCacheSwapEntry>>
iter =
-                                dht.context().swap().iterator(part);
+                            GridCloseableIterator<KeyCacheObject> iter = dht.context().offheap0().iterator(part);
 
                             if (iter != null) {
-                                for (Map.Entry<byte[], GridCacheSwapEntry> e : iter)
-                                    dataLdr.removeDataInternal(ctx.toCacheKeyObject(e.getKey()));
+                                for (KeyCacheObject key : iter)
+                                    dataLdr.removeDataInternal(key);
                             }
                         }
                         finally {

http://git-wip-us.apache.org/repos/asf/ignite/blob/f0757ac3/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
index 9852c23..d2695a9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
@@ -197,10 +197,10 @@ public class IgniteCacheObjectProcessorImpl extends GridProcessorAdapter
impleme
 
     /** {@inheritDoc} */
     @Override public KeyCacheObject toKeyCacheObject(CacheObjectContext ctx, ByteBuffer buf)
throws IgniteCheckedException {
-        byte type = buf.get();
-
         int len = buf.getInt();
 
+        byte type = buf.get();
+
         byte[] data = new byte[len];
 
         buf.get(data);

http://git-wip-us.apache.org/repos/asf/ignite/blob/f0757ac3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/database/IgniteDbPutGetTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/database/IgniteDbPutGetTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/database/IgniteDbPutGetTest.java
index a83422d..e938291 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/database/IgniteDbPutGetTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/database/IgniteDbPutGetTest.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.cache.database;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.DatabaseConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
@@ -28,6 +29,8 @@ 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.CacheWriteSynchronizationMode.*;
+
 /**
  *
  */
@@ -53,6 +56,7 @@ public class IgniteDbPutGetTest extends GridCommonAbstractTest {
 
         CacheConfiguration ccfg = new CacheConfiguration();
 
+        ccfg.setWriteSynchronizationMode(FULL_SYNC);
         ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
 
         cfg.setCacheConfiguration(ccfg);

http://git-wip-us.apache.org/repos/asf/ignite/blob/f0757ac3/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 a3695c2..0d4a1fb 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
@@ -2572,7 +2572,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
         }
 
         /** {@inheritDoc} */
-        @Override public GridH2Row createRow(CacheObject key, int partId, @Nullable CacheObject
val, GridCacheVersion ver,
+        @Override public GridH2Row createRow(KeyCacheObject key, int partId, @Nullable CacheObject
val, GridCacheVersion ver,
             long expirationTime) throws IgniteCheckedException {
             GridH2Row row;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/f0757ac3/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2RowStore.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2RowStore.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2RowStore.java
index cd0cc4b..764e2e3 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2RowStore.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2RowStore.java
@@ -24,6 +24,7 @@ import org.apache.ignite.internal.pagemem.Page;
 import org.apache.ignite.internal.pagemem.PageIdUtils;
 import org.apache.ignite.internal.processors.cache.CacheObject;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.database.RowStore;
 import org.apache.ignite.internal.processors.cache.database.freelist.FreeList;
 import org.apache.ignite.internal.processors.cache.database.tree.io.DataPageIO;
@@ -80,7 +81,7 @@ public class H2RowStore extends RowStore<GridH2Row> {
                 // Skip entry size.
                 buf.getShort();
 
-                CacheObject key = coctx.processor().toCacheObject(coctx, buf);
+                KeyCacheObject key = coctx.processor().toKeyCacheObject(coctx, buf);
                 CacheObject val = coctx.processor().toCacheObject(coctx, buf);
 
                 int topVer = buf.getInt();

http://git-wip-us.apache.org/repos/asf/ignite/blob/f0757ac3/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Row.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Row.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Row.java
index a84ad20..227cb85 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Row.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Row.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.internal.processors.query.h2.opt;
 
 import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.internal.processors.cache.database.CacheDataRow;
 import org.h2.result.Row;
@@ -31,7 +32,7 @@ public class GridH2Row extends Row implements GridSearchRowPointer, CacheDataRow
     public long link; // TODO remove
 
     /** */
-    public CacheObject key; // TODO remove
+    public KeyCacheObject key; // TODO remove
 
     /** */
     public CacheObject val; // TODO remove
@@ -65,7 +66,7 @@ public class GridH2Row extends Row implements GridSearchRowPointer, CacheDataRow
     }
 
     /** {@inheritDoc} */
-    @Override public CacheObject key() {
+    @Override public KeyCacheObject key() {
         return key;
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/f0757ac3/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2RowDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2RowDescriptor.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2RowDescriptor.java
index 4d5c295..42a667a 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2RowDescriptor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2RowDescriptor.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.query.h2.opt;
 
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
 import org.apache.ignite.internal.util.offheap.unsafe.GridOffHeapSmartPointerFactory;
@@ -46,7 +47,7 @@ public interface GridH2RowDescriptor extends GridOffHeapSmartPointerFactory<Grid
      * @return Row.
      * @throws IgniteCheckedException If failed.
      */
-    public GridH2Row createRow(CacheObject key, int part, @Nullable CacheObject val, GridCacheVersion
ver, long expirationTime)
+    public GridH2Row createRow(KeyCacheObject key, int part, @Nullable CacheObject val, GridCacheVersion
ver, long expirationTime)
         throws IgniteCheckedException;
 
     /**


Mime
View raw message