ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ag...@apache.org
Subject [27/39] ignite git commit: Remove updateTime.
Date Thu, 13 Apr 2017 15:34:57 GMT
Remove updateTime.


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

Branch: refs/heads/ignite-4587
Commit: 20a87f832e4b3f46c8da511e85e08f1f6203b693
Parents: bdc8f20
Author: Max Kozlov <dreamx.max@gmail.com>
Authored: Thu Mar 9 18:29:23 2017 +0300
Committer: Max Kozlov <dreamx.max@gmail.com>
Committed: Thu Mar 9 18:29:23 2017 +0300

----------------------------------------------------------------------
 .../org/apache/ignite/cache/CacheEntry.java     | 11 ------
 .../processors/cache/CacheEntryImplEx.java      |  8 +----
 .../cache/GridCacheAtomicVersionComparator.java |  7 ----
 .../processors/cache/GridCacheMvcc.java         | 23 +++++-------
 .../processors/cache/GridCacheUtils.java        |  1 -
 .../version/GridCachePlainVersionedEntry.java   |  5 ---
 .../version/GridCacheRawVersionedEntry.java     |  5 ---
 .../cache/version/GridCacheVersion.java         | 37 +++-----------------
 .../cache/version/GridCacheVersionEx.java       |  1 -
 .../cache/version/GridCacheVersionedEntry.java  |  7 ----
 .../ignite/internal/util/IgniteUtils.java       | 12 ++-----
 .../CacheVersionedEntryAbstractTest.java        |  2 --
 12 files changed, 16 insertions(+), 103 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/20a87f83/modules/core/src/main/java/org/apache/ignite/cache/CacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CacheEntry.java b/modules/core/src/main/java/org/apache/ignite/cache/CacheEntry.java
index 19585a3..90f30a2 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/CacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/CacheEntry.java
@@ -82,15 +82,4 @@ public interface CacheEntry<K, V> extends Cache.Entry<K, V>
{
      * @return Version of this cache entry.
      */
     public Comparable version();
-
-    /**
-     * Returns the time when the cache entry for the given key has been updated or initially
created.
-     * <p>
-     * It is valid to compare cache entries' update time for the same key. In this case the
latter update will
-     * be represented by higher update time. The result of update time comparison of cache
entries of different keys is
-     * undefined.
-     *
-     * @return Time in milliseconds.
-     */
-    public long updateTime();
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/20a87f83/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImplEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImplEx.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImplEx.java
index af926c6..664b216 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImplEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImplEx.java
@@ -70,11 +70,6 @@ public class CacheEntryImplEx<K, V> extends CacheEntryImpl<K,
V> implements Cach
     }
 
     /** {@inheritDoc} */
