Skip to content

Architecture Decisions

Mohammad Rasoul Kazemi edited this page Nov 30, 2026 · 6 revisions

Architecture Decisions

Chapter 9 of the arc42 structure (Architecture). An architecture decision record (ADR) records one decision: the context, the decision, its consequences and the rejected alternatives. An accepted ADR is not rewritten; a changed decision gets a new ADR and only the status line of the old one changes. The rules and the template are in the ADR index. The titles and statuses below are those of the ADR index; the dates are the dates of the ADRs.

Index

ADR Title Status Date
0001 Thin fork with minimal core patches; logic in extensions Accepted 2026-11-14
0002 Base on PostgreSQL 18 (REL_18_7), rebase to 19 later Accepted 2026-11-14
0003 Single repository layout Accepted 2026-11-14
0004 PostgreSQL License; no Citus code Superseded by 0024 in its choice of licence 2026-11-14
0005 WSL2 as the build environment Accepted 2026-11-14
0006 Sharding MVP first Accepted 2026-11-14
0007 Fixed hash buckets (default 1024; the implemented default is 128, see the note in the ADR) Accepted 2026-11-14
0008 Map group in PostgreSQL is the source of truth; etcd only for leader election Accepted; the Patroni and etcd parts are superseded by 0021 and 0018 2026-11-14
0009 2PC without a global snapshot at first Accepted 2026-11-14
0010 Writes on any node: a primary per server and a router in the agent; no conflict-resolving multi-master Accepted 2026-11-14
0011 Replica count per cluster, durability per database Accepted 2026-11-14
0012 Patroni bundled as the failover engine Superseded by 0021 2026-11-14
0013 Ledger tables and external anchoring first; consensus only with a consortium use case Accepted 2026-11-14
0014 One package and a panel on every node Accepted 2026-11-14
0015 Panel accounts are PostgreSQL roles Accepted 2026-11-14
0016 Go backend and React/TypeScript frontend, OpenAPI first Accepted; frontend framework superseded by 0017 2026-11-14
0017 Vue for the web panel Accepted 2026-11-14
0018 The manager leader is the server of the map group primary Accepted 2026-11-14
0019 Control-plane state lives in a system database with embedded migrations Accepted 2026-11-14
0020 No bundled metrics store; kingresd samples and exports metrics itself Accepted 2026-11-14
0021 Failover is part of kingresd, with leases; Patroni and etcd are not bundled Accepted 2026-11-14
0022 The row-moving distributed scan stays as the path that answers every query Accepted 2026-11-15
0023 One source of every extension builds against each supported PostgreSQL major (18 and 19) Accepted 2026-11-15
0024 KingresDB's own code is licensed under the GNU Affero General Public License, version 3 Accepted 2026-11-15
0025 A restored system database is accepted by an operator, and the acceptance is a signed event Accepted 2026-11-23
0026 The candidate of a map group failover receives the proof of the operator's session Accepted 2026-11-23
0027 Exports are staged encrypted files, and transfers run as the role that asked Accepted 2026-11-23
0028 Ledger tables are carried as data, and the imported ledger starts a new chain Accepted 2026-11-22
0029 Third-party extensions come from a registry and are installed cluster-wide, in one transaction Accepted 2026-11-23
0030 Atomic visibility by validated snapshots Proposed 2026-11-28
0031 What atomic visibility guarantees and what it does not Proposed 2026-11-28
0032 Phase 8 makes no core patch Proposed 2026-11-28
0033 Multi-node ledger: witnesses, then a BFT notary of checkpoints Proposed 2026-11-28
0034 Phase 8 is off by default, staged and has a kill switch Proposed 2026-11-28
0035 A cluster upgrade takes its package from the GitHub releases of the project, or from an upload, and starts only at an administrator's request Accepted 2026-11-29
0036 A small root-owned helper installs packages, and only packages signed by a trusted release key Accepted 2026-11-29
0037 The cluster trusts a set of release keys, rotated in the standard way and added by an administrator Accepted 2026-11-29
0041 The released packages switch on GSSAPI, LDAP, PAM, PL/Python, PL/Perl and JIT; PL/Tcl and NLS only on request Accepted 2026-11-29
0042 Authentication is in the main package; each language and JIT are optional packages of the same version; kingres-dev is separate Accepted 2026-11-29
0043 The authentication libraries become hard dependencies of the main package after their size and dependencies are measured; an unusual figure goes back to the owner Accepted 2026-11-29
0044 Untrusted languages are registry entries that need their package and are audited Proposed 2026-11-29
0045 Every server of a cluster has the same set of optional packages, and a difference is reported by kingresd Proposed 2026-11-29
0046 The unit of a package installation is a set, and the upgrade helper of phase 19 must take one Proposed 2026-11-29

ADR 0000 is the template. Each ADR cites an "open decision" number of the table in architecture.md; the ADR index lists them.

How the decisions fit together

  • Thin fork (0001, 0003) and one source for two majors (0023) keep the cost of following upstream small.
  • Sharding (0006 to 0011, 0022) chose fixed buckets, a catalog on the map group, two-phase commit without a global snapshot, and a complete scan that is never removed.
  • Control plane (0014 to 0021) is one program per server with a leader that follows the map group primary; failover and metrics were built in kingresd instead of bundling Patroni, etcd or a metrics store.
  • Build options (0041 to 0046, phase 16, designed and not built): GSSAPI, LDAP, PAM, PL/Python, PL/Perl and JIT switched on in the released packages, authentication in the main package, languages and JIT as optional packages, kingres-dev separate (Accepted); untrusted languages as registry entries, the same package set on every server and the set as the unit of an installation (Proposed).
  • Extensions (0029): third-party extensions come from a registry and are installed on every server in one transaction; nothing that duplicates a KingresDB function is ever added (released in 0.2.0). Cluster upgrade from the console (0035 to 0037): the package from the GitHub releases or an upload, a root-owned helper, a set of trusted release keys (planned for 0.3.0).
  • Ledger (0013) puts detection first and consensus last. Phase 8 (0030 to 0034, Proposed; nothing built): atomic visibility of covered read-only statements by validated snapshots, with no core patch of PostgreSQL, off by default with a kill switch; and a multi-node ledger of witnesses and a BFT notary of checkpoints.
  • Licence (0004, 0024) moved from the PostgreSQL License to AGPL-3.0-only for own code on 2026-11-15.
  • Data safety of the control plane (0025 to 0028): a restored system database is accepted by an operator as a signed event; a map group failover candidate receives the proof of the operator's session; exports are staged encrypted files and transfers run as the role that asked; ledger tables are carried as data and an imported ledger starts a new chain.

Notes on consistency

  • ADR 0008 still names Patroni and etcd, and ADR 0012 was superseded; the built design departs from 0008 as ADR 0018, 0019 and 0021 describe. The table of departures in architecture.md is the reference.
  • ADR 0005 refers to CI images and a CI job; the project owner decided that no CI workflow is used (see Architecture Constraints).

Sources

  • kingres/docs/adr/README.md
  • kingres/docs/architecture.md
  • ADR files 0001 to 0037 and 0041 to 0046 (0030 to 0034 and 0044 to 0046 are Proposed; 0029, 0035 to 0037 and 0041 to 0043 are Accepted; ADR 0029 describes work released in 0.2.0; the ADRs of the phases 8 and 16 to 24 describe work that is not built) in kingres/docs/adr, each linked in the table

Clone this wiki locally