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/27 20:26:12 UTC

[GitHub] [geode] pivotal-eshu commented on a diff in pull request #7630: GEODE-10242: Do not release primary lock prematurely

pivotal-eshu commented on code in PR #7630:
URL: https://github.com/apache/geode/pull/7630#discussion_r860216096


##########
geode-core/src/test/java/org/apache/geode/internal/cache/BucketAdvisorTest.java:
##########
@@ -317,4 +331,38 @@ public void testGetAllHostingMembersReturnsMemberWhenBucketAdvisorHasTwoProfiles
 
     assertThat(bucketAdvisor.adviseInitialized().size()).isEqualTo(1);
   }
+
+  @Test
+  void removePrimaryDeposePrimaryForColocatedChildrenBeforeReleasePrimaryLock() {
+    when(regionAdvisor.getPartitionedRegion()).thenReturn(partitionedRegion);
+    when(regionAdvisor.getBucket(any(Integer.class))).thenReturn(bucket);
+    when(partitionedRegion.getPartitionAttributes()).thenReturn(new PartitionAttributesImpl());
+    when(bucket.getDistributionManager()).thenReturn(mock(DistributionManager.class));
+    BucketAdvisor bucketAdvisor = spy(BucketAdvisor.createBucketAdvisor(bucket, regionAdvisor));
+    InternalDistributedMember member = mock(InternalDistributedMember.class);
+    DistributionManager manager = mock(DistributionManager.class);
+    doReturn(true).when(bucketAdvisor).isPrimary();
+    doReturn(manager).when(bucketAdvisor).getDistributionManager();
+    when(manager.getId()).thenReturn(member);
+    bucketAdvisor.setPrimaryMemberForTest(member);

Review Comment:
   No longer add this method, but use an existing one instead. Change the method to be synchronized one should not be an issue as the "Caller must be synced 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