pivotal-eshu commented on code in PR #7596:
URL: https://github.com/apache/geode/pull/7596#discussion_r855675613
##########
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:
When we waiting for child buckets movePrimary to finish, we will allow
sometime to see if it becomes primary. It can be argued how long it should wait.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]