ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject incubator-ignite git commit: ignite-630 Redundant usage of incremental meta key
Date Tue, 12 May 2015 13:40:20 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-630 e62f6d079 -> 060177c13


ignite-630 Redundant usage of incremental meta key


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

Branch: refs/heads/ignite-630
Commit: 060177c13add020ded714300d2da07123431f0c0
Parents: e62f6d0
Author: avinogradov <avinogradov@gridgain.com>
Authored: Tue May 12 16:40:09 2015 +0300
Committer: avinogradov <avinogradov@gridgain.com>
Committed: Tue May 12 16:40:09 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheAdapter.java       | 16 +++++-----------
 .../processors/cache/GridCacheUtils.java         | 19 -------------------
 2 files changed, 5 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/060177c1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 445e613..bfadb3f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -1291,9 +1291,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
         final AffinityTopologyVersion topVer = ctx.affinity().affinityTopologyVersion();
 
         if (!F.isEmpty(keys)) {
-            final int uid = CU.uid(); // Get meta UID for this thread.
-
-            assert keys != null;
+            final Map<KeyCacheObject, GridCacheVersion> keyVers = new HashMap();
 
             for (KeyCacheObject key : keys) {
                 if (key == null)
@@ -1310,11 +1308,9 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
                         if (entry == null)
                             break;
 
-                        // Get version before checking filer.
                         GridCacheVersion ver = entry.version();
 
-                        // Tag entry with current version.
-                        entry.addMeta(uid, ver);
+                        keyVers.put(key, ver);
 
                         break;
                     }
@@ -1334,7 +1330,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
             final Map<KeyCacheObject, CacheObject> map =
                 ret ? U.<KeyCacheObject, CacheObject>newHashMap(keys.size()) : null;
 
-            final Collection<KeyCacheObject> absentKeys = F.view(keys, CU.keyHasMeta(ctx,
uid));
+            final Collection<KeyCacheObject> absentKeys = F.view(keyVers.keySet());
 
             final Collection<KeyCacheObject> loadedKeys = new GridConcurrentHashSet<>();
 
@@ -1351,9 +1347,8 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
 
                         if (entry != null) {
                             try {
-                                GridCacheVersion curVer = entry.removeMeta(uid);
+                                GridCacheVersion curVer = keyVers.get(key);
 
-                                // If entry passed the filter.
                                 if (curVer != null) {
                                     boolean wasNew = entry.isNewLocked();
 
@@ -1378,8 +1373,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
 
                                     if (log.isDebugEnabled()) {
                                         log.debug("Set value loaded from store into entry
[set=" + set + ", " +
-                                            "curVer=" +
-                                            curVer + ", newVer=" + nextVer + ", entry=" +
entry + ']');
+                                            "newVer=" + nextVer + ", entry=" + entry + ']');
                                     }
                                 }
                                 else {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/060177c1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
index 109aa32..6801248 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
@@ -97,16 +97,6 @@ public class GridCacheUtils {
     /** Skip store flag bit mask. */
     public static final int SKIP_STORE_FLAG_MASK = 0x1;
 
-    /** Per-thread generated UID store. */
-    private static final ThreadLocal<Integer> UIDS = new ThreadLocal<Integer>()
{
-        @Override protected Integer initialValue() {
-            return uidGen.getAndIncrement();
-        }
-    };
-
-    /** Generates uid. */
-    private static final AtomicInteger uidGen = new GridAtomicInteger();
-
     /** Empty predicate array. */
     private static final IgnitePredicate[] EMPTY = new IgnitePredicate[0];
 
@@ -253,15 +243,6 @@ public class GridCacheUtils {
     }
 
     /**
-     * Gets per-thread-unique ID for this thread.
-     *
-     * @return ID for this thread.
-     */
-    public static int uid() {
-        return UIDS.get();
-    }
-
-    /**
      * @param msg Message to check.
      * @return {@code True} if preloader message.
      */


Mime
View raw message