ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [20/36] incubator-ignite git commit: # ignite-283: WIP.
Date Wed, 18 Feb 2015 10:06:48 GMT
# ignite-283: WIP.


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

Branch: refs/heads/ignite-283
Commit: 362bf16a0d9038cab1503fb89944ae38f208fd28
Parents: eee156a
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Tue Feb 17 16:23:44 2015 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Tue Feb 17 16:23:44 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheAdapter.java      |  27 +--
 .../processors/cache/GridCacheMapEntry.java     | 187 +++++++++----------
 .../processors/cache/GridCacheUtils.java        |  46 ++++-
 .../distributed/dht/GridDhtCacheAdapter.java    |  15 +-
 .../dht/atomic/GridDhtAtomicCache.java          |   4 +-
 .../dht/atomic/GridDhtAtomicUpdateRequest.java  |  25 +--
 .../distributed/near/GridNearAtomicCache.java   |   2 +-
 .../dataload/IgniteDataLoaderImpl.java          |   3 +-
 8 files changed, 158 insertions(+), 151 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/362bf16a/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 229cecf..fa3cb17 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
@@ -3850,16 +3850,10 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K,
V>,
                     throws IgniteException {
                     assert ver == null;
 
-                    long ttl = 0;
+                    Long ttl = CU.ttlForLoad(plc);
 
-                    if (plc != null) {
-                        ttl = CU.toTtl(plc.getExpiryForCreation());
-
-                        if (ttl == CU.TTL_ZERO)
-                            return;
-                        else if (ttl == CU.TTL_NOT_CHANGED)
-                            ttl = 0;
-                    }
+                    if (ttl == null)
+                        return;
 
                     loadEntry(key, val, ver0, p, topVer, replicate, ttl);
                 }
