Repository navigation
Upgrades
How to upgrade a KingresDB installation: the package (or image), and the extensions in each database. The first release, 0.1.0, was published on 2026-11-28; the releases since are 0.1.1 (2026-11-28), 0.2.0 (2026-11-30), 0.2.1 (2026-12-02) and 0.2.2 (2026-12-02). What follows is what the packaging, the extensions and the control plane support at this commit, and the section "From 0.2.1 to 0.2.2" below gives the notes of the latest step. Upgrades are tested for a revision bump of the package and for the extension update scripts named below. There is no rollback and no path between PostgreSQL majors. The guide is upgrade.md. Before you begin, back up (Backup Restore and PITR) and read the release notes.
Phase 19 plans an upgrade of the whole cluster from the console (the package from the GitHub releases, or by upload for a cluster without outbound access), to ship with release 0.3.0; it is not built, and this page describes the manual procedure that applies until it is. See Architecture Risks and Technical Debt, section 12.
-
Between PostgreSQL majors. There is no procedure to move a cluster from 18 to 19 or back. The package refuses it: its
preinstscript stops before anything is unpacked when the package of the other major is installed (or removed without purge), or when a data directory of the other major exists. The sharding extension refuses a node of another major (a connection between nodes of different majors is refused, andadd_node,move_bucketandcheck_clusterreport it). To go from 18 to 19, build a new cluster of 19 servers and move the data. A rolling in-place upgrade and a standby of another major (impossible with physical replication) are not supported (release rules). -
Downgrade and rollback. There is no rollback of a package upgrade or of an
ALTER EXTENSION ... UPDATE. Restore from a backup.
-
apt install ./kingres_<new>.debupgrades the package (the same major, the new version or revision). Configuration you changed is kept (conffiles).postinstrestarts the service, and a package upgrade restarts the database too, because new server binaries must not run under old processes. Data in/var/lib/kingresis untouched (tested with data present). Since 0.1.1 the upgrade does not start a service that was stopped on purpose. The RPM of that release (RHEL 9 family) upgrades withdnf install ./kingres-pg18-<new>.rpmand keeps the settings you changed (a changed default goes to*.rpmnew). - One package name,
kingres; the major is in the version (+pg18,+pg19). The package refuses to install the other major over an installed (or removed but not purged) one, or over a data directory of the other major. -
apt removestops the service and keeps data, settings and thekingresuser;apt purgealso deletes/var/lib/kingresand/etc/kingres. - A container image is replaced the same way; use a volume that has only ever held one major.
- The package does not update the extensions of existing databases for you (below).
- A package upgrade was tested for a revision bump of the same version (
+pg18-1to+pg18-2). Upgrades between different KingresDB versions are exercised by the extension tests and the cluster tests, not by the package tests.
Upgrade one server at a time and wait for it to come back (Servers page) before the next. A suggested order, which is a recommendation and not a tested procedure: servers that hold only standbys first, the manager leader last. For the case of kingres_columnar, upgrade standbys before primaries: a primary that has begun to write columnar WAL under a new preload list would be ahead of a standby that cannot replay it.
A server of the new version next to servers of the old one raises the alert versionMismatch until the last one is upgraded. Treat that as the progress of an upgrade and finish it before you do anything else: no rebalance (it is refused with version_mismatch), no failover drill, no change of tables. In particular, do not run a planned switchover and do not restore preferred primaries while servers of two versions run. A server of the older version does not honour the request to read the proof of a stop alone, and a repeated read can then release a lease that the switchover just took; the leader logs the warning "failover: the server of the old primary did not honour the request for the proof alone" when it happens, so search the log for it.
kingresd writes shared_preload_libraries = 'kingres_shard,kingres_ledger,kingres_columnar,pg_stat_statements' for every instance; a library whose file the installation does not have is left out. An instance made by an earlier package gets the new list when kingresd starts (kingres-managed.conf is rewritten and a running instance is reloaded), but the list takes effect only at a restart of each instance, standbys of a group before its primary. Until then the instance runs without kingres_columnar: a columnar table is read, but creating one, a write and every conversion are refused with a message that names shared_preload_libraries, and the control plane refuses a conversion with extension_missing until every instance of every server has loaded the library (Limitations and Known Issues). Once an instance has written columnar WAL, the library must stay preloaded on it and on every standby for as long as that WAL exists. See Analytics Extensions.
Install the new files on every node, restart the nodes, then run ALTER EXTENSION <name> UPDATE in every database that uses the extension, on every server, with a superuser. The versions of this release and their update scripts:
| Extension | Version | Update paths | Notes |
|---|---|---|---|
kingres_shard |
0.9 | 0.1 to 0.2 to ... to 0.9; one ALTER EXTENSION kingres_shard UPDATE takes any of them to 0.9 |
See the order below |
kingres_ledger |
0.3 | 0.1 to 0.2, 0.2 to 0.3, and 0.1 to 0.3 in one step | The 0.3 SQL needs the 0.3 library, and the ledger is not written until the update has run. Client keys and signature policies need 0.3 in every group |
kingres_columnar |
0.2 | 0.1 to 0.2 | One ADD COLUMN on the stripe catalog. Tables of 0.1 stay readable and writable before and after; there is no way back (0.1 refuses the format of 0.2). pg_upgrade is not supported for columnar tables. Update it before kingres_timepart converts an indexed partition |
kingres_timepart |
0.3 | 0.1 to 0.2, 0.2 to 0.3; one UPDATE takes any of them to 0.3 |
0.2 adds the conversion of old partitions to columnar storage; 0.3 adds policies on user-partitioned distributed tables, which need kingres_shard 0.9 |
kingres_sketch |
1.0 | none (one version) |
kingres_shard 0.8 added splitting a bucket, weights, plans by disk size and distributed schemas; 0.9 adds columnar tables, the refusal of ledger tables by create_distributed_table, approximate count(DISTINCT), and schemas in the rebalance plan and in check_cluster. The version check of a bucket move asks for 0.9 on every active primary.
A node whose library is new but whose SQL objects are not yet updated cannot answer the helper functions that the other nodes call. Distributed scans and fan-out writes of the whole cluster fail from the moment a node restarts with the new library until every node has run ALTER EXTENSION kingres_shard UPDATE; single-key reads and writes keep working. So:
- Install the new package on every server, one after the other (each restarts).
- Run
ALTER EXTENSION kingres_shard UPDATEon every node, at once and soon after. - Do not start a bucket move before that is done: a move refuses unless every active primary reports the current extension version, and names the node that does not.
check_cluster()names a node that does not match.
Until a node has been updated, create_distributed_table and create_reference_table refuse with "the kingres_shard objects of this database are older than the library". A statement that was pushed down can fail with KS001 while versions differ; the client repeats it after the upgrade has reached every node. Nodes of the previous protocol and of the new one do not cooperate on the fragments that pushdown sends: while the cluster is mixed, set kingres_shard.enable_pushdown, kingres_shard.enable_bulk_routing and kingres_shard.enable_copy_routing to off, and set them back to on when the last node is upgraded. The extension README ("Requirements and installation") has the full text.
Versions that were not released have had their scripts changed as reviews went on. A database that installed an earlier build of the same version has no update path to the later build, because ALTER EXTENSION UPDATE does nothing for the same version. The READMEs of the extensions say what to do in the known cases; a development database of that kind is recreated.
A ledger database cannot simply be dropped and recreated: DROP EXTENSION kingres_ledger is refused while the registry is not empty, by design. The console can run the update for you: the Ledger page, or POST /api/v1/databases/{db}/ledger/upgrade (task ledger.upgrade, every server). pg_upgrade of a cluster with a ledger is tested in the extension suite (binary upgrade mode), but the major-version path of a KingresDB cluster is not designed.
- The system database
kingres_systemis migrated bykingresditself: its migrations (embedded in the binary,internal/sysdb/migrations) run at every start and after a join, and a migration that was skipped is applied late. You do nothing; see Data Model System Database. - The console is embedded in the same binary, so it is upgraded with it. The contract (REST API) is additive between revisions: a client written for an older revision keeps working.
- A server refuses a peer on another internal API version, and
versionMismatchalerts when servers differ in version. Upgrade all servers to the same package. - A new version may add settings; unknown keys in
kingresd.jsonstop the server at start, so remove a key that a newer or older version does not know (Configuration). - The failover journal and the tasks survive the restart of an upgrade; a task that was running is resumed by the leader after it restarts.
0.2.2 is a patch release: no extension has a new version, the REST contract is the same as in 0.2.1 (0.37.0), there is no new migration, and nothing has to be done by hand in a database. The notes of the release are in the section [0.2.2] of the changelog and on Release Notes.
-
Upgrade by package or by image, one server at a time (the steps above): replace the package or the image of the same major on each server and wait for it to come back before the next one. A rolling upgrade is allowed; servers of 0.2.1 and of 0.2.2 work together while it lasts, and the alert
versionMismatchshows the progress. - The failover of a vanished server is fixed on the leader. The tasks of a failover run on the leader of the cluster, so the fix is in force once the leader runs 0.2.2; during the upgrade a server that is still on 0.2.1 gives up a connection that is not made only after the connect timeout of the system, so upgrade the servers one at a time without delay. Nothing is to be configured. In a cluster of two servers a vanished server still pauses the failover for an operator.
-
There is no rollback. Back up first (Backup Restore and PITR). When the last server runs 0.2.2, check that the alert
versionMismatchis gone. The known issues that remain are on Limitations and Known Issues.
The upgrade is a rolling package or image upgrade of the same major on every server, one at a time (the steps above). The notes of the release are in the section [0.2.1] of the changelog and on Release Notes.
-
No extension has a new version (
kingres_shard0.10,kingres_timepart0.4,kingres_ledger0.3,kingres_columnar0.2,kingres_sketch1.0), so there is noALTER EXTENSION ... UPDATEfor this release. The system database migration 0047 (the checks of a ledger verification and the audit of the publication) is applied by the control plane, not by hand. -
Send no change of the preload list until every server runs 0.2.1. The leader of the cluster decides a change of the list (a request sent to another server is forwarded to it). While the leader runs 0.2.1 and another server still runs 0.2.0, the change is refused with 409
server_requirement_missing("finish the upgrade of every server first"), and a task that was already started fails at its first step with that code, before anything is written or restarted. While the leader itself still runs 0.2.0 there is no such check: the change is accepted and runs as in 0.2.0, with the known issue of 0.2.0 (a standby copied meanwhile can keep the old list). So send preload changes only after every server is upgraded. -
pg_cron is bundled again, and it is off. An upgrade changes no setting, starts no job and adds nothing to the preload list. It is used only after the steps of the operator guide, chapter 15: its library is added to the preload list with a restart, its three cluster-level settings are set with a second restart, and it is then switched on in the one user database that
cron.database_namenames (see Extensions). A server that still runs 0.2.0 refuses the settings andCREATE EXTENSION pg_cron, so upgrade every server first. -
The REST contract goes from 0.35.0 to 0.37.0 and is additive: the ledger checks and the audit of the publication (0.36.0), and
resumeTaskand the instances of a preload change (0.37.0). A client written for 0.35.0 keeps working; the console andkingresdof one package belong together. -
Roles that 0.2.0 broke are not healed automatically. A role that was made an administrator under 0.2.0 and later lost
kingres_adminhas no administration grant;kingresdgives the grant back only for what it takes away itself. The SQL that gives it back, for a role that you checked, is in the operator guide, chapter 1 ("Giving the administration grant back to a role"). - There is no rollback of a package upgrade; restore from a backup. The two known issues of 0.2.1 are on Limitations and Known Issues.
- Back up.
- Upgrade one server at a time and wait for each to be healthy (standby-only servers first, the manager leader last).
- When every server runs the new package, update the extensions in every database on every server (the order above), and check the alert list:
versionMismatchmust be gone. - Run
SELECT * FROM kingres.check_cluster()on the map group primary and look at the Dashboard. - Only then resume rebalance, planned switchovers and table changes.
- kingres/docs/guide/upgrade.md
- kingres/packaging/README.md
- kingres/docs/dev/releases.md
- contrib/kingres_shard/README.md
- contrib/kingres_shard/kingres_shard.control
- contrib/kingres_shard/kingres_shard--0.8--0.9.sql
- contrib/kingres_ledger/README.md
- contrib/kingres_ledger/kingres_ledger--0.1--0.3.sql
- contrib/kingres_columnar/README.md
- contrib/kingres_columnar/kingres_columnar--0.1--0.2.sql
- contrib/kingres_timepart/README.md
- contrib/kingres_timepart/kingres_timepart--0.2--0.3.sql
- contrib/kingres_sketch/kingres_sketch.control
- kingres/control-plane/README.md
KingresDB's own code is licensed under AGPL-3.0-only. PostgreSQL code keeps the PostgreSQL License. Copyright of the project's own code: RooyeKhat Media Co. KingresDB is derived from PostgreSQL and is not endorsed by the PostgreSQL project. Repository | Licence | COPYRIGHT
KingresDB
1. Product
- Product Overview and Features
- Status and Roadmap
- User Guide
- Administrator Guide
- REST API Reference
- Web Console
- Command Line Client
- Extensions
- Limitations and Known Issues
- Release Notes
Features in detail
- Sharding
- Sharding Query Pushdown
- Sharding Table Lifecycle
- High Availability
- Ledger
- Ledger Signing and Publication
- Ledger Anchoring
- The Verifier
- Analytics Extensions
Administration
- Cluster Setup
- Servers Databases and Roles
- Rebalancing
- Configuration
- Memory and Warm-up
- Control Plane and REST API
- Upgrades
2. Architecture (arc42)
- Architecture
- Architecture Introduction and Goals
- Architecture Constraints
- Architecture System Context
- Architecture Containers
- Architecture Components
- Architecture Runtime Views Sharding
- Architecture Runtime Views Availability and Ledger
- Architecture Deployment
- Architecture Crosscutting Concepts
- Security Model
- Architecture Decisions
- Architecture Quality Requirements
- Architecture Risks and Technical Debt
- Enterprise Architecture
3. Data architecture
- Data Architecture
- Data Model Sharding
- Data Model Ledger
- Data Model System Database
- Data Model Analytics
- Data Lifecycle
- Backup Restore and PITR
- Data Security
- Data Quality and Integrity
4. Development
- Building from Source
- Development and Testing
- Repository Layout
- Coding Standards
- Branching and Synchronisation
- Testing Strategy
- Review Process
- Release Process
- Contributing
5. Operations