ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntikho...@apache.org
Subject ignite git commit: IGNITE-10837 WIP
Date Wed, 20 Jan 2016 10:32:04 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-gg-10837 6652d871f -> 888cfbbc8


IGNITE-10837 WIP


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

Branch: refs/heads/ignite-gg-10837
Commit: 888cfbbc8cfb23232a6040f2614e74ae0d39d3b7
Parents: 6652d87
Author: nikolay_tikhonov <ntikhonov@gridgain.com>
Authored: Wed Jan 20 13:31:53 2016 +0300
Committer: nikolay_tikhonov <ntikhonov@gridgain.com>
Committed: Wed Jan 20 13:31:53 2016 +0300

----------------------------------------------------------------------
 .../processors/cache/CacheOperationContext.java | 41 +++++---------------
 .../processors/cache/GridCacheAdapter.java      |  8 ++--
 .../processors/cache/GridCacheProxyImpl.java    | 11 ++++--
 .../processors/cache/IgniteCacheProxy.java      | 21 ++++++----
 .../transactions/IgniteTxLocalAdapter.java      |  7 +---
 5 files changed, 37 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/888cfbbc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOperationContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOperationContext.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOperationContext.java
index 2ac8ae0..f39a09d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOperationContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOperationContext.java
@@ -73,31 +73,6 @@ public class CacheOperationContext implements Serializable {
      * @param subjId Subject ID.
      * @param keepBinary Keep binary flag.
      * @param expiryPlc Expiry policy.
-     */
-    public CacheOperationContext(
-        boolean skipStore,
-        @Nullable UUID subjId,
-        boolean keepBinary,
-        @Nullable ExpiryPolicy expiryPlc,
-        boolean noRetries) {
-        this.skipStore = skipStore;
-
-        this.subjId = subjId;
-
-        this.keepBinary = keepBinary;
-
-        this.expiryPlc = expiryPlc;
-
-        this.noRetries = noRetries;
-
-        this.dataCenterId = null;
-    }
-
-    /**
-     * @param skipStore Skip store flag.
-     * @param subjId Subject ID.
-     * @param keepBinary Keep binary flag.
-     * @param expiryPlc Expiry policy.
      * @param dataCenterId Data center id.
      */
     public CacheOperationContext(
@@ -145,7 +120,8 @@ public class CacheOperationContext implements Serializable {
             subjId,
             true,
             expiryPlc,
-            noRetries);
+            noRetries,
+            dataCenterId);
     }
 
     /**
@@ -178,7 +154,8 @@ public class CacheOperationContext implements Serializable {
             subjId,
             keepBinary,
             expiryPlc,
-            noRetries);
+            noRetries,
+            dataCenterId);
     }
 
     /**
@@ -200,7 +177,8 @@ public class CacheOperationContext implements Serializable {
             subjId,
             keepBinary,
             expiryPlc,
-            noRetries);
+            noRetries,
+            dataCenterId);
     }
 
     /**
@@ -222,7 +200,8 @@ public class CacheOperationContext implements Serializable {
             subjId,
             true,
             plc,
-            noRetries);
+            noRetries,
+            dataCenterId);
     }
 
     /**
@@ -235,8 +214,8 @@ public class CacheOperationContext implements Serializable {
             subjId,
             keepBinary,
             expiryPlc,
-            noRetries
-        );
+            noRetries,
+            dataCenterId);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/888cfbbc/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 2582e6c..c76aaa6 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
@@ -450,7 +450,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
 
     /** {@inheritDoc} */
     @Override public GridCacheProxyImpl<K, V> forSubjectId(UUID subjId) {
-        CacheOperationContext opCtx = new CacheOperationContext(false, subjId, false, null,
false);
+        CacheOperationContext opCtx = new CacheOperationContext(false, subjId, false, null,
false, null);
 
         return new GridCacheProxyImpl<>(ctx, this, opCtx);
     }
