Skip to content

Add cluster support #228

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jun 30, 2025

Conversation

farost
Copy link
Member

@farost farost commented Jun 17, 2025

Release notes: usage and product changes

Introduce cluster support for TypeDB 3.x, featuring server replicas and the new version message.

Implementation

Remove database replicas. Instead, add server replicas (by extending the usual Server message) with a similar set of fields.

Instead of adding a is_primary flag, introduce an extensible enum ReplicaType for more granular split between primary and supporting nodes.

To reduce the network overhead, this new information is provided in the initial server's connection response.

string distribution = 1;
string version = 2;
}
}
}

message Server {
Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think we need a separate ServerReplica message

string address = 1;
}

message Version {
Copy link
Member Author

Choose a reason for hiding this comment

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

Generally, it should be same for every server in the cluster, but its domain is closer to Server

@farost farost marked this pull request as ready for review June 18, 2025 08:58
@farost farost requested a review from haikalpribadi as a code owner June 18, 2025 08:58
@farost farost requested a review from lolski June 18, 2025 08:58
Authentication.Token.Create.Req authentication = 4;
}

message Res {
uint64 server_duration_millis = 1;
ConnectionID connection_id = 2;

// pre-send all databases and replica info
DatabaseManager.All.Res databases_all = 3;
Copy link
Member Author

@farost farost Jun 18, 2025

Choose a reason for hiding this comment

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

We removed an excessive driver-side cache, so it's no longer utilized. Plus, overall, it's unclear which replica to trust in the first place, so we removed the databases from this initial response. The process of getting the databases will run through the regular APIs with the knowledge of which replica is the most trusted one.

@farost farost changed the base branch from master to cluster-support-feature-branch June 19, 2025 13:50
// pre-send all databases and replica info
DatabaseManager.All.Res databases_all = 3;

ServerManager.All.Res servers_all = 3; // TODO: It might not be used / needed in the end! Discuss.
Copy link
Member Author

Choose a reason for hiding this comment

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

I think it's useful to have. When initing the connection, I receive both the connection and the list of servers, and the list of servers is needed to continue creating connections. Thus, if it's cheap, it's better to provide it instead of requiring a second call which can fail.

Copy link
Member Author

Choose a reason for hiding this comment

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

Verified it over time, it's a good thing to have. I will remove the todo before merging if you're happy.

@farost farost merged commit 94560a8 into typedb:cluster-support-feature-branch Jun 30, 2025
1 of 2 checks passed
@farost farost deleted the cluster-support branch June 30, 2025 08:34
farost added a commit to typedb/typedb that referenced this pull request Jun 30, 2025
## Product change and motivation
Update requests and responses to comply with the [new
protocol](typedb/typedb-protocol#228).


## Implementation
Add a new "server version" message.
Change the initial connection response and contents of server and
database retrieval responses.
farost added a commit to typedb/typedb that referenced this pull request Jul 7, 2025
## Product change and motivation
Update requests and responses to comply with the [new
protocol](typedb/typedb-protocol#228).


## Implementation
Add a new "server version" message.
Change the initial connection response and contents of server and
database retrieval responses.
farost added a commit to typedb/typedb that referenced this pull request Jul 9, 2025
## Product change and motivation
Update requests and responses to comply with the [new
protocol](typedb/typedb-protocol#228).


## Implementation
Add a new "server version" message.
Change the initial connection response and contents of server and
database retrieval responses.
lolski pushed a commit that referenced this pull request Jul 9, 2025
## Release notes: usage and product changes
Introduce cluster support for TypeDB 3.x, featuring server replicas and
the new version message.

## Implementation
Remove database replicas. Instead, add server replicas (by extending the
usual `Server` message) with a similar set of fields.

Instead of adding a `is_primary` flag, introduce an extensible enum
`ReplicaType` for more granular split between primary and supporting
nodes.

To reduce the network overhead, this new information is provided in the
initial server's connection response.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants