Skip to content

refactor(alluxio): remove redundant CacheStates update from UpdateDat…#5806

Merged
fluid-e2e-bot[bot] merged 1 commit intofluid-cloudnative:masterfrom
lin121291:refactor/remove-redundant-cachestates-update
Apr 27, 2026
Merged

refactor(alluxio): remove redundant CacheStates update from UpdateDat…#5806
fluid-e2e-bot[bot] merged 1 commit intofluid-cloudnative:masterfrom
lin121291:refactor/remove-redundant-cachestates-update

Conversation

@lin121291
Copy link
Copy Markdown
Contributor

Ⅰ. Describe what this PR does

Remove redundant CacheStates assignment and unnecessary getRuntime()
call from AlluxioEngine.UpdateDatasetStatus().

UpdateDatasetStatus() manages dataset phase and conditions. It also
sets CacheStates, duplicating the work of UpdateCacheOfDataset()
which is the authoritative source (called at Sync step 5 in
pkg/ddc/base/syncs.go:79).

The assignment is a no-op in all code paths:

  • Setup (BindToDataset): Runtime just created, CacheStates is empty
  • Sync healthy path: step 5 UpdateCacheOfDataset() overwrites immediately after
  • Sync unhealthy path: step 4 CheckAndUpdateRuntimeStatus never ran,
    so runtime.Status.CacheStates already equals dataset.Status.CacheStates
    from last successful sync

The existing TODO comment in the code confirms this was a known concern.

Ⅱ. Does this pull request fix one issue?

NONE

Ⅲ. List the added test cases

No new tests needed. The removed code was a no-op — existing tests for
UpdateDatasetStatus() and UpdateCacheOfDataset() continue to pass.

Ⅳ. Describe how to verify it

FLUID_UNIT_TEST=true go test ./pkg/ddc/alluxio/... -count=1

notes

  • e.runtime (engine struct field, used for Spec.Master.Replicas) is NOT affected — only the local runtime variable from getRuntime() is removed
  • All other runtime engines have the same pattern ; will submit a follow-up PR after this one is merged

…asetStatus

CacheStates is already managed by UpdateCacheOfDataset() at Sync step 5.
The duplicate assignment in UpdateDatasetStatus() has no effect and adds
an unnecessary getRuntime() call.

Signed-off-by: lin121291 <4jp33f9e@gmail.com>
@fluid-e2e-bot
Copy link
Copy Markdown

fluid-e2e-bot Bot commented Apr 24, 2026

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

@sonarqubecloud
Copy link
Copy Markdown

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 simplifies the UpdateDatasetStatus function in the Alluxio engine by removing the retrieval of runtime status and the redundant update of CacheStates. These changes streamline the status update process, as CacheStates are managed in a separate function. I have no feedback to provide as no review comments were present.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.17%. Comparing base (82e490e) to head (0da0235).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5806      +/-   ##
==========================================
- Coverage   58.17%   58.17%   -0.01%     
==========================================
  Files         478      478              
  Lines       32485    32477       -8     
==========================================
- Hits        18899    18894       -5     
+ Misses      12042    12040       -2     
+ Partials     1544     1543       -1     

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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the Alluxio runtime’s dataset status update flow by removing a redundant CacheStates write and an unnecessary getRuntime() fetch from AlluxioEngine.UpdateDatasetStatus(), keeping cache state updates centralized in UpdateCacheOfDataset() (called from the base sync flow).

Changes:

  • Removed getRuntime() call from AlluxioEngine.UpdateDatasetStatus().
  • Removed redundant assignment of dataset.Status.CacheStates inside UpdateDatasetStatus() (avoids duplicating UpdateCacheOfDataset() behavior).
  • Dropped the related TODO/commented-out lines that indicated the duplication.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@cheyang
Copy link
Copy Markdown
Collaborator

cheyang commented Apr 27, 2026

The change is correct. The CacheStates assignment in UpdateDatasetStatus() is indeed a no-op across all call paths:

  • BindToDataset: Runtime just created, runtime.Status.CacheStates is empty
  • Sync healthy path: CheckAndUpdateRuntimeStatus() (step 4) populates runtime cache states, then UpdateCacheOfDataset() (step 5) overwrites dataset cache states immediately after CheckRuntimeHealthy() calls UpdateDatasetStatus()
  • Sync unhealthy path: CheckRuntimeHealthy() returns early before CheckAndUpdateRuntimeStatus(), so runtime.Status.CacheStates is stale and identical to what's already on the dataset from the last successful sync

Removing the redundant getRuntime() call also saves an unnecessary API server read on every status update.

Verified against the sync flow in pkg/ddc/base/syncs.go and all callers in health_check.go and replicas.go. No race conditions or behavioral regressions found.

LGTM.

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

fluid-e2e-bot Bot commented Apr 27, 2026

[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 c6d1c22 into fluid-cloudnative:master Apr 27, 2026
22 checks passed
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.

3 participants