pkuwm commented on a change in pull request #1066:
URL: https://github.com/apache/helix/pull/1066#discussion_r460270771
##########
File path:
helix-core/src/main/java/org/apache/helix/controller/GenericHelixController.java
##########
@@ -312,6 +312,17 @@ private void forceRebalance(HelixManager manager,
ClusterEventType eventType) {
changeContext.setType(NotificationContext.Type.CALLBACK);
String uid = UUID.randomUUID().toString().substring(0, 8);
ClusterEvent event = new ClusterEvent(_clusterName, eventType, uid);
+
+ Optional<String> leaderSession = manager.getSessionIdIfLead();
+ // If session is not present, this cluster manager is not leader for the
cluster.
+ if (!leaderSession.isPresent()) {
+ logger.warn("Cluster manager {} is not leader for {}. Event {} is
discarded.",
+ manager.getInstanceName(), manager.getClusterName(), event);
+ return;
+ }
+
+ // Pipeline should be run and Zk writes should be completed by the event
session.
+ event.addAttribute(AttributeName.EVENT_SESSION.name(),
leaderSession.get());
Review comment:
Since there are 3 places creating new events, I've moved the check to
handleEvent().
----------------------------------------------------------------
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]