MCPcopy Create free account
hub / github.com/dolthub/doltgresql / CloseContextRootFinalizer

Function CloseContextRootFinalizer

core/context.go:472–491  ·  view source on GitHub ↗

CloseContextRootFinalizer finalizes any changes persisted within the context by writing them to the working root. This should ONLY be called by the ContextRootFinalizer node.

(ctx *sql.Context)

Source from the content-addressed store, hash-verified

470// CloseContextRootFinalizer finalizes any changes persisted within the context by writing them to the working root.
471// This should ONLY be called by the ContextRootFinalizer node.
472func CloseContextRootFinalizer(ctx *sql.Context) error {
473 sess := dsess.DSessFromSess(ctx.Session)
474 if sess.DoltgresSessObj == nil {
475 return nil
476 }
477 cv, ok := sess.DoltgresSessObj.(*contextValues)
478 if !ok {
479 return nil
480 }
481
482 // We need to update the root for all databases used by this context. This logic parallels what happens during
483 // transaction commit in the dolt/sqle layer, where we check each branch state to see if it's dirty
484 for _, db := range databasesInContext(ctx, cv) {
485 err := updateSessionRootForDatabase(ctx, db, cv)
486 if err != nil {
487 return err
488 }
489 }
490 return nil
491}
492
493// updateSessionRootForDatabase updates the root for all changes made to root object collections within the context
494// values.

Callers 1

CloseMethod · 0.92

Calls 2

databasesInContextFunction · 0.85

Tested by

no test coverage detected