@@ -462,14 +462,14 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
 
     /** {@inheritDoc} */
     @Override public GridCacheProxyImpl<K, V> setSkipStore(boolean skipStore) {
-        CacheOperationContext opCtx = new CacheOperationContext(true, null, false, null,
false);
+        CacheOperationContext opCtx = new CacheOperationContext(true, null, false, null,
false, null);
 
         return new GridCacheProxyImpl<>(ctx, this, opCtx);
     }
 
     /** {@inheritDoc} */
     @Override public <K1, V1> GridCacheProxyImpl<K1, V1> keepBinary() {
-        CacheOperationContext opCtx = new CacheOperationContext(false, null, true, null,
false);
+        CacheOperationContext opCtx = new CacheOperationContext(false, null, true, null,
false, null);
 
         return new GridCacheProxyImpl<>((GridCacheContext<K1, V1>)ctx, (GridCacheAdapter<K1,
V1>)this, opCtx);
     }
@@ -486,7 +486,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
         assert !CU.isAtomicsCache(ctx.name());
         assert !CU.isMarshallerCache(ctx.name());
 
-        CacheOperationContext opCtx = new CacheOperationContext(false, null, false, plc,
false);
+        CacheOperationContext opCtx = new CacheOperationContext(false, null, false, plc,
false, null);
 
         return new GridCacheProxyImpl<>(ctx, this, opCtx);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/888cfbbc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
index 8ffd273..3a53942 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
@@ -209,7 +209,8 @@ public class GridCacheProxyImpl<K, V> implements IgniteInternalCache<K,
V>, Exte
     /** {@inheritDoc} */
     @Override public GridCacheProxyImpl<K, V> forSubjectId(UUID subjId) {
         return new GridCacheProxyImpl<>(ctx, delegate,
-            opCtx != null ? opCtx.forSubjectId(subjId) : new CacheOperationContext(false,
subjId, false, null, false));
+            opCtx != null ? opCtx.forSubjectId(subjId) :
+                new CacheOperationContext(false, subjId, false, null, false, null));
     }
 
     /** {@inheritDoc} */
@@ -221,7 +222,8 @@ public class GridCacheProxyImpl<K, V> implements IgniteInternalCache<K,
V>, Exte
                 return this;
 
             return new GridCacheProxyImpl<>(ctx, delegate,
-                opCtx != null ? opCtx.setSkipStore(skipStore) : new CacheOperationContext(true,
null, false, null, false));
+                opCtx != null ? opCtx.setSkipStore(skipStore) :
+                    new CacheOperationContext(true, null, false, null, false, null));
         }
         finally {
             gate.leave(prev);
@@ -236,7 +238,7 @@ public class GridCacheProxyImpl<K, V> implements IgniteInternalCache<K,
V>, Exte
 
         return new GridCacheProxyImpl<>((GridCacheContext<K1, V1>)ctx,
             (GridCacheAdapter<K1, V1>)delegate,
-            opCtx != null ? opCtx.keepBinary() : new CacheOperationContext(false, null, true,
null, false));
+            opCtx != null ? opCtx.keepBinary() : new CacheOperationContext(false, null, true,
null, false, null));
     }
 
     /** {@inheritDoc} */
