ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [11/38] ignite git commit: ignite-4768
Date Tue, 14 Mar 2017 08:00:30 GMT
ignite-4768


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

Branch: refs/heads/ignite-4768
Commit: 35dad8fe531366e604cc6210d97da4d3f60740bb
Parents: e9d8820
Author: sboikov <sboikov@gridgain.com>
Authored: Thu Mar 9 11:37:24 2017 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Thu Mar 9 11:37:24 2017 +0300

----------------------------------------------------------------------
 .../distributed/GridDistributedTxMapping.java   | 31 +-------------------
 ...arOptimisticSerializableTxPrepareFuture.java | 13 ++++----
 .../near/GridNearOptimisticTxPrepareFuture.java |  7 +++--
 .../GridNearPessimisticTxPrepareFuture.java     |  4 +--
 .../near/GridNearTxPrepareFutureAdapter.java    |  7 ++---
 5 files changed, 18 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/35dad8fe/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxMapping.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxMapping.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxMapping.java
index 2f04f58..f8cec50 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxMapping.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxMapping.java
@@ -17,10 +17,6 @@
 
 package org.apache.ignite.internal.processors.cache.distributed;
 
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.LinkedHashSet;
@@ -33,16 +29,12 @@ import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.util.typedef.internal.U;
 import org.jetbrains.annotations.Nullable;
 
 /**
  * Transaction node mapping.
  */
