You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hugegraph.apache.org by "bitflicker64 (via GitHub)" <gi...@apache.org> on 2026/07/09 08:58:50 UTC

[I] refactor(task): phase 2 cleanup — remove legacy master-worker scheduler dead code [hugegraph]

bitflicker64 opened a new issue, #3086:
URL: https://github.com/apache/hugegraph/issues/3086

   ### Bug Type (问题类型)
   
   None
   
   ### Before submit
   
   - [x] 我已经确认现有的 [Issues](https://github.com/apache/hugegraph/issues) 与 [FAQ](https://hugegraph.apache.org/docs/guides/faq/) 中没有相同 / 重复问题 (I have confirmed and searched that there are no similar problems in the historical issue and documents)
   
   ### Environment (环境信息)
   
   - Server Version: 1.0.0 (Apache Release Version)
   - Backend: RocksDB x nodes, HDD or SSD 
   - OS: xx CPUs, xx G RAM, Ubuntu 2x.x / CentOS 7.x 
   - Data Size:  xx vertices, xx edges <!-- (like 1000W 点, 9000W 边) -->
   
   
   ### Expected & Actual behavior (期望与实际表现)
   
   ## 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
   
   ### Vertex/Edge example (问题点 / 边数据举例)
   
   ```javascript
   
   ```
   
   ### Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)
   
   ```javascript
   
   ```


-- 
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: dev-unsubscribe@hugegraph.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [TASK] Refactor: phase 2 cleanup — remove legacy master-worker scheduler dead code [hugegraph]

Posted by "byteayan (via GitHub)" <gi...@apache.org>.
byteayan commented on issue #3086:
URL: https://github.com/apache/hugegraph/issues/3086#issuecomment-5933079645

   #3244 has been merged as 82034fb, which completes the phase 2 cleanup tracked here. It did not close this issue automatically, so could a maintainer close it? The remaining RedirectFilter dead code is tracked separately in #3245 (fix in #3246).


-- 
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: issues-unsubscribe@hugegraph.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [I] refactor(task): phase 2 cleanup — remove legacy master-worker scheduler dead code [hugegraph]

Posted by "bitflicker64 (via GitHub)" <gi...@apache.org>.
bitflicker64 commented on issue #3086:
URL: https://github.com/apache/hugegraph/issues/3086#issuecomment-4923389461

   ## Implementation Plan  
     
   Splitting into 3 PRs ordered by risk. Each PR is independently reviewable and mergeable.  
     
   ---  
     
   ### PR A — Remove deprecated config warnings + transition tests  
     
   **Files to change:**  
     
   - `hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/StandardHugeGraph.java`  
     - Delete the `task.scheduler_type` `containsKey` warning block (~lines 229-234)  
     
   - `hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/core/GraphManager.java`  
     - In `initNodeRole()`: remove the `enableRoleElection` local variable and the `if (enableRoleElection)` warning block; keep only the `SERVER_ROLE` read and `initNodeRole()` call  
     
   - `hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java`  
     - Delete the `ENABLE_SERVER_ROLE_ELECTION` config key declaration  
     
   - `hugegraph-server/hugegraph-test/.../core/MultiGraphsTest.java`  
     - Delete `testOpenGraphWithDeprecatedTaskSchedulerType`  
     
   - `hugegraph-server/hugegraph-test/.../unit/core/TaskSchedulerServerInfoTest.java`  
     - Delete `testGraphManagerWarnsOnRoleElection`  
     
   No interface changes. Compile + existing tests should pass as-is.  
     
   ---  
     
   ### PR B — Remove role election infrastructure  
     
   **Files to change:**  
     
   - `StandardHugeGraph.java`  
     - In `serverStarted()`: remove the `this.initRoleStateMachine(nodeInfo.nodeId())` call (keep `initServerInfo`)  
     - Delete the entire `initRoleStateMachine(Id serverId)` private method  
     - Delete the `roleElectionStateMachine` field declaration  
     - Delete the `roleElectionStateMachine()` public method  
     
   - `HugeGraph.java` (interface)  
     - Remove the `roleElectionStateMachine()` method declaration  
     
   - `HugeGraphAuthProxy.java`  
     - Remove the `roleElectionStateMachine()` override and its delegate call  
     
   - `GraphManager.java`  
     - Delete `initRoleStateMachine()` method entirely (never called)  
     - Delete `supportRoleElection()` method entirely (never called)  
     - In `serverStarted()`: delete the dead `if (!this.globalNodeRoleInfo.nodeRole().computer() && ...)` block  
     
   - `TaskManager.java`  
     - Delete `onAsRoleMaster()` and `onAsRoleWorker()` no-op methods  
     - Delete `schedulerExecutor` field and `TASK_SCHEDULER` constant  
     - Delete `schedulerExecutor` allocation in constructor  
     - Delete `closeSchedulerTx()` private method  
     - Remove `closeSchedulerTx(graph)` call inside `closeScheduler()`  
     - Delete `schedulerExecutor` shutdown block in `shutdown()`  
     
   - `StandardRoleListener.java` — **delete entire file**  
     
   - `RoleElectionOptions.java` — remove all config key declarations (or delete the class if nothing else references it; grep first)  
     
   **Verify:** `HugeGraph` interface has multiple implementations — make sure all of them compile after removing `roleElectionStateMachine()`.  
     
   ---  
     
   ### PR C — Slim `ServerInfoManager`, delete `HugeServerInfo`, drop `serverInfoDbExecutor`  
     
   **Important constraint:** `ServerInfoManager` is NOT deleted. `DistributedTaskScheduler` still uses `selfNodeId()` and `selfIsMaster()`. The `serverManager()` method on the `TaskScheduler` interface stays.  
     
   **Files to change:**  
     
   - `ServerInfoManager.java`  
     - Remove `dbExecutor` field  
     - Remove `dbExecutor` parameter from constructor (and its `E.checkNotNull` guard)  
     - Delete `init()` method  
     - Delete `heartbeat()` method  
     - Delete `tx()` private method  
     - Delete `call()` private method  
     - Remove dead imports (`Callable`, `ExecutorService`, `GraphTransaction`, `HugeException`)  
     - `close()` stays but simplify to just `this.closed = true`  
     
   - `StandardTaskScheduler.java`  
     - Remove `serverInfoDbExecutor` parameter from constructor  
     - Change `new ServerInfoManager(graph, serverInfoDbExecutor)` → `new ServerInfoManager(graph)`  
     - If `synchronized (this.serverManager)` is used as a monitor in `tx()`, replace with `synchronized (this)` or a dedicated lock field  
     
   - `TaskAndResultScheduler.java`  
     - Remove `serverInfoDbExecutor` parameter from constructor  
     - Change `new ServerInfoManager(graph, serverInfoDbExecutor)` → `new ServerInfoManager(graph)`  
     
   - `DistributedTaskScheduler.java`  
     - Remove `serverInfoDbExecutor` parameter from constructor  
     - Update `super(graph, serverInfoDbExecutor)` → `super(graph)`  
     
   - `TaskManager.java`  
     - Delete `serverInfoDbExecutor` field and `SERVER_INFO_DB_WORKER` constant  
     - Delete `serverInfoDbExecutor` allocation in constructor  
     - Remove `serverInfoDbExecutor` argument from both `addScheduler()` constructor calls  
     - Delete `serverInfoDbExecutor` shutdown block in `shutdown()`  
     
   - `HugeVertex.java`  
     - Audit for `HugeServerInfo` references (2 matches) — likely a `fromVertex` dispatch case; remove it  
     
   - `StandardHugeGraph.java`  
     - Audit for `initSchemaIfNeeded()` call on `HugeServerInfo.Schema` in `initSystemInfo()` — remove it  
     
   - `HugeServerInfo.java` — **delete entire file** (after removing all call sites above)  
     
   - `ServerInfoManagerTest.java`  
     - Delete `testInitDoesNotAccessBackendStore` (method no longer exists)  
     - Update constructor calls: remove the `executor` argument everywhere  
     
   - `TaskSchedulerServerInfoTest.java`  
     - Remove `serverInfoDbExecutor` local variable, its `shutdownNow()` call, and the constructor argument from the remaining tests  
     
   - `TaskAndResultSchedulerTest.java`  
     - Same: remove `serverInfoDbExecutor` from all constructor calls (~10 occurrences)  
     
   ---  
     
   ### Checklist before each PR merges  
   - [ ] `mvn compile` passes  
   - [ ] `mvn test -pl hugegraph-server/hugegraph-test` passes  
   - [ ] No remaining references to deleted classes/methods (grep for `HugeServerInfo`, `roleElectionStateMachine`, `schedulerExecutor`, `serverInfoDbExecutor` as appropriate)
   
   
   
   


-- 
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: issues-unsubscribe@hugegraph.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [I] [TASK] Refactor: phase 2 cleanup — remove legacy master-worker scheduler dead code [hugegraph]

Posted by "imbajin (via GitHub)" <gi...@apache.org>.
imbajin closed issue #3086: [TASK] Refactor: phase 2 cleanup — remove legacy master-worker scheduler dead code
URL: https://github.com/apache/hugegraph/issues/3086


-- 
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: dev-unsubscribe@hugegraph.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [TASK] Refactor: phase 2 cleanup — remove legacy master-worker scheduler dead code [hugegraph]

Posted by "imbajin (via GitHub)" <gi...@apache.org>.
imbajin closed issue #3086: [TASK] Refactor: phase 2 cleanup — remove legacy master-worker scheduler dead code
URL: https://github.com/apache/hugegraph/issues/3086


-- 
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: dev-unsubscribe@hugegraph.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org