[TASK] Refactor: phase 2 cleanup — remove legacy master-worker scheduler dead code
- Dominant language
- Java
- Stars
- 3.2k
- Forks
- 636
- Avg merge
- 3d 11h
- Merged PRs (30d)
- 14
Description
## Background
PR #3082 soft-disabled the pre-PD master-worker scheduling path and intentionally left
deprecated config handling, role-election wiring, and `ServerInfoManager` persistence as
compatibility scaffolding. This issue tracks the follow-up physical removal ("phase 2")
called out in the merge comment ("TODO: cleanup legacy code/configs in phrase2").
## Scope of removal
### 1. Deprecated config warnings + transition tests (low risk)
- `task.scheduler_type` warning block in `StandardHugeGraph`
- `ENABLE_SERVER_ROLE_ELECTION` warning in `GraphManager.initNodeRole()`
- `ServerOptions.ENABLE_SERVER_ROLE_ELECTION` config key declaration
- Transition-only tests: `testOpenGraphWithDeprecatedTaskSchedulerType` and
`testGraphManagerWarnsOnRoleElection`
### 2. Role election infrastructure (medium risk — touches `HugeGraph` interface)
All of the following are dead code — nothing starts the state machine after #3082:
- `StandardHugeGraph.initRoleStateMachine(Id)` and the `roleElectionStateMachine` field
- `roleElectionStateMachine()` from the `HugeGraph` interface and `HugeGraphAuthProxy`
- `GraphManager.initRoleStateMachine()` and `GraphManager.supportRoleElection()` (never called)
- `StandardRoleListener` class (never instantiated)
- `TaskManager.onAsRoleMaster()` / `onAsRoleWorker()` no-ops
- `TaskManager.schedulerExecutor` (`task-scheduler-%d`) zombie thread pool and `closeSchedulerTx()`
- `RoleElectionOptions` config key declarations
### 3. `ServerInfoManager` dead persistence path + `HugeServerInfo` deletion (medium risk)
- `ServerInfoManager.init()` (no-op), `heartbeat()` (no-op), `tx()`, `call()`, and the
`dbExecutor` field — the live methods (`selfNodeId`, `selfIsMaster`, `initServerInfo`, etc.)
must be kept since `DistributedTaskScheduler` still uses them
- `HugeServerInfo.java` — entire class, including `~server` vertex schema and load tracking
- `serverInfoDbExecutor` thread pool and `SERVER_INFO_DB_WORKER` constant from `TaskManager`
- `serverInfoDbExecutor` parameter from `StandardTaskScheduler`, `TaskAndResultScheduler`,
and `DistributedTaskScheduler` constructors
- Update `ServerInfoManagerTest` and `TaskSchedulerServerInfoTest` accordingly
## Suggested PR split
| PR | Scope | Risk |
|---|---|---|
| PR A | Deprecated config warnings + transition tests | Low |
| PR B | Role election infrastructure | Medium |
| PR C | `ServerInfoManager` surgery + `HugeServerInfo` deletion | Medium |
## Important constraints
- `ServerInfoManager` itself is **not** deleted — `DistributedTaskScheduler` still uses
`selfNodeId()` for task lock scoping.
- `TaskScheduler.serverManager()` interface method stays for the same reason.
- `StandardHugeGraph.serverStarted()` must keep the `initServerInfo(nodeInfo)` call —
only the `initRoleStateMachine(nodeInfo.nodeId())` call is removed.
- Before deleting `HugeServerInfo`, audit `HugeVertex.java` for `fromVertex` dispatch
references and any `initSchemaIfNeeded()` call sites in system init.
## Related
- #3082
Contributor guide
Research direction
Read PR #3082 and trace the listed entry points in StandardHugeGraph, GraphManager, TaskManager, ServerInfoManager, and HugeServerInfo. Run ServerInfoManagerTest and TaskSchedulerServerInfoTest, then audit HugeVertex.fromVertex and initSchemaIfNeeded() before removing each scoped path. Done means the three scoped cleanup areas are removed, required live ServerInfoManager behavior remains, and the affected tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- database
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100