Skip to main content

Module lease

Module lease 

Source
Expand description

The master’s lease: one master per database (see archive/PROJECT.md, Components and roles: production path). A one-row table, taken and renewed by one statement each, timed by the database’s clock, so it needs no session state: it works through any connection pooler (PgBouncer in transaction pooling too), and on SQLite.

The row says who holds the lease, until when, and how many times it changed hands (the takeover counter, epoch): a master that finds the counter moved on knows another one led meanwhile.