jchen21 commented on a change in pull request #7356:
URL: https://github.com/apache/geode/pull/7356#discussion_r804263971



##########
File path: 
geode-core/src/main/java/org/apache/geode/internal/cache/BucketAdvisor.java
##########
@@ -1424,9 +1424,16 @@ private InternalDistributedMember 
waitForPrimaryMember(long timeout) {
                       "{} secs have elapsed waiting for a primary for bucket 
{}. Current bucket owners {}",
                       new Object[] {warnTime / 1000L, this, 
adviseInitialized()});
               // log a warning;
+              Set<InternalDistributedMember> memberToClear = 
adviseInitialized();
+              for (InternalDistributedMember member : memberToClear) {
+                ProfileId id = getProfileIdForMember(member);
+                logger.warn("Removing profile for member " + member + " 
profileid = " + id
+                    + " because we think it is stale");
+                removeId(id, false, false, false);

Review comment:
       I am afraid this could potentially remove the non-stale 
`ServerBucketProfile`.

##########
File path: 
geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionAdvisor.java
##########
@@ -1329,6 +1329,23 @@ private synchronized Profile 
basicRemoveMemberId(ProfileId id) {
 
   }
 
+  /**
+   * Perform work of removing the given member from this advisor.
+   */
+  protected synchronized ProfileId 
getProfileIdForMember(InternalDistributedMember member) {
+    // must synchronize when modifying profile array
+
+    Profile[] locProfiles = profiles; // grab current profiles
+    for (int i = 0; i < locProfiles.length; i++) {
+      if (locProfiles[i].getDistributedMember().getId() == member.getId()) {

Review comment:
       Instead of `==`, it should be `equals()`. Otherwise, it is comparing the 
references instead of the strings. Or  
`locProfiles[i].getDistributedMember().equals(member)` also works.




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