@@ -1608,7 +1610,8 @@ public class GridCacheProxyImpl<K, V> implements IgniteInternalCache<K,
V>, Exte
 
         try {
             return new GridCacheProxyImpl<>(ctx, delegate,
-                opCtx != null ? opCtx.withExpiryPolicy(plc) : new CacheOperationContext(false,
null, false, plc, false));
+                opCtx != null ? opCtx.withExpiryPolicy(plc) :
+                    new CacheOperationContext(false, null, false, plc, false, null));
         }
         finally {
             gate.leave(prev);

http://git-wip-us.apache.org/repos/asf/ignite/blob/888cfbbc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
index fb549eb..9e66d4d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
@@ -307,7 +307,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K,
V
 
         try {
             CacheOperationContext prj0 = opCtx != null ? opCtx.withExpiryPolicy(plc) :
-                new CacheOperationContext(false, null, false, plc, false);
+                new CacheOperationContext(false, null, false, plc, false, null);
 
             return new IgniteCacheProxy<>(ctx, delegate, prj0, isAsync(), lock);
         }
@@ -339,7 +339,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K,
V
                 return this;
 
             CacheOperationContext opCtx0 = opCtx != null ? opCtx.setNoRetries(true) :
-                new CacheOperationContext(false, null, false, null, true);
+                new CacheOperationContext(false, null, false, null, true, null);
 
             return new IgniteCacheProxy<>(ctx,
                 delegate,
@@ -1788,7 +1788,8 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K,
V
                     opCtx != null ? opCtx.subjectId() : null,
                     true,
                     opCtx != null ? opCtx.expiry() : null,
-                    opCtx != null && opCtx.noRetries());
+                    opCtx != null && opCtx.noRetries(),
+                    opCtx != null ? opCtx.dataCenterId() : null);
 
             return new IgniteCacheProxy<>((GridCacheContext<K1, V1>)ctx,
                 (GridCacheAdapter<K1, V1>)delegate,
@@ -1805,10 +1806,15 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K,
V
      * @return Projection for data center id.
      */
     @SuppressWarnings("unchecked")
-    public <K, V> IgniteCache<K, V> withDataCenterId(byte dataCenterId) {
+    public IgniteCache<K, V> withDataCenterId(byte dataCenterId) {
         CacheOperationContext prev = onEnter(gate, opCtx);
 
         try {
+            Byte prevDataCenterId = opCtx != null ? opCtx.dataCenterId() : null;
+
+            if (prevDataCenterId != null && dataCenterId == prevDataCenterId)
+                return this;
+
             CacheOperationContext opCtx0 =
                 new CacheOperationContext(
                     opCtx != null && opCtx.skipStore(),
@@ -1818,8 +1824,8 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K,
V
                     opCtx != null && opCtx.noRetries(),
                     dataCenterId);
 
-            return new IgniteCacheProxy<>((GridCacheContext<K, V>)ctx,
-                (GridCacheAdapter<K, V>)delegate,
+            return new IgniteCacheProxy<>(ctx,
+                delegate,
                 opCtx0,
                 isAsync(),
                 lock);
@@ -1848,7 +1854,8 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K,
V
                     opCtx != null ? opCtx.subjectId() : null,
                     opCtx != null && opCtx.isKeepBinary(),
                     opCtx != null ? opCtx.expiry() : null,
-                    opCtx != null && opCtx.noRetries());
+                    opCtx != null && opCtx.noRetries(),
+                    opCtx != null ? opCtx.dataCenterId() : null);
 
             return new IgniteCacheProxy<>(ctx,
                 delegate,

http://git-wip-us.apache.org/repos/asf/ignite/blob/888cfbbc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
index 4b7b992..aad9841 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
@@ -22,7 +22,6 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
@@ -2075,8 +2074,6 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements
Ig
                 transform = true;
 
             GridCacheVersion drVer = dataCenterId != null ? cctx.versions().next(dataCenterId)
: null;
-            long drTtl = singleRmv ? -1L : CU.TTL_ETERNAL;
-            long drExpireTime = singleRmv ? -1L : CU.EXPIRE_TIME_ETERNAL;
 
             boolean loadMissed = enlistWriteEntry(cacheCtx,
                 cacheKey,
@@ -2088,8 +2085,8 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements
Ig
                 lockOnly,
                 filter,
                 /*drVer*/drVer,
-                drTtl,
-                drExpireTime,
+                /*drTtl*/-1L,
+                /*drExpireTime*/-1L,
                 ret,
                 /*enlisted*/null,
                 skipStore,


Mime
View raw message