You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2022/02/10 19:57:31 UTC

[GitHub] [geode] mhansonp opened a new pull request #7356: Do Not Review

mhansonp opened a new pull request #7356:
URL: https://github.com/apache/geode/pull/7356


   GEODE-10039: Fix to remove a stale profile when waiting for a new primary will never succeed.
   


-- 
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: notifications-unsubscribe@geode.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode] jchen21 commented on a change in pull request #7356: Do Not Review

Posted by GitBox <gi...@apache.org>.
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: notifications-unsubscribe@geode.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org