google / google/trillian

Leader election using SQL database?

Open
#3,219 1 comment 3 reactions 1 assignee Claimed by @phbnf View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.