This PR is to add comments to etMasterStatefulset in fluid/pkg/ddc/alluxio/utils.go.#6080
This PR is to add comments to etMasterStatefulset in fluid/pkg/ddc/alluxio/utils.go.#6080zhayangyu22 wants to merge 1 commit into
Conversation
Signed-off-by: 赵媛媛231840070 <231840070@smail.nju.edu.cn>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @zhayangyu22. 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. |
There was a problem hiding this comment.
Code Review
This pull request adds a documentation comment to the getMasterStatefulset method in pkg/ddc/alluxio/utils.go. Feedback was provided to correct the documentation, as it incorrectly states that the returned master pointer is nil on error, whereas the implementation actually returns a pointer to an empty StatefulSet struct.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| // Returns: | ||
| // - master: a pointer to the appsv1.StatefulSet object if found; nil on error. | ||
| // - err: non-nil if the retrieval fails (e.g., resource not found, network issue). |
There was a problem hiding this comment.
The comment states that master is nil on error. However, looking at the implementation of getMasterStatefulset, master is initialized as &appsv1.StatefulSet{} and then returned along with the error. Therefore, on error, master will be a pointer to an empty StatefulSet struct rather than nil. The comment should be updated to accurately reflect this behavior to prevent callers from incorrectly assuming they can perform a simple nil check on the returned master pointer.
| // Returns: | |
| // - master: a pointer to the appsv1.StatefulSet object if found; nil on error. | |
| // - err: non-nil if the retrieval fails (e.g., resource not found, network issue). | |
| // Returns: | |
| // - master: a pointer to the appsv1.StatefulSet object (note: on error, this is a pointer to an empty StatefulSet, not nil). | |
| // - err: non-nil if the retrieval fails (e.g., resource not found, network issue). |
|
| // - name: the name of the StatefulSet resource. | ||
| // - namespace: the Kubernetes namespace where the StatefulSet resides. | ||
| // | ||
| // Returns: |
There was a problem hiding this comment.
Thanks for adding GoDoc here — the description of the parameters and behavior is clear. One small accuracy nit on the return value: the comment says master: a pointer to the appsv1.StatefulSet object if found; nil on error., but the implementation always allocates master = &appsv1.StatefulSet{} before calling e.Client.Get, so the returned pointer is never nil. On error it just points to a zero-value StatefulSet.
Consider rewording to match the actual behavior, for example:
// - master: a non-nil pointer to an appsv1.StatefulSet; populated when err is nil,
// otherwise points to a zero-value StatefulSet and should not be relied upon.
Keeping the doc precise here helps callers reason about nil checks vs. error checks.



Ⅰ. Describe what this PR does
Add comments to etMasterStatefulset in fluid/pkg/ddc/alluxio/utils.go.
Ⅱ. Does this pull request fix one issue?
fixes #6079
Ⅲ. Special notes for reviews