GrantPSpencer commented on code in PR #2932: URL: https://github.com/apache/helix/pull/2932#discussion_r1931415559
########## helix-core/src/main/java/org/apache/helix/controller/stages/ParticipantDeregistrationStage.java: ########## @@ -0,0 +1,114 @@ +package org.apache.helix.controller.stages; + +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import org.apache.helix.HelixException; +import org.apache.helix.HelixManager; +import org.apache.helix.controller.dataproviders.ResourceControllerDataProvider; +import org.apache.helix.controller.pipeline.AbstractAsyncBaseStage; +import org.apache.helix.controller.pipeline.AsyncWorkerType; +import org.apache.helix.model.ClusterConfig; +import org.apache.helix.model.InstanceConfig; +import org.apache.helix.model.LiveInstance; +import org.apache.helix.model.ParticipantHistory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import static org.apache.helix.util.RebalanceUtil.scheduleOnDemandPipeline; + + +public class ParticipantDeregistrationStage extends AbstractAsyncBaseStage { + private static final Logger LOG = LoggerFactory.getLogger(ParticipantDeregistrationStage.class); + + @Override + public AsyncWorkerType getAsyncWorkerType() { + return AsyncWorkerType.ParticipantDeregistrationWorker; + } + + @Override + public void execute(ClusterEvent event) throws Exception { + HelixManager manager = event.getAttribute(AttributeName.helixmanager.name()); + ClusterConfig clusterConfig = manager.getConfigAccessor().getClusterConfig(manager.getClusterName()); + if (clusterConfig == null || !clusterConfig.isParticipantDeregistrationEnabled()) { + LOG.info("Cluster config is null or participant deregistration is not enabled. " + + "Skipping participant deregistration."); + return; + } + + ResourceControllerDataProvider cache = event.getAttribute(AttributeName.ControllerDataProvider.name()); + Map<String, Long> offlineTimeMap = cache.getInstanceOfflineTimeMap(); + long deregisterDelay = clusterConfig.getParticipantDeregistrationTimeout(); + long stageStartTime = System.currentTimeMillis(); + Set<String> participantsToDeregister = new HashSet<>(); + long nextDeregisterTime = Long.MAX_VALUE; Review Comment: Updated to use -1 The DelayRebalance logic utilizes Long.MAX_VALUE. We should consider updating it in the future -- 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: reviews-unsubscr...@helix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@helix.apache.org For additional commands, e-mail: reviews-h...@helix.apache.org