-public class GridDistributedTxMapping implements Externalizable {
-    /** */
-    private static final long serialVersionUID = 0L;
-
+public class GridDistributedTxMapping {
     /** Mapped node. */
     @GridToStringExclude
     private ClusterNode primary;
@@ -67,13 +59,6 @@ public class GridDistributedTxMapping implements Externalizable {
     private boolean clientFirst;
 
     /**
-     * Empty constructor required for {@link Externalizable}.
-     */
-    public GridDistributedTxMapping() {
-        // No-op.
-    }
-
-    /**
      * @param primary Primary node.
      */
     public GridDistributedTxMapping(ClusterNode primary) {
@@ -235,20 +220,6 @@ public class GridDistributedTxMapping implements Externalizable {
     }
 
     /** {@inheritDoc} */
-    @Override public void writeExternal(ObjectOutput out) throws IOException {
-        out.writeObject(primary);
-
-        U.writeCollection(out, entries);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
-        primary = (ClusterNode)in.readObject();
-
-        entries = U.readCollection(in);
-    }
-
-    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(GridDistributedTxMapping.class, this, "node", primary.id());
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/35dad8fe/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 3176fa7..bb1609d 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
@@ -334,15 +334,15 @@ public class GridNearOptimisticSerializableTxPrepareFuture extends GridNearOptim
 
         assert topVer.topologyVersion() > 0;
 
-        txMapping = new GridDhtTxMapping();
+        GridDhtTxMapping txMapping = new GridDhtTxMapping();
 
         Map<IgniteBiTuple<ClusterNode, Boolean>, GridDistributedTxMapping> mappings
= new HashMap<>();
 
         for (IgniteTxEntry write : writes)
-            map(write, topVer, mappings, remap, topLocked);
+            map(write, topVer, mappings, txMapping, remap, topLocked);
 
         for (IgniteTxEntry read : reads)
-            map(read, topVer, mappings, remap, topLocked);
+            map(read, topVer, mappings, txMapping, remap, topLocked);
 
         if (keyLockFut != null)
             keyLockFut.onAllKeysAdded();
@@ -360,7 +360,7 @@ public class GridNearOptimisticSerializableTxPrepareFuture extends GridNearOptim
 
         tx.transactionNodes(txMapping.transactionNodes());
 
-        checkOnePhase();
+        checkOnePhase(txMapping);
 
         int miniId = 0;
 
@@ -382,7 +382,7 @@ public class GridNearOptimisticSerializableTxPrepareFuture extends GridNearOptim
 
             MiniFuture fut = (MiniFuture)fut0;
 
-            IgniteCheckedException err = prepare(fut);
+            IgniteCheckedException err = prepare(fut, txMapping);
 
             if (err != null) {
                 while (it.hasNext()) {
@@ -418,7 +418,7 @@ public class GridNearOptimisticSerializableTxPrepareFuture extends GridNearOptim
      * @param fut Mini future.
      * @return Prepare error if any.
      */
-    @Nullable private IgniteCheckedException prepare(final MiniFuture fut) {
+    @Nullable private IgniteCheckedException prepare(final MiniFuture fut, GridDhtTxMapping
txMapping) {
         GridDistributedTxMapping m = fut.mapping();
 
         final ClusterNode primary = m.primary();
@@ -523,6 +523,7 @@ public class GridNearOptimisticSerializableTxPrepareFuture extends GridNearOptim
         IgniteTxEntry entry,
         AffinityTopologyVersion topVer,
         Map<IgniteBiTuple<ClusterNode, Boolean>, GridDistributedTxMapping> curMapping,
+        GridDhtTxMapping txMapping,
         boolean remap,
         boolean topLocked
     ) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/35dad8fe/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 9ef6f22..8bb79c1 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
@@ -78,6 +78,9 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearOptimisticTxPrepa
     /** */
     private int miniId;
 
+    /** */
+    private GridDhtTxMapping txMapping;
+
     /**
      * @param cctx Context.
      * @param tx Transaction.
@@ -380,7 +383,7 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearOptimisticTxPrepa
 
         tx.transactionNodes(txMapping.transactionNodes());
 
-        checkOnePhase();
+        checkOnePhase(txMapping);
 
         proceedPrepare(mapping, null);
     }
@@ -449,7 +452,7 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearOptimisticTxPrepa
 
         tx.transactionNodes(txMapping.transactionNodes());
 
-        checkOnePhase();
+        checkOnePhase(txMapping);
 
         proceedPrepare(mappings);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/35dad8fe/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
index caac48c..fb2c2fd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
@@ -190,7 +190,7 @@ public class GridNearPessimisticTxPrepareFuture extends GridNearTxPrepareFutureA
 
         AffinityTopologyVersion topVer = tx.topologyVersion();
 
-        txMapping = new GridDhtTxMapping();
+        GridDhtTxMapping txMapping = new GridDhtTxMapping();
 
         for (IgniteTxEntry txEntry : tx.allEntries()) {
             txEntry.clearEntryReadVersion();
@@ -235,7 +235,7 @@ public class GridNearPessimisticTxPrepareFuture extends GridNearTxPrepareFutureA
 
         tx.transactionNodes(txMapping.transactionNodes());
 
-        checkOnePhase();
+        checkOnePhase(txMapping);
 
         if (mappingKnown && tx.onePhaseCommit())
             mappingKnown = false;

http://git-wip-us.apache.org/repos/asf/ignite/blob/35dad8fe/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFutureAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFutureAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFutureAdapter.java
index 0ae98fd..a0f28c5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFutureAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFutureAdapter.java
@@ -95,9 +95,6 @@ public abstract class GridNearTxPrepareFutureAdapter extends
     /** Trackable flag. */
     protected boolean trackable = true;
 
-    /** Full information about transaction nodes mapping. */
-    protected GridDhtTxMapping txMapping;
-
     /**
      * @param cctx Context.
      * @param tx Transaction.
@@ -160,8 +157,10 @@ public abstract class GridNearTxPrepareFutureAdapter extends
     /**
      * Checks if mapped transaction can be committed on one phase.
      * One-phase commit can be done if transaction maps to one primary node and not more
than one backup.
+     *
+     * @param txMapping Transaction mapping.
      */
-    protected final void checkOnePhase() {
+    protected final void checkOnePhase(GridDhtTxMapping txMapping) {
         if (tx.storeUsed())
             return;
 


Mime
View raw message