Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added additional function to RootValue #7848

Merged
merged 1 commit into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions go/libraries/doltcore/doltdb/root_val.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ type RootValue interface {
GetTableHash(ctx context.Context, tName string) (hash.Hash, bool, error)
// GetTableNames retrieves the lists of all tables for a RootValue
GetTableNames(ctx context.Context, schemaName string) ([]string, error)
// HandlePostMerge handles merging for any root elements that are not handled by the standard merge workflow. This
// is called at the end of the standard merge workflow. The calling root is the merged root, so it is valid to
// return it if no further merge work needs to be done. This is primarily used by Doltgres.
HandlePostMerge(ctx context.Context, ourRoot, theirRoot, ancRoot RootValue) (RootValue, error)
// HasTable returns whether the root has a table with the given case-sensitive name.
HasTable(ctx context.Context, tName string) (bool, error)
// IterTables calls the callback function cb on each table in this RootValue.
Expand Down Expand Up @@ -277,6 +281,10 @@ func (root *rootValue) SetCollation(ctx context.Context, collation schema.Collat
return root.withStorage(newStorage), nil
}

func (root *rootValue) HandlePostMerge(ctx context.Context, ourRoot, theirRoot, ancRoot RootValue) (RootValue, error) {
return root, nil
}

func (root *rootValue) HasTable(ctx context.Context, tName string) (bool, error) {
tableMap, err := root.st.GetTablesMap(ctx, root.vrw, root.ns, DefaultSchemaName)
if err != nil {
Expand Down
5 changes: 5 additions & 0 deletions go/libraries/doltcore/merge/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,11 @@ func MergeRoots(
return nil, err
}

mergedRoot, err = mergedRoot.HandlePostMerge(ctx, ourRoot, theirRoot, ancRoot)
if err != nil {
return nil, err
}

h, err := merger.rightSrc.HashOf()
if err != nil {
return nil, err
Expand Down
Loading