mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-19 16:02:14 +00:00
6d58d1a74d
* perf: pipeline DISCARD ALL with first query on cached pg connections Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * perf: use RESET ALL instead of DISCARD ALL for lighter session reset Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * test: add integration test for pg session reset on cached connections Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: release MutexGuard before caching so pg connection cache actually works The old code shadowed the MutexGuard variable without dropping it, so try_lock() in the post-query caching path always failed — connection caching was effectively dead code. Restructure to explicitly drop the guard before connecting. Also adds a CACHE_HITS counter and clear_pg_cache() helper so the integration test can verify the cached-connection path is exercised. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * test: add single-worker session isolation test for SET ROLE + search_path Pushes 3 jobs into the queue before starting the worker so a single worker processes them all sequentially (matching production). Verifies SET ROLE and SET search_path do not leak between jobs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: add RESET ROLE to session reset (RESET ALL does not undo SET ROLE) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use DISCARD ALL for full session reset and retry on stale connections - Switch from pipelined RESET ROLE; RESET ALL to eager DISCARD ALL when validating cached connections. This resets everything: role, GUCs, prepared statements, temp tables, advisory locks, LISTEN registrations. - DISCARD ALL also serves as a health check: if it fails, the stale connection is discarded and a fresh one is created transparently. - Extract new_pg_connection() helper to avoid duplicating the connect + spawn-connection-task logic. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * test: add 100-job single-worker cache stress test Runs 100 varied PG jobs (plain SELECTs, SET ROLE, SET search_path, multi-statement) through one worker. Verifies all succeed, 99 hit the cache, and no session state leaks between jobs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>