Skip to content

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

Open
jakharmonika364 wants to merge 1 commit intofluid-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 intofluid-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
Copy link
Copy Markdown

fluid-e2e-bot bot commented Mar 17, 2026

[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
Copy link
Copy Markdown

fluid-e2e-bot bot commented Mar 17, 2026

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.

Copy link
Copy Markdown
Contributor

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

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.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 17, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 61.21%. Comparing base (9fe8f29) to head (b6f3010).

Files with missing lines Patch % Lines
pkg/ddc/alluxio/ufs_internal.go 50.00% 5 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5695      +/-   ##
==========================================
- Coverage   61.22%   61.21%   -0.02%     
==========================================
  Files         444      444              
  Lines       30557    30567      +10     
==========================================
+ Hits        18710    18713       +3     
- Misses      10307    10312       +5     
- Partials     1540     1542       +2     

☔ View full report in Codecov by Sentry.
📢 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.

Signed-off-by: Monika Jhakar <jakharmonika364@gmail.com>
@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

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

1 participant