Leader election using SQL database?
- Dominant language
- Go
- Stars
- 3.7k
- Forks
- 465
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 5
Description
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?
```sql
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.
Contributor guide
Assessment
This issue has not been assessed yet.