-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix: sort broken mountpoint and put subpaths at the end. #4416
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
Conversation
|
Hi @SimonCqk. Thanks for your PR. I'm waiting for a fluid-cloudnative member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Signed-off-by: SimonCqk <cqk0100@gamil.com>
|
| bindMountByName = make(map[string][]*Mount) | ||
| for k, m := range mountByPath { | ||
| var datasetNamespacedName string | ||
| mCopy := m |
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.
In this change, using mCopy := m to create a "copy" of a mount point (Mount), where m is a pointer type (*Mount). However, it's important to note that mCopy merely copies the pointer and not the actual data it points to. This means that mCopy and m actually point to the same memory address, and any modifications to mCopy will affect the data pointed to by m. I think we need deepCopy to avoid original object modification.
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.
In this case, m/mCopy is readonly, the shallow copy mCopy intends to address loop scoping issue in golang version <= 1.21, ref: https://go.dev/blog/loopvar-preview
|
|
||
| func (mp MountPoints) Len() int { return len(mp) } | ||
| func (mp MountPoints) Less(i, j int) bool { | ||
| if strings.Contains(mp[i].MountPath, "main") && !strings.Contains(mp[j].MountPath, "main") { |
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.
Use constants for frequently used or significant strings like "main" in the code is a good practice.
cheyang
left a comment
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.
/lgtm
/approve
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cheyang The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
…)" This reverts commit 1f99e3c.
…)" This reverts commit 1f99e3c. Signed-off-by: cheyang <cheyang@163.com>



Ⅰ. Describe what this PR does
Ⅱ. Does this pull request fix one issue?
fixes #XXXX
Ⅲ. List the added test cases (unit test/integration test) if any, please explain if no tests are needed.
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews