Context collections accept a database#2847
Conversation
|
|
SummaryThis run exercised core database behavior around keeping schema metadata and type/procedure resolution isolated per database, plus cross-session stability of runtime type expressions and declaration handling. It also covered multi-database statement finalization edge cases that affect whether metadata changes are durably and consistently persisted. Merge with caution — there is a likely medium-severity regression introduced by this PR in statement finalization logic, where some multi-database metadata updates may be skipped and leave incorrect persisted state. A separate high-severity finalization consistency issue was also observed but appears pre-existing, so it is an important caveat rather than the main merge blocker for this change. Tests run by ItoAdditional Findings DetailsThese findings are unrelated to the current changes but were observed during testing. 🟠 Multi-database finalization abort leaves partially persisted metadata
Evidence PackageTip Reply with @itoqa to send us feedback on this test run. |
|
fulghum
left a comment
There was a problem hiding this comment.
Passing through database string looks good. I see what you mean about needing cross-database tests next to verify that behavior.

In Dolt, we don't allow multiple databases to be modified in the same statement. Normally this isn't possible, but by accessing certain collections during database creation (such as the cast collection, even if it's not used), we would load those collections. This then caused us to try and persist those collections, even though they're empty. That empty state is still different than "no data present", so it was a valid database update, and could therefore cause multiple databases to be updated.
This change makes it such that every collection is accessed by a database string. In the database creation case, we load a collection under an empty database string (as no database exists yet). This prevents that collection from being persisted (as we don't persist something attached to an empty database name), and works around the multi-database update issue. In addition, this paves the way for proper cross-database support of collection items, which are unsupported at the current moment.