dosubot[bot] commented on issue #2667:
URL:
https://github.com/apache/incubator-hugegraph/issues/2667#issuecomment-2380669832
<!-- Answer -->
If you set `server.role=computer`, the system will still check if
`serverinfo` exists. The `heartbeat` method in the `ServerInfoManager` class
explicitly checks for the existence of `serverinfo` regardless of the server
role:
```java
public synchronized void heartbeat() {
assert this.graphIsReady();
HugeServerInfo serverInfo = this.selfServerInfo();
if (serverInfo != null) {
// Update heartbeat time for this server
serverInfo.updateTime(DateUtil.now());
this.save(serverInfo);
return;
}
/* ServerInfo is missing */
if (this.selfNodeId() == null) {
// Ignore if ServerInfo is not initialized
LOG.info("ServerInfo is missing: {}, may not be initialized yet");
return;
}
if (this.selfIsMaster()) {
// On master node, just wait for ServerInfo re-init
LOG.warn("ServerInfo is missing: {}, may be cleared before",
this.selfNodeId());
return;
}
/*
* Missing server info on non-master node, may be caused by graph
* truncated on master node then synced by raft.
* TODO: we just patch it here currently, to be improved.
*/
serverInfo = this.saveServerInfo(this.selfNodeId(), this.selfNodeRole());
assert serverInfo != null;
}
```
This method checks if `serverInfo` is `null` and handles the situation
accordingly, indicating that the existence of `serverinfo` is always checked
<sup>[[1]](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/ServerInfoManager.java)</sup>.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
--
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]