Skip to content

Wire protocol call for confirming leadership #707

@cole-miller

Description

@cole-miller

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureNew feature, not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions