Fix MySQLRecordManager DataSource connection churn#6570
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors MySQLRecordManager to reuse a single DataSource instance across operations, shares pending initializations across concurrent operations, and ensures query runners are properly released. It also introduces a close method to clean up connections, which is integrated into the indexing and vector store deletion workflows. The review feedback highlights three key improvement opportunities: moving table name sanitization inside the try block in listKeys to prevent query runner leaks, clearing state variables synchronously in close() to avoid concurrent race conditions, and querying the database time directly within update() using the active query runner to prevent connection pool starvation.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
Solid fix! The mock DataSource and QueryRunner tests are thorough — verifying initialize/destroy counts and connection lifecycle. This addresses the per-operation pool instantiation issue from #6567. |
Fixes #6567.
MySQLRecordManager was creating and destroying a TypeORM DataSource for every record-manager operation. Because DataSource owns the connection pool, that caused repeated pool creation during indexing and cleanup flows.
This PR changes MySQLRecordManager to:
Verification:
Note:
pnpm --dir packages/observe exec jest src/features/executions/components/ExecutionTreeSidebar.test.tsx --runInBand --detectOpenHandles