-    @Override public long updateTime() {
-        return ver.globalTime();
-    }
-
-    /** {@inheritDoc} */
     @Override public void writeExternal(ObjectOutput out) throws IOException {
         super.writeExternal(out);
 
@@ -96,8 +91,7 @@ public class CacheEntryImplEx<K, V> extends CacheEntryImpl<K, V>
implements Cach
         if (ver != null && ver != GET_ENTRY_INVALID_VER_AFTER_GET && ver
!= GET_ENTRY_INVALID_VER_UPDATED) {
             res += ", topVer=" + ver.topologyVersion() +
                 ", nodeOrder=" + ver.nodeOrder() +
-                ", order=" + ver.order() +
-                ", updateTime=" + ver.globalTime();
+                ", order=" + ver.order();
         }
         else
             res += ", ver=n/a";

http://git-wip-us.apache.org/repos/asf/ignite/blob/20a87f83/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicVersionComparator.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicVersionComparator.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicVersionComparator.java
index 08a5b28..eba1edb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicVersionComparator.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicVersionComparator.java
@@ -36,10 +36,6 @@ public class GridCacheAtomicVersionComparator {
         int otherTopVer = other.topologyVersion();
 
         if (topVer == otherTopVer) {
-            long globalTime = one.globalTime();
-            long otherGlobalTime = other.globalTime();
-
-            if (globalTime == otherGlobalTime || ignoreTime) {
                 long locOrder = one.order();
                 long otherLocOrder = other.order();
 
@@ -51,9 +47,6 @@ public class GridCacheAtomicVersionComparator {
                 }
                 else
                     return locOrder > otherLocOrder ? 1 : -1;
-            }
-            else
-                return globalTime > otherGlobalTime ? 1 : -1;
         }
         else
             return topVer > otherTopVer ? 1 : -1;

http://git-wip-us.apache.org/repos/asf/ignite/blob/20a87f83/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvcc.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvcc.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvcc.java
index 498584c..28cc8fb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvcc.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvcc.java
@@ -57,26 +57,19 @@ public final class GridCacheMvcc {
     /** */
     private static final Comparator<GridCacheVersion> SER_VER_COMPARATOR = new Comparator<GridCacheVersion>()
{
         @Override public int compare(GridCacheVersion ver1, GridCacheVersion ver2) {
-            long time1 = ver1.globalTime();
-            long time2 = ver2.globalTime();
+            int nodeOrder1 = ver1.nodeOrder();
+            int nodeOrder2 = ver2.nodeOrder();
 
-            if (time1 == time2) {
-                int nodeOrder1 = ver1.nodeOrder();
-                int nodeOrder2 = ver2.nodeOrder();
+            if (nodeOrder1 == nodeOrder2) {
+                long order1 = ver1.order();
+                long order2 = ver2.order();
 
-                if (nodeOrder1 == nodeOrder2) {
-                    long order1 = ver1.order();
-                    long order2 = ver2.order();
+                assert order1 != order2;
 
-                    assert order1 != order2;
-
-                    return order1 > order2 ? 1 : -1;
-                }
-                else
-                    return nodeOrder1 > nodeOrder2 ? 1 : -1;
+                return order1 > order2 ? 1 : -1;
             }
             else
-                return time1 > time2 ? 1 : -1;
+                return nodeOrder1 > nodeOrder2 ? 1 : -1;
         }
     };
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/20a87f83/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 1c59390..6b235dd 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
@@ -984,7 +984,6 @@ public class GridCacheUtils {
         byte[] bytes = new byte[28];
 
         U.intToBytes(ver.topologyVersion(), bytes, 0);
-        U.longToBytes(ver.globalTime(), bytes, 4);
         U.longToBytes(ver.order(), bytes, 12);
         U.intToBytes(ver.nodeOrderAndDrIdRaw(), bytes, 20);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/20a87f83/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCachePlainVersionedEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCachePlainVersionedEntry.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCachePlainVersionedEntry.java
index c175e5a..f4d7e08 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCachePlainVersionedEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCachePlainVersionedEntry.java
@@ -110,11 +110,6 @@ public class GridCachePlainVersionedEntry<K, V> implements GridCacheVersionedEnt
     }
 
     /** {@inheritDoc} */
-    @Override public long globalTime() {
-        return isStartVer ? 0L : ver.globalTime();
-    }
-
-    /** {@inheritDoc} */
     @Override public GridCacheVersion version() {
         return ver;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/20a87f83/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheRawVersionedEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheRawVersionedEntry.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheRawVersionedEntry.java
index b7c96b4..7513935 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheRawVersionedEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheRawVersionedEntry.java
@@ -170,11 +170,6 @@ public class GridCacheRawVersionedEntry<K, V> extends DataStreamerEntry
implemen
     }
 
     /** {@inheritDoc} */
-    @Override public long globalTime() {
-        return ver.globalTime();
-    }
-
-    /** {@inheritDoc} */
     @Override public GridCacheVersion version() {
         return ver;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/20a87f83/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersion.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersion.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersion.java
index a82f81a..6e47696 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersion.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersion.java
@@ -50,9 +50,6 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
     /** Node order (used as global order) and DR ID. */
     private int nodeOrderDrId;
 
-    /** Globally adjusted time. */
-    private long globalTime;
-
     /** Order. */
     private long order;
 
@@ -113,13 +110,6 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
     }
 
     /**
-     * @return Adjusted time.
-     */
-    public long globalTime() {
-        return globalTime;
-    }
-
-    /**
      * @return Version order.
      */
     public long order() {
@@ -183,7 +173,7 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
      * @return Version represented as {@code GridUuid}
      */
     public IgniteUuid asGridUuid() {
-        return new IgniteUuid(new UUID(((long)topVer << 32) | nodeOrderDrId, globalTime),
order);
+        return new IgniteUuid(new UUID(topVer << 32, nodeOrderDrId << 32), order);
     }
 
     /** {@inheritDoc} */
@@ -194,7 +184,6 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
     /** {@inheritDoc} */
     @Override public void writeExternal(ObjectOutput out) throws IOException {
         out.writeInt(topVer);
-        out.writeLong(globalTime);
         out.writeLong(order);
         out.writeInt(nodeOrderDrId);
     }
@@ -202,7 +191,6 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
     /** {@inheritDoc} */
     @Override public void readExternal(ObjectInput in) throws IOException {
         topVer = in.readInt();
-        globalTime = in.readLong();
         order = in.readLong();
         nodeOrderDrId = in.readInt();
     }
@@ -260,24 +248,18 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
 
         switch (writer.state()) {
             case 0:
-                if (!writer.writeLong("globalTime", globalTime))
-                    return false;
-
-                writer.incrementState();
-
-            case 1:
                 if (!writer.writeInt("nodeOrderDrId", nodeOrderDrId))
                     return false;
 
                 writer.incrementState();
 
-            case 2:
+            case 1:
                 if (!writer.writeLong("order", order))
                     return false;
 
                 writer.incrementState();
 
-            case 3:
+            case 2:
                 if (!writer.writeInt("topVer", topVer))
                     return false;
 
@@ -297,14 +279,6 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
 
         switch (reader.state()) {
             case 0:
-                globalTime = reader.readLong("globalTime");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 1:
                 nodeOrderDrId = reader.readInt("nodeOrderDrId");
 
                 if (!reader.isLastRead())
@@ -312,7 +286,7 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
 
                 reader.incrementState();
 
-            case 2:
+            case 1:
                 order = reader.readLong("order");
 
                 if (!reader.isLastRead())
@@ -320,7 +294,7 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
 
                 reader.incrementState();
 
-            case 3:
+            case 2:
                 topVer = reader.readInt("topVer");
 
                 if (!reader.isLastRead())
@@ -346,7 +320,6 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
     /** {@inheritDoc} */
     @Override public String toString() {
         return "GridCacheVersion [topVer=" + topologyVersion() +
-            ", time=" + globalTime() +
             ", order=" + order() +
             ", nodeOrder=" + nodeOrder() + ']';
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/20a87f83/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionEx.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionEx.java
index 210b108..c3f16e6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionEx.java
@@ -160,7 +160,6 @@ public class GridCacheVersionEx extends GridCacheVersion {
     /** {@inheritDoc} */
     @Override public String toString() {
         return "GridCacheVersionEx [topVer=" + topologyVersion() +
-            ", time=" + globalTime() +
             ", order=" + order() +
             ", nodeOrder=" + nodeOrder() +
             ", drVer=" + drVer + ']';

http://git-wip-us.apache.org/repos/asf/ignite/blob/20a87f83/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionedEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionedEntry.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionedEntry.java
index 06e7999..e685d79 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionedEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionedEntry.java
@@ -71,11 +71,4 @@ public interface GridCacheVersionedEntry<K, V> {
      * @return Entry's order in initiator data center
      */
     public long order();
-
-    /**
-     * Gets entry's global time in initiator data center.
-     *
-     * @return Entry's global time in initiator data center
-     */
-    public long globalTime();
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/20a87f83/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
index 1d2f5e8..928a31c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
@@ -9217,11 +9217,7 @@ public abstract class IgniteUtils {
 
             GridUnsafe.putInt(arr, off, drVer.nodeOrderAndDrIdRaw());
 
-            off += 4;
-
-            GridUnsafe.putLong(arr, off, drVer.globalTime());
-
-            off += 8;
+            off += 12;
 
             GridUnsafe.putLong(arr, off, drVer.order());
 
@@ -9234,11 +9230,7 @@ public abstract class IgniteUtils {
 
         GridUnsafe.putInt(arr, off, ver.nodeOrderAndDrIdRaw());
 
-        off += 4;
-
-        GridUnsafe.putLong(arr, off, ver.globalTime());
-
-        off += 8;
+        off += 12;
 
         GridUnsafe.putLong(arr, off, ver.order());
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/20a87f83/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
index 37cf26d..d1c0f31 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
@@ -155,7 +155,6 @@ public abstract class CacheVersionedEntryAbstractTest extends GridCacheAbstractS
             });
 
         assert ver1.version().compareTo(ver2.version()) < 0;
-        assert ver1.updateTime() <= ver2.updateTime();
     }
 
     /**
@@ -165,7 +164,6 @@ public abstract class CacheVersionedEntryAbstractTest extends GridCacheAbstractS
         assertNotNull(entry);
 
         assertNotNull(entry.version());
-        assert entry.updateTime() > 0;
 
         assertNotNull(entry.getKey());
         assertNotNull(entry.getValue());


Mime
View raw message