Skip to content

refactor: remove redundant CacheStates update from UpdateDatasetStatu…#5813

Open
lin121291 wants to merge 3 commits intofluid-cloudnative:masterfrom
lin121291:refactor/remove-redundant-cachestates-from-update-dataset-status
Open

refactor: remove redundant CacheStates update from UpdateDatasetStatu…#5813
lin121291 wants to merge 3 commits intofluid-cloudnative:masterfrom
lin121291:refactor/remove-redundant-cachestates-from-update-dataset-status

Conversation

@lin121291
Copy link
Copy Markdown
Contributor

I. Describe what this PR does

Follow-up to #5806. Apply the same refactoring to the remaining 7 runtime engines: efc, goosefs, jindo, jindocache, jindofsx, thin, vineyard.

Remove redundant CacheStates assignment and unnecessary getRuntime() call from UpdateDatasetStatus() in each engine.

UpdateDatasetStatus() manages dataset phase and conditions. It also set 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

II. Does this pull request fix one issue?

NONE (code cleanup, follow-up to #5806)

III. List the added test cases

No new tests needed.

Updated existing TestUpdateDatasetStatus and TestBindToDataset in 5 runtimes (efc, goosefs, jindo, thin, vineyard) to remove CacheStates assertions, since CacheStates is the responsibility of UpdateCacheOfDataset().

jindocache and jindofsx have no such tests.

IV. Describe how to verify it

FLUID_UNIT_TEST=true go test ./pkg/ddc/efc/... -run "TestUpdateDatasetStatus|TestBindToDataset|TestUpdateCacheOfDataset" -v
FLUID_UNIT_TEST=true go test ./pkg/ddc/goosefs/... -run "TestUpdateDatasetStatus|TestBindToDataset|TestUpdateCacheOfDataset" -v
FLUID_UNIT_TEST=true go test ./pkg/ddc/jindo/... -run "TestUpdateDatasetStatus|TestBindToDataset|TestUpdateCacheOfDataset" -v
FLUID_UNIT_TEST=true go test ./pkg/ddc/jindocache/... -run "TestUpdateDatasetStatus|TestBindToDataset|TestUpdateCacheOfDataset" -v
FLUID_UNIT_TEST=true go test ./pkg/ddc/jindofsx/... -run "TestUpdateDatasetStatus|TestBindToDataset|TestUpdateCacheOfDataset" -v
FLUID_UNIT_TEST=true go test ./pkg/ddc/thin/... -run "TestUpdateDatasetStatus|TestBindToDataset|TestUpdateCacheOfDataset" -v
FLUID_UNIT_TEST=true go test ./pkg/ddc/vineyard/... -run "TestUpdateDatasetStatus|TestBindToDataset|TestUpdateCacheOfDataset" -v

@fluid-e2e-bot
Copy link
Copy Markdown

fluid-e2e-bot Bot commented Apr 28, 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 yangyuliufeng for approval by writing /assign @yangyuliufeng 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

@fluid-e2e-bot
Copy link
Copy Markdown

fluid-e2e-bot Bot commented Apr 28, 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.

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 removes the logic for updating CacheStates within the UpdateDatasetStatus function across several storage engines, including EFC, GooseFS, Jindo, JindoCache, JindoFSx, Thin, and Vineyard. Specifically, it eliminates the calls to getRuntime() and the subsequent assignment of CacheStates to the dataset status. Corresponding unit tests have been updated to reflect these changes by removing CacheStates from expected results and deep equality checks. I have no feedback to provide.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.18%. Comparing base (c6d1c22) to head (3c00d10).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5813   +/-   ##
=======================================
  Coverage   58.17%   58.18%           
=======================================
  Files         478      478           
  Lines       32477    32452   -25     
=======================================
- Hits        18894    18881   -13     
+ Misses      12040    12032    -8     
+ Partials     1543     1539    -4     

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

…s across all runtimes

Signed-off-by: lin121291 <4jp33f9e@gmail.com>
…tates assertions

Signed-off-by: lin121291 <4jp33f9e@gmail.com>
…rtions

Signed-off-by: lin121291 <4jp33f9e@gmail.com>
@lin121291 lin121291 force-pushed the refactor/remove-redundant-cachestates-from-update-dataset-status branch from 5a77b33 to 3c00d10 Compare April 28, 2026 13:11
@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.

1 participant