# Changelog All notable changes to `pgbreaker` are documented in this file. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [0.1.0] - 2026-12-05 Initial production-ready release of `pgbreaker` for PostgreSQL 14–18. ### Added - **Lock-free core engine (`src/core/`)**: zero-`postgres.h`, zero-`malloc` Pure C99/C11 engine with 2-cacheline `PgbRuleSlot` layout, `present_mask` expected-O(1) 8-level deterministic matcher on `(query_id, db_oid, role_oid)`, quiescent `eval_state`-pinned concurrency CAS, single-word 64-bit GCRA smooth QPS limiter, monotonic reject-log rate limiter, and fixed 32-level per-backend `PgbSlotLedger`. - **PostgreSQL 14–18 adapter (`src/pg/`)**: fixed preallocated shared memory (`< 256 KB` at default `max_rules = 1024`), lazy epoch-driven backend-local snapshots (zero `LWLock`s on steady warm hot path), automatic `EnableQueryId()`, executor/portal/xact/subxact/shmem-exit unwinding, `emit_log_hook` server-log suppression, and decoupled node-local atomic persistence (`$PGDATA/pg_stat/pgbreaker.rules`, v1 CRC32C, zero Background Worker / zero SPI / hot-standby ready). - **Minimal SQL & GUC surface (`sql/pgbreaker--0.1.0.sql`)**: - 4 GUCs: `pgbreaker.enabled`, `pgbreaker.shadow`, `pgbreaker.max_rules`, `pgbreaker.log_rejects`. - 5 non-transactional control functions: `pgbreaker.trip()`, `pgbreaker.set_rule()`, `pgbreaker.remove_rule()`, `pgbreaker.clear_rules()`, `pgbreaker.reset_stats()`. - 2 observability views: `pgbreaker.rules` and `pgbreaker.status` (including `persisted` durability indicator). - **Packaging, CI & Chaos Demo**: PGXS `Makefile`, PGXN `META.json`, GitHub Actions CI matrix (C99/C11 ASan+UBSan/TSan/Release, PostgreSQL 14–18 integration/chaos/standby including PG 16 default LLVM bitcode, and end-to-end Docker chaos demo smoke test), and a self-contained 30-second Docker Compose chaos demo under `demo/`. ### Safety & Hardening - **Lockout protection**: unconditionally exempts effective superusers, roles inheriting `pg_use_reserved_connections` (PG 16+), parallel workers, `EXPLAIN`-only runs, nested executor statements (including `ExecutorRewind`), and utility/maintenance commands that do not start an executor (`VACUUM`, `ANALYZE`, DDL); supports `SIGHUP` hot bypass (`pgbreaker.enabled = off`). - **Zero-leak lease unwinding**: covers normal `ExecutorEnd`, `ExecutorStart`/`Run`/`Finish` `PG_CATCH`, `NO SCROLL` cursor `MarkPortalFailed` via portal cleanup hooks, returned `refcursor` deferred admission, `SAVEPOINT` abort/commit reparenting, `pg_cancel_backend`, `pg_terminate_backend`, and `before_shmem_exit`. - **Least-privilege & install hardening**: `CREATE EXTENSION pgbreaker` verifies superuser ownership, zero non-superuser `CREATE` privileges, and an empty schema (no pre-existing relations, functions, or types); revokes `PUBLIC` access across all extension objects, enforces `superuser()` in C on mutators, grants read-only views to `pg_read_all_stats`, and redacts `$PGDATA` in `persist_path` unless `pg_read_all_settings` is held. - **Fail-Open persistence**: protects against non-regular/FIFO/symlink state files (`O_NONBLOCK | O_NOFOLLOW`), preserves oversized files when `max_rules` is lowered until explicit `clear_rules()`, and suppresses `53P01` server error spam via `emit_log_hook`. ### Verification - **Core engine**: 17/17 standalone tests across Clang C99/C11 ASan+UBSan, Clang C99/C11 TSan (64-thread stress), and GCC `-O2` Release (`0` warnings, `0` leaks, `0` data races). - **PostgreSQL 14–18**: 12/12 integration, zero-leak chaos, Extended Query (`PQexecParams`) / `PREPARE`, `pg_stat_statements` bidirectional co-loading, restart/crash durability, read-only hot-standby, and `pgbench` suites (`413` assertions; `11/11` / `408` assertions in `SKIP_BENCH=1` CI mode, `0` leaks). [0.1.0]: https://github.com/cwj2001/pgbreaker/releases/tag/v0.1.0