Skip to content
Open
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
b4321eb
fix(server): disable server-role in StandardTaskScheduler
Tsukilc Nov 6, 2025
d19096d
fix(server): disable server-role in StandardTaskScheduler
Tsukilc Nov 6, 2025
a32901a
fix(server): disable server-role in StandardTaskScheduler
Tsukilc Nov 7, 2025
42ee2ba
fix(server): disable server-role in StandardTaskScheduler
Tsukilc Nov 7, 2025
c976caa
fix(server): disable server-role in StandardTaskScheduler
Tsukilc Nov 7, 2025
570d670
fix(server): disable server-role in StandardTaskScheduler
Tsukilc Nov 10, 2025
5915428
fix(server): disable server-role in StandardTaskScheduler
Tsukilc Nov 6, 2025
e7da7e5
fix(server): disable server-role in StandardTaskScheduler
Tsukilc Nov 6, 2025
b0f381c
fix(server): disable server-role in StandardTaskScheduler
Tsukilc Nov 7, 2025
804055d
fix(server): disable server-role in StandardTaskScheduler
Tsukilc Nov 7, 2025
2e8578e
fix(server): disable server-role in StandardTaskScheduler
Tsukilc Nov 7, 2025
2c44cee
fix(server): disable server-role in StandardTaskScheduler
Tsukilc Nov 10, 2025
925c384
fix(server): fix npe in non-auth mode
Tsukilc Jan 11, 2026
3974048
fix(server): fix npe in non-auth mode
Tsukilc Jan 11, 2026
a349f62
fix(server): fix npe in non-auth mode
Tsukilc Jan 11, 2026
3e7bc6f
fix(server): remove server.id
Tsukilc Jan 11, 2026
e6cc98b
Merge branch 'fix/scheduler' of https://github.com/hugegraph/hugegrap…
Tsukilc Jan 11, 2026
e6f6487
fix(server): remove task.scheduler_type
Tsukilc Jan 11, 2026
b325dba
fix(server): remove task.scheduler_type
Tsukilc Jan 11, 2026
68b906a
Merge branch 'master' of https://github.com/Tsukilc/incubator-hugegra…
Tsukilc Jan 11, 2026
1113520
fix(server): fix some issues of the distributed scheduler
Tsukilc Jan 15, 2026
5ffd20b
fix(server): fix some issues of the distributed scheduler
Tsukilc Jan 15, 2026
a110112
fix(server): fix some issues of the distributed scheduler
Tsukilc Jan 15, 2026
a31e937
fix(server): fix some issues of the distributed scheduler
Tsukilc Jan 15, 2026
d89b9bd
fix(server): fix some issues of the distributed scheduler
Tsukilc Jan 15, 2026
5807fb7
fix(server): fix some issues of the distributed scheduler
Tsukilc Jan 15, 2026
f8fc58a
fix(server): fix some issues of the distributed scheduler
Tsukilc Jan 16, 2026
6dd52e4
fix(server): fix some issues of the distributed scheduler
Tsukilc Jan 16, 2026
af85bef
fix(server): fix some issues of the distributed scheduler
Tsukilc Jan 16, 2026
b332674
fix(server): fix some issues of the distributed scheduler
Tsukilc Jan 16, 2026
cac78f4
Merge branch 'master' into pr/2937
imbajin Feb 3, 2026
28e0390
fix(server): fix some issues of the distributed scheduler
Tsukilc Feb 10, 2026
5e30cac
Merge branch 'fix/scheduler' of https://github.com/Tsukilc/incubator-…
Tsukilc Feb 10, 2026
b70788f
Revert "fix(server): fix some issues of the distributed scheduler"
Tsukilc Feb 11, 2026
7ba40bd
fix(server): fix some issues of the distributed scheduler
Tsukilc Feb 11, 2026
9ad8c57
Merge branch 'master' of https://github.com/hugegraph/hugegraph into …
Tsukilc Mar 10, 2026
71978ac
fix(server): delete config
Tsukilc Mar 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docker/configs/server2-conf/graphs/hugegraph.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ serializer=binary
pd.peers=127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688

# task config
task.scheduler_type=local
task.schedule_period=10
task.retry=0
task.wait_timeout=10
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ store=hugegraph
pd.peers=$PD_PEERS_LIST$

