pivotal-eshu commented on code in PR #7596: URL: https://github.com/apache/geode/pull/7596#discussion_r858112810
########## geode-core/src/main/java/org/apache/geode/internal/cache/BucketAdvisor.java: ########## @@ -2762,4 +2763,44 @@ void markShadowBucketAsDestroyed(String shadowBucketPath) { public boolean isShadowBucketDestroyed(String shadowBucketPath) { return destroyedShadowBuckets.getOrDefault(shadowBucketPath, false); } + + boolean checkIfAllColocatedChildBucketsBecomePrimary() { + List<PartitionedRegion> colocatedChildPRs = getColocateNonShadowChildRegions(); + if (colocatedChildPRs.size() > 0) { + for (PartitionedRegion partitionedRegion : colocatedChildPRs) { + Bucket bucket = partitionedRegion.getRegionAdvisor().getBucket(getBucket().getId()); + if (bucket != null) { + BucketAdvisor bucketAdvisor = bucket.getBucketAdvisor(); + if (!bucketAdvisor.checkIfAllColocatedChildBucketsBecomePrimary()) { + return false; + } else { + if (!checkIfBecomesPrimary()) { + return false; + } + } + } + } + return true; + } + return checkIfBecomesPrimary(); + } + + @NotNull + List<PartitionedRegion> getColocateNonShadowChildRegions() { + return ColocationHelper.getColocatedNonShadowChildRegions(pRegion); + } + + private boolean checkIfBecomesPrimary() { + synchronized (this) { + try { + if (!isPrimary()) { + wait(10); Review Comment: The getBucketAdvisor().checkIfAllColocatedChildBucketsBecomePrimary() will retry again, if it becomes primary in 11ms and will pass in the retry. The reason added the pause is for a scenario that a child region is destroyed - while the leader is wait for bucketAdvisor state change, and never receive any if region is destroyed. However, the retry (after the pause) should detect this in the profile change and no longer wait for this child bucket when retrying. I do think I may need to increase the wait/pause to like 30 seconds or 60 seconds instead. -- 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-unsubscr...@geode.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org