Conversation
Nothing has started the role election state machine since apache#3082. Graphs started with a node id (tests, examples, and Gremlin scripts calling serverStarted(GlobalMasterInfo.master(...))) still built one, which wrote ~role_data schema and leaked an idle executor. TaskManager also kept the task-scheduler pool alive only to close transactions on it. Remove the masterelection classes other than GlobalMasterInfo, the HugeGraph.roleElectionStateMachine() accessor, the server.role_election and server.role.* options, the deprecation warnings added in apache#3082, and TaskManager's scheduler pool and role callbacks. Old config files that still set the removed keys only get HugeConfig's "redundant option" warning. HugeVertex keeps mapping the ~role_data label to HugeType.SERVER so vertices left in existing graphs still route to the same table.
ServerInfoManager.init() and heartbeat() have been no-ops since apache#3082, and tx()/call() had no callers, so the server-info-db-worker pool that backed them never ran anything. Remove those methods, the executor, the constructor parameter threaded through the task schedulers, and the HugeServerInfo vertex class. ServerInfoManager itself stays: StandardHugeGraph still hands it the node info, and TaskScheduler.serverManager() is part of the interface.
imbajin
reviewed
Sep 27, 2026
imbajin
left a comment
Member
There was a problem hiding this comment.
Blocking: no. Summary: Removing the public Java role-election API breaks consumers that depend on that interface method. Add migration guidance or retain a deprecated bridge through the declared removal version. Evidence: The exact-head diff removes roleElectionStateMachine() from HugeGraph.java and deletes its return type.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose of the PR
#3082 turned off the pre-PD master-worker scheduler but left the role election wiring, the deprecated config handling and ServerInfoManager's persistence path in place as compatibility scaffolding. This removes them.
Main Changes
Role election (first commit):
masterelectionclasses exceptGlobalMasterInfo(still used byRedirectFilter,ServerInfoManager, the Gremlin whitelist and examples),StandardRoleListener, andRoleElectionStateMachineTest.HugeGraph.roleElectionStateMachine()and its two implementations.server.role_electionand theserver.role.*options, including theRegisterUtilregistration and the code inGraphManagerandStandardAuthenticatorthat copied them into every graph config.task.scheduler_typeandserver.role_election.task-schedulerpool,closeSchedulerTx()and theonAsRoleMaster/Workerno-ops.Server info (second commit):
HugeServerInfo.ServerInfoManager.init(),heartbeat(),tx(),call()and its db executor, plus theserver-info-db-workerpool and the constructor parameter threaded throughStandardTaskScheduler,TaskAndResultSchedulerandDistributedTaskScheduler.Where this differs from the plan in the issue:
DistributedTaskSchedulerusesselfNodeId()/selfIsMaster(). Nothing calls them today; I kept them anyway sinceServerInfoManagerandTaskScheduler.serverManager()stay.initSchemaIfNeeded()call forHugeServerInfoto remove.HugeVertex.type()still maps~serverand~role_datatoHugeType.SERVER, now through string literals, so vertices left in existing graphs keep routing to the same table on hstore.task.scheduler_typeset, and thatGraphManagerstarts and appliesserver.rolewhen the removed role election keys are present.Migration notes (for the release notes)
Java API, source and binary incompatible:
HugeGraph.roleElectionStateMachine()is removed, together with the types it exposed:RoleElectionStateMachine,StandardRoleElectionStateMachine,RoleListener,StandardRoleListener,StateMachineContext,ClusterRole,ClusterRoleStore,StandardClusterRoleStore,Config,RoleElectionConfigandRoleElectionOptionsinorg.apache.hugegraph.masterelection. Code compiled against 1.7.0 that calls it fails withNoSuchMethodErrororNoClassDefFoundError. Since refactor(server): disable legacy master-worker scheduler logic #3082 the returned state machine was never started, so there is no behavior to port: delete the call. The task scheduler is picked by backend (DistributedTaskSchedulerfor hstore,StandardTaskSchedulerotherwise), and the node role still comes fromserver.rolethroughGlobalMasterInfo.HugeServerInfois removed, as areServerInfoManager.init()andheartbeat(), which were no-ops. TheServerInfoManager,StandardTaskScheduler,TaskAndResultSchedulerandDistributedTaskSchedulerconstructors drop their lastExecutorService(server info db executor) parameter; callers pass the remaining arguments unchanged.Configuration:
server.role_electionand theserver.role.*options are no longer registered. Remove them fromrest-server.properties. A config that still sets them starts normally, and HugeConfig logs one "redundant option" warning per key.I went with notes instead of a deprecated bridge because #3082 set no removal version for these APIs, and a bridge would have to keep the deleted
RoleElectionStateMachinetype alive only to return a machine nothing starts.Left for a follow-up (#3245):
GlobalMasterInfo.supportElectionis never set to true any more, so the redirect branch inRedirectFilteris dead, andGraphTransaction.queryServerInfos()has no callers.Verifying these changes
TaskSchedulerServerInfoTest.testLegacyServerLabelsKeepServerTypechecks the legacy label mapping inHugeVertexTaskSchedulerServerInfoTest.testGraphManagerIgnoresRemovedRoleElectionOptionsandMultiGraphsTest.testOpenGraphWithRemovedTaskSchedulerTypecover old config keysUnitTestSuite(747 run, 0 failures) and the rocksdb core testsTaskAndResultSchedulerTest,MultiGraphsTest,TaskCoreTest(30 run, 0 failures)Does this PR potentially affect the following parts?
"The public API" here is the Java
HugeGraphinterface losingroleElectionStateMachine(); no REST endpoint changes.Documentation Status
Select one option and provide the documentation location when applicable.
Doc - TODO: required documentation is pending; complete it before merging.Doc - Done: documentation is included here or linked below.Doc - No Need: no user-visible documentation is affected.Documentation files in this PR or paired hugegraph-doc PR:
Paired hugegraph-doc PR: apache/hugegraph-doc#502 (removes
server.role_electionand theserver.role.*block fromcontent/{en,cn}/docs/config/config-option.md). Please merge both together.