Skip to content

fix(ddc): wrap ufsTotal status update with retry on conflict#5695

Open
jakharmonika364 wants to merge 1 commit into
fluid-cloudnative:masterfrom
jakharmonika364:bugfix/3377-metadata-update-conflict
Open

fix(ddc): wrap ufsTotal status update with retry on conflict#5695
jakharmonika364 wants to merge 1 commit into
fluid-cloudnative:masterfrom
jakharmonika364:bugfix/3377-metadata-update-conflict

Conversation

@jakharmonika364

Copy link
Copy Markdown
Contributor

Ⅰ. Describe what this PR does

In processUpdatingUFS() for both AlluxioRuntime and GooseFSRuntime, the call that resets UfsTotal to "Calculating" before triggering SyncMetadata() wasn't wrapped with retry.RetryOnConflict. If a concurrent update caused a conflict, it would silently fail and SyncMetadata() would skip syncing because it saw a non-empty UfsTotal. This PR wraps that update with retry.RetryOnConflict, consistent with how similar status updates are handled elsewhere in the package.

Ⅱ. Does this pull request fix one issue?

fixes #3377

Ⅲ. List the added test cases (unit test/integration test) if any, please explain if no tests are needed.

No new tests added. The fix mirrors the existing retry pattern already used in the same package (e.g. metadata.go). Existing tests continue to pass.

Ⅳ. Describe how to verify it

  1. Create a Dataset with AlluxioRuntime and wait for it to be bound
  2. Patch the dataset to add/remove a mount point while status updates are ongoing
  3. Verify UfsTotal in the dataset status updates correctly after the mount change

Ⅴ. Special notes for reviews

Same fix applied to both pkg/ddc/alluxio/ufs_internal.go and pkg/ddc/goosefs/ufs_internal.go since they had identical code paths with the same bug.

@fluid-e2e-bot

fluid-e2e-bot Bot commented Mar 17, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign ronggu for approval by writing /assign @ronggu in a comment. For more information see:The Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical reliability issue in the DDC (Distributed Data Cache) component, specifically concerning the UfsTotal status updates for Alluxio and GooseFS runtimes. Previously, these updates could fail silently under concurrent modification scenarios, leading to incorrect metadata synchronization behavior. By implementing a retry.RetryOnConflict mechanism, the system now gracefully handles these conflicts, ensuring that UfsTotal status is consistently and accurately reflected, which is crucial for the correct functioning of metadata synchronization.

Highlights

  • UfsTotal Status Update Reliability: The process of resetting UfsTotal to "Calculating" before metadata synchronization in processUpdatingUFS() for AlluxioRuntime and GooseFSRuntime is now wrapped with retry.RetryOnConflict.
  • Conflict Resolution: This change prevents silent failures when concurrent updates cause conflicts, ensuring that SyncMetadata() does not incorrectly skip its operation due to an un-updated UfsTotal status.
  • Consistency: The fix aligns the UfsTotal status update mechanism with existing robust retry patterns used elsewhere in the package, improving overall system resilience.
Changelog
  • pkg/ddc/alluxio/ufs_internal.go
    • Reordered imports for v1 "k8s.io/api/core/v1".
    • Implemented retry.RetryOnConflict around the dataset.Status().Update() call for UfsTotal.
  • pkg/ddc/goosefs/ufs_internal.go
    • Added import for k8s.io/client-go/util/retry.
    • Implemented retry.RetryOnConflict around the dataset.Status().Update() call for UfsTotal.
Activity
  • No human activity (comments, reviews, etc.) has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@fluid-e2e-bot

fluid-e2e-bot Bot commented Mar 17, 2026

Copy link
Copy Markdown

Hi @jakharmonika364. 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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request correctly identifies a race condition during dataset status updates and introduces retry.RetryOnConflict to make the update more robust. This is a good improvement. However, the implementation introduces a bug where the error from the retry block is overwritten and lost if the subsequent SyncMetadata call succeeds. I've added comments with suggestions to fix this by propagating the error. Additionally, I've pointed out the usage of context.TODO() which could be improved by passing a proper context from the caller.

Comment thread pkg/ddc/alluxio/ufs_internal.go Outdated
Comment thread pkg/ddc/goosefs/ufs_internal.go Outdated
Comment thread pkg/ddc/alluxio/ufs_internal.go Outdated
Comment thread pkg/ddc/goosefs/ufs_internal.go Outdated
@codecov

codecov Bot commented Mar 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 53.33333% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.85%. Comparing base (d118fbd) to head (c4973d8).

Files with missing lines Patch % Lines
pkg/ddc/alluxio/ufs_internal.go 53.33% 4 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5695      +/-   ##
==========================================
- Coverage   64.86%   64.85%   -0.01%     
==========================================
  Files         480      480              
  Lines       33514    33520       +6     
==========================================
+ Hits        21738    21740       +2     
- Misses      10051    10054       +3     
- Partials     1725     1726       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jakharmonika364 jakharmonika364 force-pushed the bugfix/3377-metadata-update-conflict branch from e7f9dc7 to b6f3010 Compare March 17, 2026 12:28
@sonarqubecloud

Copy link
Copy Markdown

@jakharmonika364 jakharmonika364 force-pushed the bugfix/3377-metadata-update-conflict branch from b6f3010 to dca14bc Compare April 19, 2026 16:09
@jakharmonika364

Copy link
Copy Markdown
Contributor Author

@cheyang Can I get your review please??

@jakharmonika364 jakharmonika364 force-pushed the bugfix/3377-metadata-update-conflict branch 5 times, most recently from 1d05d73 to 0e2975f Compare April 25, 2026 23:34
@jakharmonika364

Copy link
Copy Markdown
Contributor Author

/retest

@fluid-e2e-bot

fluid-e2e-bot Bot commented Apr 26, 2026

Copy link
Copy Markdown

@jakharmonika364: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

Details

In response to this:

/retest

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.

@jakharmonika364 jakharmonika364 force-pushed the bugfix/3377-metadata-update-conflict branch from 0e2975f to 51a82db Compare April 26, 2026 19:52
@sonarqubecloud

Copy link
Copy Markdown

@cheyang

cheyang commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

This PR has merge conflicts and cannot be merged in its current state. The change to wrap ufsTotal status update with retry on conflict looks reasonable in principle.

Please rebase onto the latest master to resolve the conflicts, then this can proceed with review.

Signed-off-by: Monika Jakhar <jakharmonika364@gmail.com>
@jakharmonika364 jakharmonika364 force-pushed the bugfix/3377-metadata-update-conflict branch from 51a82db to c4973d8 Compare June 17, 2026 12:02
@sonarqubecloud

Copy link
Copy Markdown

@jakharmonika364

Copy link
Copy Markdown
Contributor Author

@cheyang Rebased onto master, conflicts resolved. Ready for review.

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.

[BUG][AlluxioRuntime]Metadata not update when add/remove mountPoint in dataset

2 participants