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

Leader election using SQL database? #3219

Open
evankanderson opened this issue Nov 26, 2023 · 1 comment · May be fixed by #3318
Open

Leader election using SQL database? #3219

evankanderson opened this issue Nov 26, 2023 · 1 comment · May be fixed by #3318
Assignees

Comments

@evankanderson
Copy link

I see that Trillian currently supports leader election using etcd or Chubby. Given that there is also a requirement for an ACID database store (Spanner/MySQL/CockroachDB), would it be reasonable to add an election implementation based on rows in a SQL database with a schema like the following?

CREATE TABLE IF NOT EXISTS leader_election (
  leader_name     varchar(255) NOT NULL PRIMARY KEY,
  node_name       varchar(255) NOT NULL,
  election_expiry datetime     NOT NULL
);

The leader could do conditional updates of election_expiry based on node_name being the same, and non-leader nodes could do a periodic (e.g. 1s) query for expired elections they could claim.

This would have the advantage of reducing t he set of required Trillian dependencies, at a cost of somewhat more database traffic.

@phbnf phbnf self-assigned this Dec 5, 2023
@phbnf
Copy link
Contributor

phbnf commented Dec 12, 2023

That sounds like a good idea indeed. If you're going to use this, it will be better understood and maintained by you. Would you be okay to send PRs and maintain this in the long run? The election interface is defined in util/election2/election.go, and I'm assuming it would implement it. We'd add a sub-directory in util/election2, and we'd make you a owner of this directory in CODEOWNERS.

@evankanderson evankanderson linked a pull request Jan 27, 2024 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants