Skip to content

Leader election using SQL database? #3219

@evankanderson

Description

@evankanderson

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions