jiajunwang commented on a change in pull request #1753:
URL: https://github.com/apache/helix/pull/1753#discussion_r639293337



##########
File path: 
helix-core/src/main/java/org/apache/helix/participant/DistClusterControllerStateModel.java
##########
@@ -85,7 +85,7 @@ public void onBecomeStandbyFromLeader(Message message, 
NotificationContext conte
 
     logger.info(controllerName + " becoming standby from leader for " + 
clusterName);
 
-    if (_controller != null) {
+    if (_controllerOpt.isPresent()) {

Review comment:
       1. State transitions are all happening in one thread. So there is no 
race condition between the reset here and the creation logic. This PR is to fix 
the NPE when the reset is triggered by shutdown. And this line won't cause the 
issue even without the fix.
   2. This fix is only to fix NPE, it won't fix all potential leakage. Note 
that if the partition is in ERROR state, then when we drop the partition, there 
is no clean up. This is the most serious leakage, actually. If the test is 
still not stable, I plan to fix this problem in another PR.

##########
File path: 
helix-core/src/main/java/org/apache/helix/participant/DistClusterControllerStateModel.java
##########
@@ -85,7 +85,7 @@ public void onBecomeStandbyFromLeader(Message message, 
NotificationContext conte
 
     logger.info(controllerName + " becoming standby from leader for " + 
clusterName);
 
-    if (_controller != null) {
+    if (_controllerOpt.isPresent()) {

Review comment:
       1. State transitions are all happening in one thread. So there is no 
race condition between the reset here and the creation logic. This PR is to fix 
the NPE when the reset is triggered by shutdown. And this line won't cause the 
issue even without the fix.
   2. This PR is only to fix NPE, it won't fix all potential leakage. Note that 
if the partition is in ERROR state, then when we drop the partition, there is 
no clean up. This is the most serious leakage, actually. If the test is still 
not stable, I plan to fix this problem in another PR.




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

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to