You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2022/04/01 23:56:38 UTC

[GitHub] [geode] pivotal-eshu opened a new pull request #7546: GEODE-10211: Correctly check persistence on accessor

pivotal-eshu opened a new pull request #7546:
URL: https://github.com/apache/geode/pull/7546


    * To set possible duplicate for an event, whether region is persistent
      need to be determined. Allow an accessor to check the setting through
      profiles.
   
   <!-- Thank you for submitting a contribution to Apache Geode. -->
   
   <!-- In order to streamline the review of the contribution we ask you
   to ensure the following steps have been taken: 
   -->
   
   ### For all changes:
   - [ ] Is there a JIRA ticket associated with this PR? Is it referenced in the commit message?
   
   - [ ] Has your PR been rebased against the latest commit within the target branch (typically `develop`)?
   
   - [ ] Is your initial contribution a single, squashed commit?
   
   - [ ] Does `gradlew build` run cleanly?
   
   - [ ] Have you written or updated unit tests to verify your changes?
   
   - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?
   
   <!-- Note:
   Please ensure that once the PR is submitted, check Concourse for build issues and
   submit an update to your PR as soon as possible. If you need help, please send an
   email to dev@geode.apache.org.
   -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@geode.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode] pivotal-jbarrett commented on a change in pull request #7546: GEODE-10211: Correctly check persistence on accessor

Posted by GitBox <gi...@apache.org>.
pivotal-jbarrett commented on a change in pull request #7546:
URL: https://github.com/apache/geode/pull/7546#discussion_r840977527



##########
File path: geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Put70.java
##########
@@ -463,13 +464,13 @@ public void cmdExecute(final @NotNull Message clientMessage,
 
   }
 
+  @VisibleForTesting

Review comment:
       @kirklund your opinion on this?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@geode.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode] pivotal-jbarrett commented on a change in pull request #7546: GEODE-10211: Correctly check persistence on accessor

Posted by GitBox <gi...@apache.org>.
pivotal-jbarrett commented on a change in pull request #7546:
URL: https://github.com/apache/geode/pull/7546#discussion_r840977402



##########
File path: geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/command/Put70Test.java
##########
@@ -307,10 +317,44 @@ public void shouldSetPossibleDuplicateReturnsFalseIfNotRecoveredVersionTagAndNoP
   public void shouldSetPossibleDuplicateReturnsTrueIfNotRecoveredVersionTagAndWithPersistence() {
     Put70 spy = Mockito.spy(put70);
     when(attributes.getConcurrencyChecksEnabled()).thenReturn(true);
-    when(dataPolicy.withPersistence()).thenReturn(true);
     doReturn(false).when(spy).recoverVersionTagForRetriedOperation(clientEvent);
+    doReturn(true).when(spy).isRegionWithPersistence(localRegion);
 
     assertThat(spy.shouldSetPossibleDuplicate(localRegion, clientEvent)).isTrue();
   }
 
+  @Test
+  public void isRegionWithPersistenceReturnsTrueIfDataPolicyWithPersistence() {
+    when(dataPolicy.withPersistence()).thenReturn(true);
+
+    assertThat(put70.isRegionWithPersistence(localRegion)).isTrue();
+  }
+
+  @Test
+  public void isRegionWithPersistenceReturnsTrueIfIsAccessorAndHavingPersistentMembers() {
+    when(dataPolicy.withPersistence()).thenReturn(false);
+    when(partitionedRegion.isDataStore()).thenReturn(false);
+    when(partitionedRegion.getRegionAdvisor()).thenReturn(regionAdvisor);
+    when(regionAdvisor.advisePersistentMembers()).thenReturn(uncheckedCast(mock(Map.class)));

Review comment:
       Since you aren't mocking it, perhaps `Collections.emptyMap()`?

##########
File path: geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/command/Put70.java
##########
@@ -463,13 +464,13 @@ public void cmdExecute(final @NotNull Message clientMessage,
 
   }
 
+  @VisibleForTesting

Review comment:
       Package protected is not really "visible for testing" but rather a necessity for testing. I don't think we need to tag all these.

##########
File path: geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/command/Put70Test.java
##########
@@ -25,6 +25,8 @@
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
+import java.util.Map;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;

Review comment:
       Please update the test to JUnit 5.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@geode.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org