pivotal-jbarrett commented on code in PR #7596:
URL: https://github.com/apache/geode/pull/7596#discussion_r857935699
##########
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:
What is the ramifications if it becomes primary in 11ms? It seems if there
is no adverse ramifications then adding a pause serves no purpose.
--
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]