ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject ignite git commit: Perf - Fixed test.
Date Mon, 16 Nov 2015 11:35:27 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-perftest-merge b9ea3fc99 -> 96c1b2d10


Perf - Fixed test.


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

Branch: refs/heads/ignite-perftest-merge
Commit: 96c1b2d10738882bdfd5c670c928a9c64b378130
Parents: b9ea3fc9
Author: Alexey Goncharuk <alexey.goncharuk@gmail.com>
Authored: Mon Nov 16 14:35:16 2015 +0300
Committer: Alexey Goncharuk <alexey.goncharuk@gmail.com>
Committed: Mon Nov 16 14:35:16 2015 +0300

----------------------------------------------------------------------
 .../distributed/dht/GridDhtTxLocalAdapter.java  | 33 --------------
 ...arOptimisticSerializableTxPrepareFuture.java |  4 +-
 .../near/GridNearOptimisticTxPrepareFuture.java |  6 +--
 .../cache/distributed/near/GridNearTxLocal.java | 45 ++++++++++----------
 4 files changed, 27 insertions(+), 61 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/96c1b2d1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
index 951c18e..74547e9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
@@ -394,19 +394,6 @@ public abstract class GridDhtTxLocalAdapter extends IgniteTxLocalAdapter
{
     }
 
     /**
-     * @param mappings Mappings to add.
-     */
-    public void addDhtMapping(Map<UUID, GridDistributedTxMapping> mappings) {
-        addMapping0(mappings, dhtMap);
-    }
-
-    /**
-     * @param mappings Mappings to add.
-     */
-    public void addNearMapping(Map<UUID, GridDistributedTxMapping> mappings) {
-        addMapping0(mappings, nearMap);
-    }
-    /**
      * @param nodeId Node ID.
      * @return {@code True} if mapping was removed.
      */
@@ -490,26 +477,6 @@ public abstract class GridDhtTxLocalAdapter extends IgniteTxLocalAdapter
{
         }
     }
 
-    /**
-     * @param mappings Mappings to add.
-     * @param dst Map to add to.
-     */
-    private void addMapping0(
-        Map<UUID, GridDistributedTxMapping> mappings,
-        Map<UUID, GridDistributedTxMapping> dst
-    ) {
-        for (Map.Entry<UUID, GridDistributedTxMapping> entry : mappings.entrySet())
{
-            GridDistributedTxMapping targetMapping = dst.get(entry.getKey());
-
-            if (targetMapping == null)
-                dst.put(entry.getKey(), entry.getValue());
-            else {
-                for (IgniteTxEntry txEntry : entry.getValue().entries())
-                    targetMapping.add(txEntry);
-            }
-        }
-    }
-
     /** {@inheritDoc} */
     @Override public void addInvalidPartition(GridCacheContext ctx, int part) {
         assert false : "DHT transaction encountered invalid partition [part=" + part + ",
tx=" + this + ']';

http://git-wip-us.apache.org/repos/asf/ignite/blob/96c1b2d1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
index 9c6cb88..49f5305 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticSerializableTxPrepareFuture.java
@@ -378,8 +378,6 @@ public class GridNearOptimisticSerializableTxPrepareFuture extends GridNearOptim
             return;
         }
 
-        tx.addEntryMapping(mappings.values());
-
         cctx.mvcc().recheckPendingLocks();
 
         tx.transactionNodes(txMapping.transactionNodes());
@@ -619,6 +617,8 @@ public class GridNearOptimisticSerializableTxPrepareFuture extends GridNearOptim
                 }
             }
         }
+
+        tx.addEntryMapping(primary, cacheCtx.isNear(), entry.explicitVersion() != null, entry);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/96c1b2d1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
index eb3a051..3617fdf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
@@ -296,7 +296,7 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearOptimisticTxPrepa
             markInitialized();
         }
         catch (TransactionTimeoutException e) {
-            onError( e);
+            onError(e);
         }
     }
 
@@ -360,8 +360,6 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearOptimisticTxPrepa
             return;
         }
 
-        tx.addEntryMapping(mappings);
-
         cctx.mvcc().recheckPendingLocks();
 
         txMapping.initLast(mappings);
@@ -544,6 +542,8 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearOptimisticTxPrepa
             }
         }
 
+        tx.addEntryMapping(primary, cacheCtx.isNear(), entry.explicitVersion() != null, entry);
+
         return cur;
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/96c1b2d1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
index c88546b..624b025 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
@@ -548,36 +548,35 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter {
     }
 
     /**
-     * @param maps Mappings.
+     * Adds mapping to the transaction. Note that transaction must hold a copy of TX mapping
because
+     * tx mapping will be sent to remote nodes.
+     *
+     * @param primary Primary node for which the mapping is being added.
+     * @param near Near mapping flag.
+     * @param explicitLock Explicit lock flag.
+     * @param txEntry Transaction entry being added.
      */
-    void addEntryMapping(@Nullable Collection<GridDistributedTxMapping> maps) {
-        if (!F.isEmpty(maps)) {
-            for (GridDistributedTxMapping map : maps) {
-                ClusterNode n = map.node();
+    void addEntryMapping(ClusterNode primary, boolean near, boolean explicitLock, IgniteTxEntry
txEntry) {
+        UUID nodeId = primary.id();
+        GridDistributedTxMapping m = mappings.get(nodeId);
 
-                GridDistributedTxMapping m = mappings.get(n.id());
+        if (m == null) {
+            GridDistributedTxMapping old = mappings.putIfAbsent(nodeId, m = new GridDistributedTxMapping(primary));
 
-                if (m == null) {
-                    GridDistributedTxMapping old = mappings.putIfAbsent(map.node().id(),
map);
+            assert old == null : "Failed to add mapping to transaction: " + this;
+        }
 
-                    assert old == null : "Failed to add mapping to transaction: " + this;
-                }
-                else {
-                    if (map.near())
-                        m.near(map.near());
+        if (near)
+            m.near(true);
 
-                    if (map.explicitLock())
-                        m.markExplicitLock();
+        if (explicitLock)
+            m.markExplicitLock();
 
-                    for (IgniteTxEntry entry : map.entries())
-                        m.add(entry);
-                }
-            }
+        m.add(txEntry);
 
-            if (log.isDebugEnabled())
-                log.debug("Added mappings to transaction [locId=" + cctx.localNodeId() +
", mappings=" + maps +
-                    ", tx=" + this + ']');
-        }
+        if (log.isDebugEnabled())
+            log.debug("Added mapping to transaction [locId=" + cctx.localNodeId() + ", primaryId="
+ nodeId +
+                ", entry=" + txEntry + ']');
     }
 
     /**


Mime
View raw message