Repository: ignite
Updated Branches:
  refs/heads/ignite-5960 8531961f9 -> a7ee714e6


IGNITE-9424 Set proper partition for key during insert - Fixes #4645.


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

Branch: refs/heads/ignite-5960
Commit: dcefc16b6990eccea407dc29c81429b615bbd7fe
Parents: 145a289
Author: Anton Kalashnikov <[email protected]>
Authored: Fri Aug 31 12:21:43 2018 +0300
Committer: Alexey Goncharuk <[email protected]>
Committed: Fri Aug 31 12:21:43 2018 +0300

----------------------------------------------------------------------
 .../cache/IgniteCacheOffheapManagerImpl.java    | 24 ++++++++++++++++----
 1 file changed, 19 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/dcefc16b/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 2fe097c..91c6f3e 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
@@ -101,6 +101,7 @@ import org.apache.ignite.lang.IgniteBiTuple;
 import org.apache.ignite.lang.IgniteClosure;
 import org.apache.ignite.lang.IgniteInClosure;
 import org.apache.ignite.lang.IgnitePredicate;
+import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.internal.pagemem.PageIdAllocator.FLAG_IDX;
@@ -1646,7 +1647,7 @@ public class IgniteCacheOffheapManagerImpl implements 
IgniteCacheOffheapManager
             @Nullable CacheDataRow oldRow) throws IgniteCheckedException {
             int cacheId = grp.storeCacheIdInDataPage() ? cctx.cacheId() : 
CU.UNDEFINED_CACHE_ID;
 
-            DataRow dataRow = new DataRow(key, val, ver, partId, expireTime, 
cacheId);
+            DataRow dataRow = makeDataRow(key, val, ver, expireTime, cacheId);
 
             if (canUpdateOldRow(cctx, oldRow, dataRow) && 
rowStore.updateRow(oldRow.link(), dataRow))
                 dataRow.link(oldRow.link());
@@ -1667,6 +1668,22 @@ public class IgniteCacheOffheapManagerImpl implements 
IgniteCacheOffheapManager
             return dataRow;
         }
 
+        /**
+         * @param key Cache key.
+         * @param val Cache value.
+         * @param ver Version.
+         * @param expireTime Expired time.
+         * @param cacheId Cache id.
+         * @return Made data row.
+         */
+        @NotNull private DataRow makeDataRow(KeyCacheObject key, CacheObject 
val, GridCacheVersion ver, long expireTime,
+            int cacheId) {
+            if (key.partition() == -1)
+                key.partition(partId);
+
+            return new DataRow(key, val, ver, partId, expireTime, cacheId);
+        }
+
         /** {@inheritDoc} */
         @Override public boolean mvccInitialValue(
             GridCacheContext cctx,
@@ -2342,10 +2359,7 @@ public class IgniteCacheOffheapManagerImpl implements 
IgniteCacheOffheapManager
 
                 assert oldRow == null || oldRow.cacheId() == cacheId : oldRow;
 
-                if (key.partition() == -1)
-                    key.partition(partId);
-
-                DataRow dataRow = new DataRow(key, val, ver, partId, 
expireTime, cacheId);
+                DataRow dataRow = makeDataRow(key, val, ver, expireTime, 
cacheId);
 
                 CacheObjectContext coCtx = cctx.cacheObjectContext();
 

Reply via email to