@@ -3894,7 +3888,8 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K,
V>,
         GridCacheEntryEx<K, V> entry = entryEx(key, false);
 
         try {
-            entry.initialValue(val, null, ver, ttl, -1, false, topVer, replicate ? DR_LOAD
: DR_NONE);
+            entry.initialValue(val, null, ver, ttl, CU.EXPIRE_TIME_CALCULATE, false, topVer,
+                replicate ? DR_LOAD : DR_NONE);
         }
         catch (IgniteCheckedException e) {
             throw new IgniteException("Failed to put cache value: " + entry, e);
@@ -4050,16 +4045,10 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K,
V>,
 
             ctx.store().loadAllFromStore(null, keys, new CI2<K, V>() {
                 @Override public void apply(K key, V val) {
-                    long ttl = 0;
+                    Long ttl = CU.ttlForLoad(plc0);
 
-                    if (plc0 != null) {
-                        ttl = CU.toTtl(plc0.getExpiryForCreation());
-
-                        if (ttl == CU.TTL_ZERO)
-                            return;
-                        else if (ttl == CU.TTL_NOT_CHANGED)
-                            ttl = 0;
-                    }
+                    if (ttl == null)
+                        return;
 
                     loadEntry(key, val, ver0, null, topVer, replicate, ttl);
                 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/362bf16a/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 dc0fa59..cc879cb 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
@@ -802,18 +802,8 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K,
V>
                 evt = false;
             }
 
-            if (ret != null && expiryPlc != null) {
-                long ttl = expiryPlc.forAccess();
-
-                if (ttl != CU.TTL_NOT_CHANGED) {
-                    updateTtl(ttl);
-
-                    expiryPlc.ttlUpdated(key(),
-                        getOrMarshalKeyBytes(),
-                        version(),
-                        hasReaders() ? ((GridDhtCacheEntry)this).readers() : null);
-                }
-            }
+            if (ret != null && expiryPlc != null)
+                updateTtl(expiryPlc);
         }
 
         if (ret != null)
@@ -1334,8 +1324,8 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K,
V>
                     ttl = CU.toTtl(expiryPlc.getExpiryForCreation());
 
                     if (ttl == CU.TTL_ZERO) {
-                        ttl = 1;
-                        expireTime = U.currentTimeMillis() - 1;
+                        ttl = CU.TTL_MINIMUM;
+                        expireTime = CU.expireTimeInPast();
                     }
                     else if (ttl == CU.TTL_NOT_CHANGED)
                         ttl = 0;
@@ -1367,12 +1357,8 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K,
V>
                 boolean pass = cctx.isAll(wrapFilterLocked(), filter);
 
                 if (!pass) {
-                    if (expiryPlc != null && !readThrough && filter != cctx.noPeekArray()
&& hasValueUnlocked()) {
-                        long ttl = CU.toTtl(expiryPlc.getExpiryForAccess());
-
-                        if (ttl != CU.TTL_NOT_CHANGED)
-                            updateTtl(ttl);
-                    }
+                    if (expiryPlc != null && !readThrough && filter != cctx.noPeekArray()
&& hasValueUnlocked())
+                        updateTtl(expiryPlc);
 
                     return new T3<>(false, retval ? old : null, null);
                 }
@@ -1406,12 +1392,8 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K,
V>
                 }
 
                 if (!entry.modified()) {
-                    if (expiryPlc != null && !readThrough && hasValueUnlocked())
{
-                        long newTtl = CU.toTtl(expiryPlc.getExpiryForAccess());
-
-                        if (newTtl != CU.TTL_NOT_CHANGED)
-                            updateTtl(newTtl);
-                    }
+                    if (expiryPlc != null && !readThrough && hasValueUnlocked())
+                        updateTtl(expiryPlc);
 
                     return new GridTuple3<>(false, null, invokeRes);
                 }
@@ -1773,8 +1755,8 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K,
V>
                     ttl = expiryPlc.forCreate();
 
                     if (ttl == CU.TTL_ZERO) {
-                        ttl = 1;
-                        expireTime = U.currentTimeMillis() - 1;
+                        ttl = CU.TTL_MINIMUM;
+                        expireTime = CU.expireTimeInPast();
                     }
                     else if (ttl == CU.TTL_NOT_CHANGED)
                         ttl = 0;
@@ -1805,18 +1787,8 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K,
V>
                 boolean pass = cctx.isAll(wrapFilterLocked(), filter);
 
                 if (!pass) {
-                    if (expiryPlc != null && !readThrough && hasValueUnlocked()
&& filter != cctx.noPeekArray()) {
-                        newTtl = expiryPlc.forAccess();
-
-                        if (newTtl != CU.TTL_NOT_CHANGED) {
-                            updateTtl(newTtl);
-
-                            expiryPlc.ttlUpdated(key,
-                                getOrMarshalKeyBytes(),
-                                version(),
-                                hasReaders() ? ((GridDhtCacheEntry<K, V>)this).readers()
: null);
-                        }
-                    }
+                    if (expiryPlc != null && !readThrough && hasValueUnlocked()
&& filter != cctx.noPeekArray())
+                        updateTtl(expiryPlc);
 
                     return new GridCacheUpdateAtomicResult<>(false,
                         retval ? old : null,
@@ -1857,18 +1829,8 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K,
V>
                 }
 
                 if (!entry.modified()) {
-                    if (expiryPlc != null && !readThrough && hasValueUnlocked())
{
-                        newTtl = expiryPlc.forAccess();
-
-                        if (newTtl != CU.TTL_NOT_CHANGED) {
-                            updateTtl(newTtl);
-
-                            expiryPlc.ttlUpdated(key,
-                                getOrMarshalKeyBytes(),
-                                version(),
-                                hasReaders() ? ((GridDhtCacheEntry<K, V>)this).readers()
: null);
-                        }
-                    }
+                    if (expiryPlc != null && !readThrough && hasValueUnlocked())
+                        updateTtl(expiryPlc);
 
                     return new GridCacheUpdateAtomicResult<>(false,
                         retval ? old : null,
@@ -2529,6 +2491,39 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K,
V>
     }
 
     /**
+     * Update TTL if it is changed.
+     *
+     * @param expiryPlc Expiry policy.
+     */
+    private void updateTtl(ExpiryPolicy expiryPlc) {
+        long ttl = CU.toTtl(expiryPlc.getExpiryForAccess());
+
+        if (ttl != CU.TTL_NOT_CHANGED)
+            updateTtl(ttl);
+    }
+
+    /**
+     * Update TTL is it is changed.
+     *
+     * @param expiryPlc Expiry policy.
+     * @throws IgniteCheckedException If failed.
+     * @throws GridCacheEntryRemovedException If failed.
+     */
+    private void updateTtl(IgniteCacheExpiryPolicy expiryPlc)
+        throws IgniteCheckedException, GridCacheEntryRemovedException {
+        long ttl = expiryPlc.forAccess();
+
+        if (ttl != CU.TTL_NOT_CHANGED) {
+            updateTtl(ttl);
+
+            expiryPlc.ttlUpdated(key(),
+                getOrMarshalKeyBytes(),
+                version(),
+                hasReaders() ? ((GridDhtCacheEntry)this).readers() : null);
+        }
+    }
+
+    /**
      * @param ttl Time to live.
      */
     private void updateTtl(long ttl) {
@@ -2538,8 +2533,8 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K,
V>
         long expireTime;
 
         if (ttl == CU.TTL_ZERO) {
-            ttl = 1;
-            expireTime = U.currentTimeMillis() - 1;
+            ttl = CU.TTL_MINIMUM;
+            expireTime = CU.expireTimeInPast();
         }
         else
             expireTime = toExpireTime(ttl);
@@ -2574,11 +2569,13 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K,
V>
      * @return Expiration time.
      */
     public static long toExpireTime(long ttl) {
-        long expireTime = ttl == 0 ? 0 : U.currentTimeMillis() + ttl;
+        assert ttl != CU.TTL_ZERO && ttl != CU.TTL_NOT_CHANGED && ttl >=
0;
+
+        long expireTime = ttl == CU.TTL_ETERNAL ? CU.EXPIRE_TIME_ETERNAL : U.currentTimeMillis()
+ ttl;
 
         // Account for overflow.
         if (expireTime < 0)
-            expireTime = 0;
+            expireTime = CU.EXPIRE_TIME_ETERNAL;
 
         return expireTime;
     }
@@ -2921,18 +2918,8 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K,
V>
                     ver = this.ver;
                     val = rawGetOrUnmarshalUnlocked(false);
 
-                    if (val != null && expiryPlc != null) {
-                        long ttl = expiryPlc.forAccess();
-
-                        if (ttl != CU.TTL_NOT_CHANGED) {
-                            updateTtl(ttl);
-
-                            expiryPlc.ttlUpdated(key(),
-                                getOrMarshalKeyBytes(),
-                                version(),
-                                hasReaders() ? ((GridDhtCacheEntry)this).readers() : null);
-                        }
-                    }
+                    if (val != null && expiryPlc != null)
+                        updateTtl(expiryPlc);
                 }
 
                 if (!cctx.isAll(wrap(), filter))
@@ -3401,30 +3388,6 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K,
V>
     }
 
     /** {@inheritDoc} */
-    @SuppressWarnings({"IfMayBeConditional"})
-    @Override public long expireTime() throws GridCacheEntryRemovedException {
-        IgniteTxLocalAdapter<K, V> tx;
-
-        if (cctx.isDht())
-            tx = cctx.dht().near().context().tm().localTx();
-        else
-            tx = cctx.tm().localTx();
-
-        if (tx != null) {
-            long time = tx.entryExpireTime(txKey());
-
-            if (time > 0)
-                return time;
-        }
-
-        synchronized (this) {
-            checkObsolete();
-
-            return expireTimeExtras();
-        }
-    }
-
-    /** {@inheritDoc} */
     @Override public long expireTimeUnlocked() {
         assert Thread.holdsLock(this);
 
@@ -3499,13 +3462,27 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K,
V>
 
     /** {@inheritDoc} */
     @SuppressWarnings({"IfMayBeConditional"})
-    @Override public long ttl() throws GridCacheEntryRemovedException {
-        IgniteTxLocalAdapter<K, V> tx;
+    @Override public long expireTime() throws GridCacheEntryRemovedException {
+        IgniteTxLocalAdapter<K, V> tx = currentTx();
 
-        if (cctx.isDht())
-            tx = cctx.dht().near().context().tm().localTx();
-        else
-            tx = cctx.tm().localTx();
+        if (tx != null) {
+            long time = tx.entryExpireTime(txKey());
+
+            if (time > 0)
+                return time;
+        }
+
+        synchronized (this) {
+            checkObsolete();
+
+            return expireTimeExtras();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings({"IfMayBeConditional"})
+    @Override public long ttl() throws GridCacheEntryRemovedException {
+        IgniteTxLocalAdapter<K, V> tx = currentTx();
 
         if (tx != null) {
             long entryTtl = tx.entryTtl(txKey());
@@ -3521,6 +3498,16 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K,
V>
         }
     }
 
+    /**
+     * @return Current transaction.
+     */
+    private IgniteTxLocalAdapter<K, V> currentTx() {
+        if (cctx.isDht())
+            return cctx.dht().near().context().tm().localTx();
+        else
+            return cctx.tm().localTx();
+    }
+
     /** {@inheritDoc} */
     @Override public void updateTtl(@Nullable GridCacheVersion ver, long ttl) {
         synchronized (this) {
@@ -4232,7 +4219,9 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K,
V>
      * @param expireTime Expire time.
      */
     protected void ttlAndExpireTimeExtras(long ttl, long expireTime) {
-        extras = (extras != null) ? extras.ttlAndExpireTime(ttl, expireTime) : ttl != 0 ?
+        assert ttl != CU.TTL_NOT_CHANGED && ttl != CU.TTL_ZERO;
+
+        extras = (extras != null) ? extras.ttlAndExpireTime(ttl, expireTime) : ttl != CU.TTL_ETERNAL
?
             new GridCacheTtlEntryExtras<K>(ttl, expireTime) : null;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/362bf16a/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 a3a5b20..b4f306b 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
@@ -74,12 +74,24 @@ public class GridCacheUtils {
     /** Peek flags. */
     private static final GridCachePeekMode[] PEEK_FLAGS = new GridCachePeekMode[] { GLOBAL,
SWAP };
 
-    /** */
+    /** TTL: minimum positive value. */
+    public static final long TTL_MINIMUM = 1L;
+
+    /** TTL: eternal. */
+    public static final long TTL_ETERNAL = 0L;
+
+    /** TTL: not changed. */
     public static final long TTL_NOT_CHANGED = -1L;
 
-    /** */
+    /** TTL: zero (immediate expiration). */
     public static final long TTL_ZERO = -2L;
 
+    /** Expire time: eternal. */
+    public static final long EXPIRE_TIME_ETERNAL = 0L;
+
+    /** Expire time: must be calculated based on TTL value. */
+    public static final long EXPIRE_TIME_CALCULATE = -1L;
+
     /** Per-thread generated UID store. */
     private static final ThreadLocal<String> UUIDS = new ThreadLocal<String>()
{
         @Override protected String initialValue() {
@@ -1687,7 +1699,7 @@ public class GridCacheUtils {
 
         if (duration.getDurationAmount() == 0) {
             if (duration.isEternal())
-                return 0;
+                return TTL_ETERNAL;
 
             assert duration.isZero();
 
@@ -1700,6 +1712,34 @@ public class GridCacheUtils {
     }
 
     /**
+     * Get TTL for load operation.
+     *
+     * @param plc Expiry policy.
+     * @return TTL for load operation or {@code null} in case object should not be loaded
further.
+     */
+    public static Long ttlForLoad(ExpiryPolicy plc) {
+        if (plc != null) {
+            long ttl = CU.toTtl(plc.getExpiryForCreation());
+
+            if (ttl == CU.TTL_ZERO)
+                return null;
+            else if (ttl == CU.TTL_NOT_CHANGED)
+                return CU.TTL_ETERNAL;
+            else
+                return ttl;
+        }
+        else
+            return CU.TTL_ETERNAL;
+    }
+
+    /**
+     * @return Expire time denoting a point in the past.
+     */
+    public static long expireTimeInPast() {
+        return U.currentTimeMillis() - 1L;
+    }
+
+    /**
      * Reads array from input stream.
      *
      * @param in Input stream.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/362bf16a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
index 43653c7..db7585a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
@@ -436,16 +436,10 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
                 GridCacheEntryEx<K, V> entry = null;
 
                 try {
-                    long ttl = 0;
+                    Long ttl = CU.ttlForLoad(plc);
 
-                    if (plc != null) {
-                        ttl = CU.toTtl(plc.getExpiryForCreation());
-
-                        if (ttl == CU.TTL_ZERO)
-                            return;
-                        else if (ttl == CU.TTL_NOT_CHANGED)
-                            ttl = 0;
-                    }
+                    if (ttl == null)
+                        return;
 
                     if (ctx.portableEnabled()) {
                         key = (K)ctx.marshalToPortable(key);
@@ -454,7 +448,8 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
 
                     entry = entryEx(key, false);
 
-                    entry.initialValue(val, null, ver, ttl, -1, false, topVer, replicate
? DR_LOAD : DR_NONE);
+                    entry.initialValue(val, null, ver, ttl, CU.EXPIRE_TIME_CALCULATE, false,
topVer,
+                        replicate ? DR_LOAD : DR_NONE);
                 }
                 catch (IgniteCheckedException e) {
                     throw new IgniteException("Failed to put cache value: " + entry, e);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/362bf16a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index b90d78e..84c9287 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -2005,7 +2005,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
                                 valBytes,
                                 entryProcessor,
                                 updRes.newTtl(),
-                                -1,
+                                CU.EXPIRE_TIME_CALCULATE,
                                 null);
 
                         if (!F.isEmpty(filteredReaders))
@@ -2015,7 +2015,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
                                 valBytes,
                                 entryProcessor,
                                 updRes.newTtl(),
-                                -1);
+                                CU.EXPIRE_TIME_CALCULATE);
                     }
 
                     if (hasNear) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/362bf16a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
index 7e4413a..3f3e359 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
@@ -255,14 +255,14 @@ public class GridDhtAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> imp
             drVers.add(drVer);
         }
         else if (drVers != null)
-            drVers.add(drVer);
+            drVers.add(null);
 
         if (ttl >= 0) {
             if (ttls == null) {
                 ttls = new GridLongList(keys.size());
 
                 for (int i = 0; i < keys.size() - 1; i++)
-                    ttls.add(-1);
+                    ttls.add(CU.TTL_NOT_CHANGED);
             }
         }
 
@@ -274,7 +274,7 @@ public class GridDhtAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> imp
                 drExpireTimes = new GridLongList(keys.size());
 
                 for (int i = 0; i < keys.size() - 1; i++)
-                    drExpireTimes.add(-1);
+                    drExpireTimes.add(CU.EXPIRE_TIME_CALCULATE);
             }
         }
 
@@ -331,7 +331,7 @@ public class GridDhtAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> imp
                 nearTtls = new GridLongList(nearKeys.size());
 
                 for (int i = 0; i < nearKeys.size() - 1; i++)
-                    nearTtls.add(-1);
+                    nearTtls.add(CU.TTL_NOT_CHANGED);
             }
         }
 
@@ -343,7 +343,7 @@ public class GridDhtAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> imp
                 nearExpireTimes = new GridLongList(nearKeys.size());
 
                 for (int i = 0; i < nearKeys.size() - 1; i++)
-                    nearExpireTimes.add(-1);
+                    nearExpireTimes.add(CU.EXPIRE_TIME_CALCULATE);
             }
         }
 
@@ -549,13 +549,6 @@ public class GridDhtAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> imp
     }
 
     /**
-     * @return DR versions.
-     */
-    @Nullable public List<GridCacheVersion> drVersions() {
-        return drVers;
-    }
-
-    /**
      * @param idx Index.
      * @return DR version.
      */
@@ -580,7 +573,7 @@ public class GridDhtAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> imp
             return ttls.get(idx);
         }
 
-        return -1L;
+        return CU.TTL_NOT_CHANGED;
     }
 
     /**
@@ -594,7 +587,7 @@ public class GridDhtAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> imp
             return nearTtls.get(idx);
         }
 
-        return -1L;
+        return CU.TTL_NOT_CHANGED;
     }
 
     /**
@@ -615,7 +608,7 @@ public class GridDhtAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> imp
             return drExpireTimes.get(idx);
         }
 
-        return -1L;
+        return CU.EXPIRE_TIME_CALCULATE;
     }
 
     /**
@@ -629,7 +622,7 @@ public class GridDhtAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> imp
             return nearExpireTimes.get(idx);
         }
 
-        return -1L;
+        return CU.EXPIRE_TIME_CALCULATE;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/362bf16a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
index f409e94..58bce51 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
@@ -317,7 +317,7 @@ public class GridNearAtomicCache<K, V> extends GridNearCacheAdapter<K,
V> {
                         long ttl = req.nearTtl(i);
                         long expireTime = req.nearExpireTime(i);
 
-                        if (ttl != -1L && expireTime == -1L)
+                        if (ttl != CU.TTL_NOT_CHANGED && expireTime == CU.EXPIRE_TIME_CALCULATE)
                             expireTime = GridCacheMapEntry.toExpireTime(ttl);
 
                         GridCacheUpdateAtomicResult<K, V> updRes = entry.innerUpdate(

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/362bf16a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/IgniteDataLoaderImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/IgniteDataLoaderImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/IgniteDataLoaderImpl.java
index 05799fe..10ccfd0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/IgniteDataLoaderImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/IgniteDataLoaderImpl.java
@@ -1419,7 +1419,8 @@ public class IgniteDataLoaderImpl<K, V> implements IgniteDataLoader<K,
V>, Delay
 
                     entry.unswap(true, false);
 
-                    entry.initialValue(val, null, ver, 0, 0, false, topVer, GridDrType.DR_LOAD);
+                    entry.initialValue(val, null, ver, CU.TTL_ETERNAL, CU.EXPIRE_TIME_ETERNAL,
false, topVer,
+                        GridDrType.DR_LOAD);
 
                     cctx.evicts().touch(entry, topVer);
                 }


Mime
View raw message