You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2015/08/15 03:49:22 UTC
[35/35] incubator-ignite git commit: IGNITE-264 - Use correct version
to check for committed near transaction.
IGNITE-264 - Use correct version to check for committed near transaction.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/9278d805
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/9278d805
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/9278d805
Branch: refs/heads/ignite-264
Commit: 9278d805f55beeff7e481a334a4fca8e77d9eaf6
Parents: 44c4a60
Author: Alexey Goncharuk <ag...@gridgain.com>
Authored: Fri Aug 14 18:48:35 2015 -0700
Committer: Alexey Goncharuk <ag...@gridgain.com>
Committed: Fri Aug 14 18:48:35 2015 -0700
----------------------------------------------------------------------
.../cache/transactions/IgniteTxManager.java | 50 ++++++++------------
.../cache/GridCachePutAllFailoverSelfTest.java | 26 ++++++++++
2 files changed, 47 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9278d805/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
index 124e71d..e2046de 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
@@ -1637,13 +1637,13 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
}
/**
- * @param ver Version.
+ * @param xidVer Version.
* @return Future for flag indicating if transactions was committed.
*/
- public IgniteInternalFuture<Boolean> txCommitted(GridCacheVersion ver) {
+ public IgniteInternalFuture<Boolean> txCommitted(GridCacheVersion xidVer) {
final GridFutureAdapter<Boolean> resFut = new GridFutureAdapter<>();
- final IgniteInternalTx tx = cctx.tm().tx(ver);
+ final IgniteInternalTx tx = cctx.tm().tx(xidVer);
if (tx != null) {
assert tx.near() && tx.local() : tx;
@@ -1665,7 +1665,22 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
return resFut;
}
- Boolean committed = completedVers.get(ver);
+ Boolean committed = null;
+
+ for (Map.Entry<GridCacheVersion, Boolean> entry : completedVers.entrySet()) {
+ if (entry.getValue() == null)
+ continue;
+
+ if (entry.getKey() instanceof CommittedVersion) {
+ CommittedVersion comm = (CommittedVersion)entry.getKey();
+
+ if (comm.nearVer.equals(xidVer)) {
+ committed = entry.getValue();
+
+ break;
+ }
+ }
+ }
if (log.isDebugEnabled())
log.debug("Near transaction committed: " + committed);
@@ -1806,29 +1821,6 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
}
/**
- * @param nearVer Near version to check.
- * @return Future.
- */
- public IgniteInternalFuture<Boolean> nearTxCommitted(GridCacheVersion nearVer) {
- for (final IgniteInternalTx tx : txs()) {
- if (tx.near() && tx.xidVersion().equals(nearVer)) {
- return tx.done() ?
- new GridFinishedFuture<>(tx.state() == COMMITTED) :
- tx.finishFuture().chain(new C1<IgniteInternalFuture<IgniteInternalTx>, Boolean>() {
- @Override public Boolean apply(IgniteInternalFuture<IgniteInternalTx> f) {
- return tx.state() == COMMITTED;
- }
- });
- }
- }
-
- // Transaction was not found. Check committed versions buffer.
- Boolean res = completedVers.get(nearVer);
-
- return new GridFinishedFuture<>(res != null && res);
- }
-
- /**
* Gets local transaction for pessimistic tx recovery.
*
* @param nearXidVer Near tx ID.
@@ -1931,9 +1923,9 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
try {
cctx.kernalContext().gateway().readLock();
}
- catch (IllegalStateException | IgniteClientDisconnectedException ignore) {
+ catch (IllegalStateException | IgniteClientDisconnectedException e) {
if (log.isDebugEnabled())
- log.debug("Failed to acquire kernal gateway [err=" + ignore + ']');
+ log.debug("Failed to acquire kernal gateway [err=" + e + ']');
return;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9278d805/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java
index dc6e71e..6bbc764 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java
@@ -337,6 +337,32 @@ public class GridCachePutAllFailoverSelfTest extends GridCommonAbstractTest {
info(">>> Absent keys: " + absentKeys);
+ if (!F.isEmpty(absentKeys)) {
+ for (Ignite g : runningWorkers) {
+ IgniteKernal k = (IgniteKernal)g;
+
+ info(">>>> Entries on node: " + k.getLocalNodeId());
+
+ GridCacheAdapter<Object, Object> cache = k.internalCache("partitioned");
+
+ for (Integer key : absentKeys) {
+ GridCacheEntryEx entry = cache.peekEx(key);
+
+ if (entry != null)
+ info(" >>> " + entry);
+
+ if (cache.context().isNear()) {
+ GridCacheEntryEx entry0 = cache.context().near().dht().peekEx(key);
+
+ if (entry0 != null)
+ info(" >>> " + entry);
+ }
+ }
+
+ info("");
+ }
+ }
+
assertTrue(absentKeys.isEmpty());
// Actual primary cache size.