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

Import: Change merge logic #6251

Merged
merged 36 commits into from
Aug 2, 2023
Merged

Conversation

Jonathan-Rosenberg
Copy link
Contributor

In order to support some cases of the import behavior, additional checks were needed to be added to the merger logic.
This PR includes those changes and tests for the import behavior.

It's recommended to review #6250 (the PrefixIterator is sufficient)

Closes #6162

@Jonathan-Rosenberg Jonathan-Rosenberg added the include-changelog PR description should be included in next release changelog label Jul 24, 2023
@Jonathan-Rosenberg Jonathan-Rosenberg removed the request for review from itaiad200 July 25, 2023 09:37
@johnnyaug
Copy link
Contributor

Like I said in #6250, while it's great to reuse the merge logic for the import, I don't think the import is part of the merge.
This PR makes this a bigger issue.

I feel responsible for taking us down this path but I can only suggest two things:

  1. Try to solve this by adding the following logic to the previous PR: the destination iterator should split any range that (may) include a prefix. For example, if the prefix is b and the original range is [a,c], that dest iterator will return [a,b] and [b,c]. This may solve the relevant issue and still will allow you to leave the merge code as is.
  2. Go back to a dedicated import solution. :(

pkg/graveler/committed/merge.go Outdated Show resolved Hide resolved
pkg/graveler/committed/range.go Show resolved Hide resolved
pkg/graveler/committed/import_test.go Outdated Show resolved Hide resolved
pkg/graveler/committed/merge.go Outdated Show resolved Hide resolved
pkg/graveler/committed/merge.go Outdated Show resolved Hide resolved
pkg/graveler/committed/manager.go Outdated Show resolved Hide resolved
@Jonathan-Rosenberg Jonathan-Rosenberg changed the base branch from feature/import/prefix-iterator to master August 2, 2023 08:43
@@ -565,7 +567,7 @@ type VersionController interface {
Merge(ctx context.Context, repository *RepositoryRecord, destination BranchID, source Ref, commitParams CommitParams, strategy string) (CommitID, error)

// Import Creates a merge-commit using source MetaRangeID into destination branch with a src-wins merge strategy
Copy link
Contributor

Choose a reason for hiding this comment

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

Doc needs to be updated to reflect the prefix logic

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oops
done

pkg/graveler/graveler.go Outdated Show resolved Hide resolved
pkg/graveler/committed/skip_prefix_iterator.go Outdated Show resolved Hide resolved
pkg/graveler/committed/skip_prefix_iterator.go Outdated Show resolved Hide resolved
pkg/graveler/committed/skip_prefix_iterator.go Outdated Show resolved Hide resolved
pkg/graveler/committed/skip_prefix_iterator.go Outdated Show resolved Hide resolved
return false
}
ipi.updateValue()
ipi.currentPrefixIndex++
Copy link
Contributor

Choose a reason for hiding this comment

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

Why? What if the next range is also bounded by the prefix?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True
This should be like in Next() and call updatePrefix.

Jonathan-Rosenberg and others added 3 commits August 2, 2023 13:42
Co-authored-by: Yoni <yoni.augarten@treeverse.io>
Copy link
Contributor

@nopcoder nopcoder left a comment

Choose a reason for hiding this comment

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

LGTM with minor code style suggestion

pkg/graveler/committed/manager.go Outdated Show resolved Hide resolved
pkg/graveler/committed/manager.go Outdated Show resolved Hide resolved
pkg/graveler/committed/manager.go Outdated Show resolved Hide resolved
pkg/graveler/committed/manager.go Outdated Show resolved Hide resolved
Copy link
Contributor

@johnnyaug johnnyaug left a comment

Choose a reason for hiding this comment

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

Looks great!

@Jonathan-Rosenberg Jonathan-Rosenberg enabled auto-merge (squash) August 2, 2023 15:46
@Jonathan-Rosenberg Jonathan-Rosenberg merged commit b1c3579 into master Aug 2, 2023
@Jonathan-Rosenberg Jonathan-Rosenberg deleted the feature/import/merge-logic branch August 2, 2023 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
include-changelog PR description should be included in next release changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Import should replace the destination prefix with the source's state
3 participants