Repository navigation
fix(sidebar): key routine, trigger, type and schema fetches by scope - #2615
Merged
Merged
Conversation
…so a database switch never joins the fetch it is leaving Claude-Session: https://claude.ai/code/session_014THhVdsUjbCboxNLnQB1dR
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
Root cause
SchemaServiceshares one in-flight fetch per key so two windows on the same connection do not run the same catalog query twice. The tables fetch was keyed by connection and scope (LoadKey), but the routine, trigger, type and schema fetches were keyed by connection alone. A load for the database being entered therefore joined the in-flight fetch of the database being left, took its answer, and committed that database's routines, triggers and types under the new scope. The stale load is discarded by the generation check, but the joined result is not stale from the new load's point of view: it simply came from the wrong database. Found as a collateral item while working on #2484.Fix
LoadKey(connection + scope), the same key the tables fetch already used.reloadRoutines,reloadTriggersandreloadUserDefinedTypestake the scope they refresh, so a targeted reload shares a fetch only with a load of the same scope. The schema-switch refresh passes the scope it already resolved; the coordinator's refresh actions and the enum label editor pass the browse scope, which is the scope the driver they use is on.prepareForReloadcancels every key of the connection, whatever its scope.Tests
SchemaServiceRoutinesTests: a new case starts a load for one scope, blocks its routine fetch, starts a load for another scope, and asserts a second routine fetch is issued and the second scope wins. It fails onmain, where the count stays at one. The four SchemaService suites pass (34 cases).Changelog
Fixed: Sidebar routines, triggers and types from the previous database after switching while it was still loading.
https://claude.ai/code/session_014THhVdsUjbCboxNLnQB1dR