geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [32/50] [abbrv] incubator-geode git commit: GEODE-2088: Correctly throw TransactionDataRebalancedException when bucket is moved during rebalance.
Date Tue, 15 Nov 2016 20:49:19 GMT
GEODE-2088: Correctly throw TransactionDataRebalancedException when bucket is moved during
rebalance.

Turns out the transaction layer code has already handled when to throw TransactionDataNotColocatedException
in getTransactionException method call in TXStateProxyImpl by checking whether the key is
colocated with the keys already touched in the transaction. Only need to make sure that piece
of code will be executed by throwing correct TransactionException.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/139398a1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/139398a1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/139398a1

Branch: refs/heads/feature/GEODE-1930
Commit: 139398a1f5af656c59eeacdb2dd9283a7145d992
Parents: c9e3b05
Author: eshu <eshu@pivotal.io>
Authored: Tue Nov 15 08:34:34 2016 -0800
Committer: eshu <eshu@pivotal.io>
Committed: Tue Nov 15 08:34:34 2016 -0800

----------------------------------------------------------------------
 .../apache/geode/internal/cache/PartitionedRegion.java |  4 ++--
 .../org/apache/geode/disttx/PRDistTXDUnitTest.java     |  4 ++++
 .../geode/disttx/PRDistTXWithVersionsDUnitTest.java    |  4 ++++
 .../internal/cache/execute/PRTransactionDUnitTest.java | 13 +++++++++++--
 4 files changed, 21 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/139398a1/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
index 96c58d5..7c3f19b 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java
@@ -4001,8 +4001,8 @@ public class PartitionedRegion extends LocalRegion
         } else {
           // with transaction
           if (prce instanceof BucketNotFoundException) {
-            TransactionException ex = new TransactionDataNotColocatedException(
-                LocalizedStrings.PartitionedRegion_KEY_0_NOT_COLOCATED_WITH_TRANSACTION
+            TransactionException ex = new TransactionDataRebalancedException(
+                LocalizedStrings.PartitionedRegion_TRANSACTIONAL_DATA_MOVED_DUE_TO_REBALANCING
                     .toLocalizedString(key));
             ex.initCause(prce);
             throw ex;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/139398a1/geode-core/src/test/java/org/apache/geode/disttx/PRDistTXDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/disttx/PRDistTXDUnitTest.java b/geode-core/src/test/java/org/apache/geode/disttx/PRDistTXDUnitTest.java
index ed8d3c6..1061cd5 100644
--- a/geode-core/src/test/java/org/apache/geode/disttx/PRDistTXDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/disttx/PRDistTXDUnitTest.java
@@ -45,6 +45,10 @@ public class PRDistTXDUnitTest extends PRTransactionDUnitTest {
 
   @Ignore("[DISTTX] TODO test overridden and intentionally left blank as it does not apply
to disttx.")
   @Test
+  public void testTxWithGetOnMovedBucketUsingBucketReadHook() {}
+
+  @Ignore("[DISTTX] TODO test overridden and intentionally left blank as it does not apply
to disttx.")
+  @Test
   public void testTxWithContainsValueForKeyOnMovedBucket() {}
 
   @Ignore("[DISTTX] TODO test overridden and intentionally left blank as it does not apply
to disttx.")

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/139398a1/geode-core/src/test/java/org/apache/geode/disttx/PRDistTXWithVersionsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/disttx/PRDistTXWithVersionsDUnitTest.java
b/geode-core/src/test/java/org/apache/geode/disttx/PRDistTXWithVersionsDUnitTest.java
index 4e6f846..34c28f4 100644
--- a/geode-core/src/test/java/org/apache/geode/disttx/PRDistTXWithVersionsDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/disttx/PRDistTXWithVersionsDUnitTest.java
@@ -45,6 +45,10 @@ public class PRDistTXWithVersionsDUnitTest extends PRTransactionWithVersionsDUni
 
   @Ignore("[DISTTX] TODO test overridden and intentionally left blank as it does not apply
to disttx.")
   @Test
+  public void testTxWithGetOnMovedBucketUsingBucketReadHook() {}
+
+  @Ignore("[DISTTX] TODO test overridden and intentionally left blank as it does not apply
to disttx.")
+  @Test
   public void testTxWithContainsValueForKeyOnMovedBucket() {}
 
   @Ignore("[DISTTX] TODO test overridden and intentionally left blank as it does not apply
to disttx.")

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/139398a1/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRTransactionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRTransactionDUnitTest.java
b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRTransactionDUnitTest.java
index e2ba2b3..937059c 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRTransactionDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/execute/PRTransactionDUnitTest.java
@@ -580,11 +580,11 @@ public class PRTransactionDUnitTest extends PRColocationDUnitTest {
   @SuppressWarnings("unchecked")
   private void moveBucketForGet(OrderId order1, boolean isCust1Local, DistributedMember source,
       DistributedMember destination, PartitionedRegion prOrder) {
-    if (isCust1Local) {
+    if (isCust1Local && useBucketReadHook) {
       // Use TXState
       setBucketReadHook(order1, source, destination, prOrder);
     } else {
-      // Use TXStateStub -- transaction data on remote node
+      // Use TXState and TXStateStub -- transaction data on remote node
       PartitionRegionHelper.moveBucketByKey(prOrder, source, destination, order1);
     }
   }
@@ -648,6 +648,15 @@ public class PRTransactionDUnitTest extends PRColocationDUnitTest {
   }
 
   @Test
+  public void testTxWithGetOnMovedBucketUsingBucketReadHook() {
+    Op op = Op.GET;
+    useBucketReadHook = true;
+    basicPRTXWithOpOnMovedBucket(op, 0);
+  }
+
+  private boolean useBucketReadHook = false;
+
+  @Test
   public void testTxWithContainsValueForKeyOnMovedBucket() {
     Op op = Op.CONTAINSVALUEFORKEY;
     basicPRTXWithOpOnMovedBucket(op, 0);


Mime
View raw message