Skip to content
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

Wire protocol call for confirming leadership #707

Open
cole-miller opened this issue Sep 26, 2024 · 0 comments
Open

Wire protocol call for confirming leadership #707

cole-miller opened this issue Sep 26, 2024 · 0 comments
Labels
Feature New feature, not a bug

Comments

@cole-miller
Copy link
Contributor

Currently, there are a couple of ways for a dqlite client (C) to ask the server it's connected (S) to whether it's the leader:

  • Send the LEADER request and compare the returned ID and address to the known ID and address of S. This requires C to keep that information around after establishing the connection, which is fine but not ideal.
  • Try to perform some operation that requires leadership, for example opening a database or assigning a role to a node. This has the problem that if the operation succeeds, you might affect the state of the cluster or of the connection itself, which is undesirable.

It seems like there is room here for a new wire protocol request/response pair where C simply asks S whether it's the leader, and S returns an empty response if it is the leader and an error if it is not. Alternatively, this could be structured as a backward-compatible extension of the existing LEADER request, where if C sets a field in its request and S is the leader then it will send a response that confirms its leadership instead of/in addition to containing its own address.

@cole-miller cole-miller added the Feature New feature, not a bug label Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New feature, not a bug
Projects
None yet
Development

No branches or pull requests

1 participant