Skip to content

fix(datasources): refresh cached pools after persisted connection changes - #78

Merged
xiaour merged 1 commit into
xiaour:mainfrom
BigDataDZ:codex/oct26-pool-config-refresh
Oct 27, 2026
Merged

xiaour merged 1 commit into
xiaour:mainfrom
BigDataDZ:codex/oct26-pool-config-refresh

Conversation

@BigDataDZ

@BigDataDZ BigDataDZ commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

When another server process edits a datasource connection, getActivePool/getActivePoolAsync reread persisted status but reuse the old pool solely by datasource code. Subsequent queries can keep using the old host, database or credentials until this process restarts.

Track the connection settings used to create each pool in a WeakMap. Reuse a pool only when datasource ID/type/host/port/database/user/encrypted password/options still match. Retire changed pools through the existing closePool path and recreate from the current persisted row. Name-only edits, connection-test updates and options key-order changes preserve reuse. Disabled-source checks and async repository selection remain in place.

Validation: reproduced stale-host reuse on sync and async paths before the fix;57 lifecycle/disabled-source/dialect tests pass afterward.16 new tests cover all seven connection fields on both paths and non-connection edits. Independent review found no blocking issues and independently ran31 lifecycle tests plus factory-failure/retry and ID-change probes. No baseline changes; datasourcePool.js now below its existing size limit.

Current main5385ed3 also has an invalid architecture-baseline JSON file (separate fix#77) and unrelated test failures. CI is not claimed green; full-suite comparison details will be added after verification. Live MySQL/PostgreSQL/Docker acceptance is delegated to the PR checks.

中文:修复其他进程修改数据源后本进程继续复用旧连接池的问题,保留禁用拦截与正常缓存复用。

Full-suite comparison against unchanged main5385ed3 (node --test --test-force-exit used to obtain diagnostics despite leaked test resources): main732 passed,5 failed,14 skipped; this PR748 passed,5 failed,14 skipped. The failure names match exactly; the16 added tests pass. Existing failures cover model defaults, semantic confirmation, a rewritten error message, an undefined FakeIndicatorClient fixture and baseline parsing. These are not counted as passes. Both Docker matrices, PostgreSQL and MySQL persistence acceptance have passed on the PR; the full test job remains pending/blocked by inherited issues. No new test skips or baseline increases.

Latest combined candidate after V1.2.0 reconciliation:800 passed,16 skipped,5 failed (same failure names as unchanged main); architecture36 errors,2 warnings; fixture eval14/14 with2 pending judgments. The full test diagnostics used --test-force-exit because failed upstream tests retain resources; no failing or skipped tests were counted as passes. This is a scoped pool-cache fix, not a claim of full CI recovery.

@xiaour
xiaour merged commit 2030b95 into xiaour:main Oct 27, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants