-
Notifications
You must be signed in to change notification settings - Fork 1.3k
fix: correctly identify alluxio root mount path in multi-mount datasets #6103
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -47,18 +47,18 @@ func (u UFSPathBuilder) GenUFSPathInUnifiedNamespace(mount datav1alpha1.Mount) s | |||||||||||||||||||||||||||||||||
| // GenAlluxioUFSRootPath determines which mount point should be mounted on the root path of | ||||||||||||||||||||||||||||||||||
| // the [unified namespace] in Alluxio engine. Commonly there are two cases: | ||||||||||||||||||||||||||||||||||
| // | ||||||||||||||||||||||||||||||||||
| // 1. If a `mount` item is the only item defined in `dataset.sepc.mounts[*]` and its ufs path equals to "/", its `mountpoint` should be on the root path. | ||||||||||||||||||||||||||||||||||
| // 1. If any `mount` item defined in `dataset.spec.mounts[*]` has its ufs path equal to "/", its `mountpoint` should be on the root path. | ||||||||||||||||||||||||||||||||||
| // e.g. alluxio fs mount s3://mybucket / | ||||||||||||||||||||||||||||||||||
| // 2. Otherwise, pick `/underFSStorage` as the default root path. | ||||||||||||||||||||||||||||||||||
| // e.g. alluxio fs mount /underFSStorage / && alluxio fs mount s3://mybucket /mybucket | ||||||||||||||||||||||||||||||||||
| // | ||||||||||||||||||||||||||||||||||
| // [unified namespace]: https://docs.alluxio.io/os/user/stable/en/core-services/Unified-Namespace.html | ||||||||||||||||||||||||||||||||||
| func (u UFSPathBuilder) GenAlluxioUFSRootPath(items []datav1alpha1.Mount) (string, *datav1alpha1.Mount) { | ||||||||||||||||||||||||||||||||||
| if len(items) == 1 { | ||||||||||||||||||||||||||||||||||
| m := items[0] | ||||||||||||||||||||||||||||||||||
| for i := range items { | ||||||||||||||||||||||||||||||||||
| m := &items[i] | ||||||||||||||||||||||||||||||||||
| // only iff m matches all of the two following conditions (1) m is not a fluid-native mount point; (2) m.Path is "/", it should be the root path in cache UFS. | ||||||||||||||||||||||||||||||||||
| if !common.IsFluidNativeScheme(m.MountPoint) && u.GenUFSPathInUnifiedNamespace(m) == common.RootDirPath { | ||||||||||||||||||||||||||||||||||
| return m.MountPoint, &m | ||||||||||||||||||||||||||||||||||
| if !common.IsFluidNativeScheme(m.MountPoint) && u.GenUFSPathInUnifiedNamespace(*m) == common.RootDirPath { | ||||||||||||||||||||||||||||||||||
| return m.MountPoint, m | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+57
to
63
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Returning a pointer directly to the slice element ( To prevent this, copy the slice element by value first, and then return a pointer to the copy (which will be safely allocated on the heap by Go's escape analysis). This also simplifies the code by avoiding the need to dereference
Suggested change
|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation comment for
GenAlluxioUFSRootPath(lines 50-53) is now outdated. It still states that the root path is only used if there is only a single mount item defined indataset.spec.mounts. Since this PR enables identifying the root path in multi-mount scenarios, please update the documentation comment to reflect this new behavior.