8000 When performing a three-way merge, Use a patchBuffer to build the new primary index instead of a MutableMap. by nicktobey · Pull Request #9229 · dolthub/dolt · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

When performing a three-way merge, Use a patchBuffer to build the new primary index instead of a MutableMap. #9229

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

Merged
merged 3 commits into from
May 20, 2025

Conversation

nicktobey
Copy link
Contributor

MutableMaps are designed for caching point modifications to a table. But during merge, the new primary index is computed sequentially. There's no benefit to using a MutableMap here.

MutableMaps are built on top of the ApplyMutations function, which takes a sequential stream of modifications (called a PatchBuffer) and applies them to a chunker. This has the added benefit of being parallelizable: the patches are produced in one goroutine and consumed in another.

Instead of using the MutableMap, we can extract the underlying PatchBuffer and use it directly. This should be both more performant, and more correct as it avoids a failure case with schema merges where the MutableMap flushes changes to disk and writes a chunk containing rows with different schemas.

@coffeegoddd
Copy link
Contributor

@nicktobey DOLT

comparing_percentages
100.000000 to 100.000000
version result total
47e1ee7 ok 5937457
version total_tests
47e1ee7 5937457
correctness_percentage
100.0

@coffeegoddd
Copy link
Contributor

@coffeegoddd DOLT

comparing_percentages
100.000000 to 100.000000
version result total
73be4c2 ok 5937457
version total_tests
73be4c2 5937457
correctness_percentage
100.0

var conflicts *conflictMerger
eg.Go(func() error {
var err error
sec, conflicts, err = computeProllyTreePatches(ctx, tm, finalSch, mergeTbl, valueMerger, mergeInfo, diffInfo, patchBuffer, s)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

errCtx?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Copy link
Contributor
@reltuk reltuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@coffeegoddd
Copy link
Contributor

@nicktobey DOLT

comparing_percentages
100.000000 to 100.000000
version result total
2262c0f ok 5937457
version total_tests
2262c0f 5937457
correctness_percentage
100.0

@nicktobey nicktobey merged commit 11f4eaa into main May 20, 2025
21 checks passed
@nicktobey nicktobey deleted the nicktobey/merge branch May 20, 2025 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0