Fixing the race condition that segment finished before ControllerLeaderLocator created.
@@ -363,6 +363,7 @@ public class HelixServerStarter implements ServiceStartable {
LOGGER.info("Initializing server instance and registering state model factory");
Utils.logVersions();
+ ControllerLeaderLocator.create(_helixManager);
ServerSegmentCompletionProtocolHandler
.init(_serverConf.subset(SegmentCompletionProtocol.PREFIX_OF_CONFIG_OF_SEGMENT_UPLOADER));
ServerConf serverInstanceConfig = DefaultHelixStarterServerConfig.getDefaultHelixServerConfig(_serverConf);
@@ -414,8 +415,6 @@ public class HelixServerStarter implements ServiceStartable {
// Register the service status handler
registerServiceStatusHandler();
- ControllerLeaderLocator.create(_helixManager);
-
if (_serverConf
.getProperty(CONFIG_OF_STARTUP_ENABLE_SERVICE_STATUS_CHECK, DEFAULT_STARTUP_ENABLE_SERVICE_STATUS_CHECK)) {
long endTimeMs = startTimeMs + _serverConf.getProperty(CONFIG_OF_STARTUP_TIMEOUT_MS, DEFAULT_STARTUP_TIMEOUT_MS);
