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-4652 Use invoke for regular updates so that it is possible to use 'fast' update if value size did not change.
Date Mon, 20 Feb 2017 08:28:27 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-4652 0d4e951aa -> f71efda55


ignite-4652 Use invoke for regular updates so that it is possible to use 'fast' update if
value size did not change.


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

Branch: refs/heads/ignite-4652
Commit: f71efda55852f786cf615f34770dbcb690efa292
Parents: 0d4e951
Author: sboikov <sboikov@gridgain.com>
Authored: Mon Feb 20 11:28:21 2017 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Mon Feb 20 11:28:21 2017 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheMapEntry.java     | 74 ++++++++++++++++++--
 1 file changed, 67 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/f71efda5/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 ed2cf1b..7118a8b 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
@@ -3150,13 +3150,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter
impleme
         assert Thread.holdsLock(this);
         assert val != null : "null values in update for key: " + key;
 
-        cctx.offheap().update(key,
-            val,
-            ver,
-            expireTime,
-            partition(),
-            localPartition(),
-            oldRow);
+        cctx.offheap().invoke(key,  localPartition(), new UpdateClosure(this, val, ver, expireTime));
     }
 
     /**
@@ -3812,6 +3806,72 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter
impleme
     /**
      *
      */
+    private static class UpdateClosure implements IgniteCacheOffheapManager.OffheapInvokeClosure
{
+        /** */
+        private final GridCacheMapEntry entry;
+
+        /** */
+        private final CacheObject val;
+
+        /** */
+        private final GridCacheVersion ver;
+
+        /** */
+        private final long expireTime;
+
+        /** */
+        private CacheDataRow newRow;
+
+        /** */
+        private IgniteTree.OperationType treeOp = IgniteTree.OperationType.PUT;
+
+        /**
+         * @param entry Entry.
+         * @param val New value.
+         * @param ver New version.
+         * @param expireTime New expire time.
+         */
+        UpdateClosure(GridCacheMapEntry entry, CacheObject val, GridCacheVersion ver, long
expireTime) {
+            this.entry = entry;
+            this.val = val;
+            this.ver = ver;
+            this.expireTime = expireTime;
+        }
+
+        /** {@inheritDoc} */
+        @Override public void call(@Nullable CacheDataRow oldRow) throws IgniteCheckedException
{
+            if (oldRow != null)
+                oldRow.key(entry.key);
+
+            newRow = entry.localPartition().dataStore().createRow(entry.key,
+                val,
+                ver,
+                expireTime,
+                oldRow);
+
+            treeOp = oldRow != null && oldRow.link() == newRow.link() ?
+                IgniteTree.OperationType.NOOP : IgniteTree.OperationType.PUT;
+        }
+
+        /** {@inheritDoc} */
+        @Override public CacheDataRow newRow() {
+            return newRow;
+        }
+
+        /** {@inheritDoc} */
+        @Override public IgniteTree.OperationType operationType() {
+            return treeOp;
+        }
+
+        /** {@inheritDoc} */
+        @Nullable @Override public CacheDataRow oldRow() {
+            return null;
+        }
+    }
+
+    /**
+     *
+     */
     private static class AtomicCacheUpdateClosure implements IgniteCacheOffheapManager.OffheapInvokeClosure
{
         /** */
         private final GridCacheMapEntry entry;


Mime
View raw message