Github user gesterzhou commented on a diff in the pull request:

    https://github.com/apache/geode/pull/570#discussion_r130729615
  
    --- Diff: 
geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionDataStore.java
 ---
    @@ -1472,6 +1472,19 @@ public boolean removeBucket(int bucketId, boolean 
forceRemovePrimary) {
           }
     
           BucketAdvisor bucketAdvisor = bucketRegion.getBucketAdvisor();
    +      InternalDistributedMember primary = bucketAdvisor.getPrimary();
    +      InternalDistributedMember myId =
    +          
this.partitionedRegion.getDistributionManager().getDistributionManagerId();
    +      if (primary == null || myId.equals(primary)) {
    --- End diff --
    
    The forceRemovePrimary WAS useless and it can be removed because it always 
use "false".
    
    But when I added the logic to remove the leader region bucket (when the 
shadow bucket failed to initialize), then I have to call the removeBucket(xxx, 
true) by myself. 
    
    The shadow bucket was removed first by the exception handling. But I added 
the logic to remove leader bucket, I have to skip a few "return false" exit 
points, because at this time the leader bucket is not logically ready and not 
qualified to be removed unless I force to remove it. 
    
    So I make use of the forceRemovePrimary parameter. Maybe I should change it 
to better name, such as forceToRemove.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to