Releases: cgnl/plex-postgresql
Releases · cgnl/plex-postgresql
v1.3.1
v1.3.0
v1.3.0: fix LD_PRELOAD deadlock, decltype/bad_cast, DDL routing, SQLi…
v1.2.0 — Rust-safe shim: unsafe reduction
92% unsafe reduction + memory leak fix + deadlock fixes
The shim's business logic is now Rust-safe. Unsafe is confined to the FFI boundary.
Safety
- Raw pointer dereferences: 806 → 59 internal functions use
&mut PgStmt/&mut PgConnection - PgStmt:
pthread_mutex_t→std::sync::Mutex<()>— auto-initialized, no manual pthread - PgStmt:
[T; 1024]→Vec<T>— on-demand allocation, 540 bytes for 0-param queries (was 88KB) - 138 functions de-FFI'd —
extern "C"removed from Rust-only functions - 55 safe accessors for
orig_sqlite3_*function pointers - 11 data races fixed — atomic counters, seqlocks, OnceLock, eager hook resolution
Performance
- **Memory: PGresult leak, transaction routing, cached_result cleanup
- **Browse 500 items: PQcancel fast path, conditional type validation
- Lazy log macros — ~300 format!() allocations eliminated at production log levels
Reliability
- 3 deadlocks eliminated — recursive conn mutex, ABBA prevention, convoy fix
- Stack overflow fix — heap-allocated thread-local buffers
- Clippy clean — zero warnings with
-D warnings
v1.1.0 — 100% Rust shim runtime
100% Rust shim runtime
The entire interpose layer is now pure Rust. All C runtime code has been eliminated.
Changed
- Full Rust runtime — all interpose, column access, step execution, and connection management in Rust. No C object files remain.
- Module architecture — monolithic files split into focused submodules (
db_interpose_column/,db_interpose_common/,db_interpose_step/,pg_client/,pg_statement/, etc.) - Thread-local text buffers heap-allocated — fixes stack overflow on Plex worker threads (544K stacks)
Fixed
- Connection mutex self-deadlock —
PgConnection.mutexchanged toPTHREAD_MUTEX_RECURSIVE, fixing self-deadlock in metadata fetch path - Connection mutex convoy — reduced lock hold time in
ensure_pg_result_for_metadata - ABBA deadlock (stmt/LOGGER) — logger uses
try_lockwith stderr fallback when contended - Double-lock on stmt mutex — lock ordering fixed across all column accessor modules
- rusqlite 0.32 compatibility — test files updated for API changes
Stats
- 712 tests passing
- 246 files changed, +28K/-23K lines vs v1.0.0
v1.0.0 — Rust migration complete [alpha]
v1.0.0 — Rust migration complete
The entire SQLite-to-PostgreSQL translation pipeline and all backend modules have been migrated from C to Rust.
What changed
- SQL translator fully in Rust —
sqlparser-rsAST-based translation replaces the old C string-manipulation translator. 525 Rust tests. - PG modules migrated to hybrid C/Rust — pg_config, pg_logging, pg_mem_telemetry, shim_alloc, pg_query_cache, pg_statement, pg_client. ~550 C tests across 25 suites.
- Docker and CI updated — Dockerfiles, build scripts, and GitHub Actions workflows now build the Rust staticlib.
- Log level cleanup — informational pool messages demoted from ERROR to INFO, reducing log noise in production.
- 1,075+ tests total (525 Rust + ~550 C)
Architecture
Layer 4+3: C interposer (~9,400 lines) — fishhook, DYLD_INTERPOSE, LD_PRELOAD
Layer 2: Rust PG modules (hybrid C/Rust) — pool, statement, cache, config, logging
Layer 1: Rust SQL translator (sqlparser-rs) — full AST-based SQLite → PostgreSQL translation
Upgrading
Drop-in replacement. No configuration changes needed.
v0.9.40
fix: handle duplicate prepared statements (SQLSTATE 42P05) + DEALLOCA…
v0.9.39
v0.9.39: stale prepared statement recovery after PG restart (SQLSTATE…
v0.9.38
v0.9.38: exec retry + pre-flight reconnect (Issue #8)
v0.9.37
v0.9.37: add PLEX_PG_IDLE_TIMEOUT to all configs and docs
v0.9.36
docs: add PLEX_PG_IDLE_TIMEOUT to docs, examples, and changelog