# task config
task.scheduler_type=local
task.schedule_period=10
task.retry=0
task.wait_timeout=10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -556,9 +556,9 @@ public class ServerOptions extends OptionHolder {
public static final ConfigOption<String> SERVER_ID =
new ConfigOption<>(
"server.id",
"The id of hugegraph-server.",
disallowEmpty(),
"server-1"
"The id of hugegraph-server, auto-generated if not specified.",
null,
""
);
public static final ConfigOption<String> SERVER_ROLE =
new ConfigOption<>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.UUID;
import java.util.function.Consumer;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -195,7 +196,14 @@ public final class GraphManager {
public GraphManager(HugeConfig conf, EventHub hub) {
LOG.info("Init graph manager");
E.checkArgumentNotNull(conf, "The config can't be null");

// Auto-generate server.id if not configured
String server = conf.get(ServerOptions.SERVER_ID);
if (StringUtils.isEmpty(server)) {
server = "server-" + UUID.randomUUID().toString().substring(0, 8);
LOG.info("Auto-generated server.id: {}", server);
conf.setProperty(ServerOptions.SERVER_ID.name(), server);
}
String role = conf.get(ServerOptions.SERVER_ROLE);

this.config = conf;
Expand All @@ -206,10 +214,6 @@ public GraphManager(HugeConfig conf, EventHub hub) {
conf.get(ServerOptions.SERVER_DEPLOY_IN_K8S);
this.startIgnoreSingleGraphError = conf.get(
ServerOptions.SERVER_START_IGNORE_SINGLE_GRAPH_ERROR);
E.checkArgument(server != null && !server.isEmpty(),
"The server name can't be null or empty");
E.checkArgument(role != null && !role.isEmpty(),
"The server role can't be null or empty");
this.graphsDir = conf.get(ServerOptions.GRAPHS);
this.cluster = conf.get(ServerOptions.CLUSTER);
this.graphSpaces = new ConcurrentHashMap<>();
Expand Down Expand Up @@ -1637,10 +1641,6 @@ private void checkBackendVersionOrExit(HugeConfig config) {
private void initNodeRole() {
String id = config.get(ServerOptions.SERVER_ID);
String role = config.get(ServerOptions.SERVER_ROLE);
E.checkArgument(StringUtils.isNotEmpty(id),
"The server name can't be null or empty");
E.checkArgument(StringUtils.isNotEmpty(role),
"The server role can't be null or empty");

NodeRole nodeRole = NodeRole.valueOf(role.toUpperCase());
boolean supportRoleElection = !nodeRole.computer() &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ public class StandardHugeGraph implements HugeGraph {
private final BackendStoreProvider storeProvider;
private final TinkerPopTransaction tx;
private final RamTable ramtable;
private final String schedulerType;
private volatile boolean started;
private volatile boolean closed;
private volatile GraphMode mode;
Expand Down Expand Up @@ -229,7 +228,6 @@ public StandardHugeGraph(HugeConfig config) {
this.closed = false;
this.mode = GraphMode.NONE;
this.readMode = GraphReadMode.OLTP_ONLY;
this.schedulerType = config.get(CoreOptions.SCHEDULER_TYPE);

LockUtil.init(this.spaceGraphName());

Expand Down Expand Up @@ -315,6 +313,7 @@ public String backend() {
return this.storeProvider.type();
}

@Override
public BackendStoreInfo backendStoreInfo() {
// Just for trigger Tx.getOrNewTransaction, then load 3 stores
// TODO: pass storeProvider.metaStore()
Expand Down Expand Up @@ -465,6 +464,7 @@ public void updateTime(Date updateTime) {
this.updateTime = updateTime;
}

@Override
public void waitStarted() {
// Just for trigger Tx.getOrNewTransaction, then load 3 stores
this.schemaTransaction();
Expand Down Expand Up @@ -1629,7 +1629,8 @@ public <T> void submitEphemeralJob(EphemeralJob<T> job) {

@Override
public String schedulerType() {
return StandardHugeGraph.this.schedulerType;
// Use distributed scheduler for hstore backend, otherwise use local
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The schedulerType() method now determines the scheduler type based on whether the backend is hstore. However, this logic change is undocumented. Consider adding a comment explaining why hstore backends require distributed scheduling while other backends use local scheduling, as this is an important architectural decision.

Suggested change
// Use distributed scheduler for hstore backend, otherwise use local
/*
* HStore is a distributed backend: data and tasks may be handled by
* multiple graph servers that must coordinate scheduling and state.
* For this reason we require a distributed task scheduler when the
* backend is hstore so that jobs can be balanced and recovered
* across nodes. For other backends, the graph is served by a single
* server instance and tasks are executed locally, so a local
* in-process scheduler is sufficient and avoids the overhead of
* distributed coordination.
*/

Copilot uses AI. Check for mistakes.
return StandardHugeGraph.this.isHstore() ? "distributed" : "local";
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,13 +303,7 @@ public class CoreOptions extends OptionHolder {
rangeInt(1, 500),
1
);
public static final ConfigOption<String> SCHEDULER_TYPE =
new ConfigOption<>(
"task.scheduler_type",
"The type of scheduler used in distribution system.",
allowValues("local", "distributed"),
"local"
);

public static final ConfigOption<Boolean> TASK_SYNC_DELETION =
new ConfigOption<>(
"task.sync_deletion",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.apache.hugegraph.type.define.NodeRole;
import org.apache.hugegraph.util.E;

// TODO: rename to GlobalNodeRoleInfo
// TODO: We need to completely delete the startup of master-worker
public final class GlobalMasterInfo {

private static final NodeInfo NO_MASTER = new NodeInfo(false, "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@

package org.apache.hugegraph.masterelection;

import java.util.Objects;

import org.apache.hugegraph.task.TaskManager;
import org.apache.hugegraph.util.Log;
import org.slf4j.Logger;

import java.util.Objects;

public class StandardRoleListener implements RoleListener {

private static final Logger LOG = Log.logger(StandardRoleListener.class);
Expand All @@ -36,7 +36,6 @@ public class StandardRoleListener implements RoleListener {
public StandardRoleListener(TaskManager taskManager,
GlobalMasterInfo roleInfo) {
this.taskManager = taskManager;
this.taskManager.enableRoleElection();
this.roleInfo = roleInfo;
this.selfIsMaster = false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@

package org.apache.hugegraph.task;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.hugegraph.HugeGraph;
import org.apache.hugegraph.HugeGraphParams;
import org.apache.hugegraph.backend.id.Id;
Expand All @@ -43,6 +37,8 @@
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.structure.VertexProperty;

import java.util.*;

public class HugeServerInfo {

// Unit millisecond
Expand Down Expand Up @@ -209,14 +205,6 @@ public static HugeServerInfo fromVertex(Vertex vertex) {
return serverInfo;
}

public <V> boolean suitableFor(HugeTask<V> task, long now) {
if (task.computer() != this.role.computer()) {
return false;
}
return this.updateTime.getTime() + EXPIRED_INTERVAL >= now &&
this.load() + task.load() <= this.maxLoad;
}

public static Schema schema(HugeGraphParams graph) {
return new Schema(graph);
}
Expand Down
Loading
Loading