refactor(server): remove legacy scheduler code [p2] - #3244
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
left a comment
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.
|
@imbajin I added a "Migration notes (for the release notes)" section to the description covering the removed |
|
Checked what merging this does to the other open PRs: I ran Only one gets a new conflict: #3139 adds an import directly below the three |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #3244 +/- ##
============================================
+ Coverage 41.40% 41.58% +0.17%
+ Complexity 7337 7326 -11
============================================
Files 802 795 -7
Lines 69792 69198 -594
Branches 9312 9269 -43
============================================
- Hits 28897 28773 -124
+ Misses 37604 37145 -459
+ Partials 3291 3280 -11 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
bitflicker64
left a comment
There was a problem hiding this comment.
Blocking: no. Summary: The removal is complete at 5117958. No removed class, method, option or pool is still referenced, HugeVertex still maps ~server and ~role_data to HugeType.SERVER with the same label strings the deleted classes used, and old configs that set server.role_election, server.role.* or task.scheduler_type still load with a redundant-option warning while server.role keeps applying. The Java API break raised earlier is now covered by the migration notes in the description. Evidence: static review of the full diff against 2f827d6 plus git grep at head for every removed symbol; TaskManager.shutdown() ordering, the HugeFactoryAuthProxy filter lists and HugeConfig.addPropertyDirect checked; no use of the removed API in hugegraph-toolchain, hugegraph-computer or hugegraph-ai; all 22 checks at this head pass, with UnitTestSuite 747/0 failures (memory job) and CoreTestSuite 816/0 plus ApiTestSuite 161/0 (rocksdb job).
RedirectFilter only forwarded requests when GlobalMasterInfo.supportElection() was true, and the only code that set it was the role election path removed in apache#3244, which nothing had called since apache#3082. The filter was still registered on 21 endpoint methods and returned early on every request. Remove RedirectFilter, RedirectFilterDynamicFeature and the @RedirectMasterRole annotations, the election and master URL state in GlobalMasterInfo, and GraphTransaction.queryServerInfos(), which read the ~server vertices HugeServerInfo used to write and had no callers.
RedirectFilter only forwarded requests when GlobalMasterInfo.supportElection() was true, and the only code that set it was the role election path removed in #3244, which nothing had called since #3082. The filter was still registered on 21 endpoint methods and returned early on every request. Remove RedirectFilter, RedirectFilterDynamicFeature and the @RedirectMasterRole annotations, the election and master URL state in GlobalMasterInfo, and GraphTransaction.queryServerInfos(), which read the ~server vertices HugeServerInfo used to write and had no callers.
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. In 1.7.0,server.role_election=truestarted this state machine to elect a master among REST servers; refactor(server): disable legacy master-worker scheduler logic #3082 (not yet released) already stopped starting it, so the behavior change for 1.7.0 users comes from refactor(server): disable legacy master-worker scheduler logic #3082 and this PR only removes the unused API. Callers should delete the call. For task scheduling across several servers, use the hstore backend, which usesDistributedTaskScheduler; other backends use the localStandardTaskScheduler. 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.