You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by es...@apache.org on 2019/08/14 20:35:15 UTC

[geode] branch feature/GEODE-7087 created (now 6b79207)

This is an automated email from the ASF dual-hosted git repository.

eshu11 pushed a change to branch feature/GEODE-7087
in repository https://gitbox.apache.org/repos/asf/geode.git.


      at 6b79207  GEODE-7087: Reset flag after unlock bucket primary lock.

This branch includes the following new commits:

     new 6b79207  GEODE-7087: Reset flag after unlock bucket primary lock.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[geode] 01/01: GEODE-7087: Reset flag after unlock bucket primary lock.

Posted by es...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

eshu11 pushed a commit to branch feature/GEODE-7087
in repository https://gitbox.apache.org/repos/asf/geode.git

commit 6b7920745c7bf15ccf7edcc949f214ede50ddf12
Author: eshu <es...@pivotal.io>
AuthorDate: Wed Aug 14 13:33:08 2019 -0700

    GEODE-7087: Reset flag after unlock bucket primary lock.
---
 .../java/org/apache/geode/internal/cache/TXState.java     | 12 +++++++++---
 .../java/org/apache/geode/internal/cache/TXStateTest.java | 15 +++++++++++++++
 2 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/TXState.java b/geode-core/src/main/java/org/apache/geode/internal/cache/TXState.java
index 9ec621b..b040afc 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/TXState.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/TXState.java
@@ -139,7 +139,7 @@ public class TXState implements TXStateInterface {
   protected final TXStateProxy proxy;
   protected boolean firedWriter = false;
   protected final boolean onBehalfOfRemoteStub;
-  protected boolean gotBucketLocks = false;
+  private boolean gotBucketLocks = false;
   protected TXCommitMessage commitMessage = null;
   ClientProxyMembershipID bridgeContext = null;
   /** keeps track of events, so as not to re-apply events */
@@ -906,7 +906,7 @@ public class TXState implements TXStateInterface {
         /*
          * Need to unlock the primary lock for rebalancing so that rebalancing can resume.
          */
-        if (gotBucketLocks) {
+        if (isBucketLocks()) {
           if (r instanceof BucketRegion && (((BucketRegion) r).getBucketAdvisor().isPrimary())) {
             try {
               ((BucketRegion) r).doUnlockForPrimary();
@@ -932,13 +932,19 @@ public class TXState implements TXStateInterface {
       synchronized (this.completionGuard) {
         this.completionGuard.notifyAll();
       }
-
+      if (isBucketLocks()) {
+        gotBucketLocks = false;
+      }
       if (exception != null && !this.proxy.getCache().isClosed()) {
         throw exception;
       }
     }
   }
 
+  boolean isBucketLocks() {
+    return gotBucketLocks;
+  }
+
   /*
    * (non-Javadoc)
    *
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/TXStateTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/TXStateTest.java
index 362ee5f..0da6aad 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/TXStateTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/TXStateTest.java
@@ -20,6 +20,7 @@ import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.assertj.core.api.Assertions.catchThrowable;
 import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
+import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.doThrow;
 import static org.mockito.Mockito.mock;
@@ -29,6 +30,8 @@ import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
+import java.util.List;
+
 import javax.transaction.Status;
 
 import org.junit.Before;
@@ -298,4 +301,16 @@ public class TXStateTest {
     verify(regionState1).cleanup(region1);
   }
 
+  @Test
+  public void gotBucketLocksFlagIsResetAfterCommit() {
+    TXState txState = spy(new TXState(txStateProxy, false, disabledClock()));
+    List entries = mock(List.class);
+    doReturn(entries).when(txState).generateEventOffsets();
+    doNothing().when(txState).attachFilterProfileInformation(entries);
+    doNothing().when(txState).applyChanges(entries);
+    txState.commit();
+
+    assertThat(txState.isBucketLocks()).isFalse();
+  }
+
 }