Repository navigation
perf(connections): use the idle session for the first listing and read each list once - #4575
Merged
Merged
Conversation
…d each list once A catalog read takes the idle session connection when the pool has nothing idle for it, the browse scope's pooled connection is dialed after login, a bulk lease borrows an idle interactive connection, and the switchers read the database and schema lists their owners already hold.
datlechin
enabled auto-merge (squash)
November 26, 2026 01:50
…ssion # Conflicts: # apple/TablePro/Core/Services/Query/SchemaService+CatalogLoad.swift
…the background pool dial reads it too
…ep a late schema read off a newer list
…one wrote, which keeps its row count and warnings
…lease again, since the tree's refresh never reaches the schema service's copy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ROW_COUNT(),FOUND_ROWS()and warnings. One lent read at a time, one lease per read, so a user query can still cut in. Bulk reads never take the session.Measured on the unit tests: opening the pool for a catalog read and then a bulk read now dials 1 connection, not 2 (
MetadataConnectionPoolSharingTests); the first catalog read on a fresh connection runs on the session, dialing 0 (MetadataReadLendingTests); opening the database switcher after the sidebar listed the databases reads nothing (DatabaseSwitcherRefreshTests). Statement-log timings at +50 ms were not run here.Left for later, in a comment on the issue: the tree layout's own lists for the browsed scope (C11b of #4459) and the all-schema listing the quick switcher reads for cross-schema search.
Test plan
MetadataReadLendingTestsandMetadataConnectionPoolSharingTests(new),DatabaseSwitcherRefreshTests/switcherTakesTheTreesList(new): each fails on main.MetadataReadLendingTestsalso covers a session whose transaction state is unknown or open, and one that ran an authored statement, until a reconnect.ApprovedTargetTests/catalogApprovalHoldsToTheLeasedDriversReportupdated on purpose: the pool now dials in the background right after login, which read b.sqlite before the test switched the file, so the count ran in b.sqlite. Its plugin now opens b.sqlite for the session and the moved file for every later dial; the refusal it checks is unchanged.ApprovedTargetTests,SchemaServiceTests,MetadataReadLendingTests,MetadataConnectionPool*Tests,DatabaseSwitcherRefreshTests,QuickSwitcherViewModelTests,SchemaLeasingLoadTests,DatabaseTreeMetadataServiceTests,ScopedDriverRoutingTests: 217 passed.Closes #4542