DonalEvans commented on code in PR #7323:
URL: https://github.com/apache/geode/pull/7323#discussion_r841931745


##########
geode-core/src/main/java/org/apache/geode/internal/cache/BucketAdvisor.java:
##########
@@ -1160,6 +1169,7 @@ private boolean acquiredPrimaryLock() {
     try {
       synchronized (this) {
         if (isHosting() && (isVolunteering() || isBecomingPrimary())) {
+          hasBecomePrimary = isBecomingPrimary();

Review Comment:
   I think there is a timing window where `isVoluteering()` returns true in the 
if statement above, but `isBecomingPrimary()` does not. After the call to 
`setPrimaryMember()` on line 1182, this bucket will be the primary, but 
`hasBecomePrimary` will not have been set to true.
   
   I feel that a better solution might be to have a method in `BucketAdvisor`:
   ```
     boolean isPrimaryOrVolunteering() {
       return isVolunteering() || isBecomingPrimary() || isPrimary();
     }
   ```
   and then call that method in `BucketRegionQueue`:
   ```
           BucketAdvisor parent = getParentAdvisor(getBucketAdvisor());
           if (parent.isPrimaryOrVolunteering()) {
             return;
           }
   ```



-- 
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]

Reply via email to