mirror of
https://github.com/hanzoai/sql.git
synced 2026-11-15 19:38:30 +00:00
bin/reconcile runs beside sqlha in a sql pod and acts only on the leader, over the local socket. From a declared file, pinned by the SHA-256 the process is started with (--sha256, in the pod spec), and with quoted identifiers, it creates roles LOGIN NOSUPERUSER NOREPLICATION NOBYPASSRLS with no password and synchronous_commit=on, adds OAuth roles to sql_iam, creates databases with their owner, revokes CONNECT from PUBLIC on declared databases, adopts an existing database by ALTER OWNER on each object (never REASSIGN OWNED BY) and reports what the old owner still holds, reports any sql_iam member with a password, PATCHes the declared DCS block through Patroni's local REST API, and reloads pg_hba when its hash changes. Every statement is logged. Every connection sets lock_timeout and statement_timeout, so a session holding a lock fails one step with a reported error and the next pass retries, instead of queueing the table's users behind an ALTER. The file refuses the superuser, the Patroni replication user (SQL_REPLICATION_USER), sql_iam and pg_*, so a declaration cannot strip replicator of REPLICATION; a pass alters no role the file does not name. bin/test_reconcile.py runs it against a two-member Patroni cluster, on PostgreSQL 16.15 and 18.6. managed/LLM.md and managed/deploy/sql.yaml no longer say the shared Postgres is being retired. Claude-Session: https://claude.ai/code/session_01SCPMGSQsLNF2YtHFL4bwyp