imbajin commented on code in PR #2676:
URL: https://github.com/apache/hugegraph/pull/2676#discussion_r3323581890


##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskManager.java:
##########
@@ -439,14 +439,15 @@ private void scheduleOrExecuteJobForGraph(TaskScheduler 
scheduler) {
                 // Update server heartbeat
                 serverManager.heartbeat();
 
+                serverManager.updateIsSingleNode();

Review Comment:
   ‼️ `onlySingleNode` is first refreshed here, but 
`selfIsMasterOrSingleComputer()` is already used by 
`StandardTaskScheduler.checkOnMasterNode()` before this periodic loop runs. 
Since `TaskManager` starts this loop with a `10 * SCHEDULE_PERIOD` initial 
delay, a standalone `server.role=computer` node can still reject the first task 
request after startup with `Can't schedule task on non-master server`. Please 
initialize this state during server-info bootstrap, or compute the 
standalone-computer condition on demand instead of waiting for the background 
scheduler.



##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/ServerInfoManager.java:
##########
@@ -198,7 +208,7 @@ public synchronized void heartbeat() {
             LOG.info("ServerInfo is missing: {}, may not be initialized yet", 
this.selfNodeId());
             return;
         }
-        if (this.selfIsMaster()) {
+        if (this.selfIsMasterOrSingleComputer()) {

Review Comment:
   ‼️ This changes the recovery behavior for standalone computer nodes when 
their own `ServerInfo` entry is missing. Before this patch, non-master nodes 
recreated the missing record locally via `saveServerInfo(...)`; after this 
change, a standalone computer returns here and waits for re-init like a master. 
In standalone `server.role=computer` mode there is no master to recreate that 
row, so once the server-info vertex is lost the node cannot recover itself 
anymore. Please keep the local re-save path for standalone computers, or add a 
dedicated re-init path for them.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to