Skip to content

Conversation

@SimonCqk
Copy link
Contributor

Ⅰ. Describe what this PR does

  1. sort broken mountpoints orders.
  2. fix unexpected variable capture in for-loop.

Ⅱ. 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

@fluid-e2e-bot
Copy link

fluid-e2e-bot bot commented Nov 26, 2024

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions 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>
@sonarqubecloud
Copy link

bindMountByName = make(map[string][]*Mount)
for k, m := range mountByPath {
var datasetNamespacedName string
mCopy := m
Copy link
Collaborator

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.

Copy link
Contributor Author

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") {
Copy link
Collaborator

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.

Copy link
Collaborator

@cheyang cheyang left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@fluid-e2e-bot
Copy link

fluid-e2e-bot bot commented Nov 28, 2024

[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

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@fluid-e2e-bot fluid-e2e-bot bot merged commit 1f99e3c into fluid-cloudnative:master Nov 28, 2024
12 checks passed
cheyang added a commit that referenced this pull request Nov 29, 2024
cheyang added a commit that referenced this pull request Nov 29, 2024
…)"

This reverts commit 1f99e3c.

Signed-off-by: cheyang <cheyang@163.com>
fluid-e2e-bot bot pushed a commit that referenced this pull request Dec 3, 2024
…)" (#4421)

This reverts commit 1f99e3c.

Signed-off-by: cheyang <cheyang@163.com>
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.

2 participants