Skip to content

fix: implement VineyardEngine.CheckRuntimeReady to check worker read…#6106

Open
adityaupasani2 wants to merge 1 commit into
fluid-cloudnative:masterfrom
adityaupasani2:fix/vineyard-check-runtime-ready
Open

fix: implement VineyardEngine.CheckRuntimeReady to check worker read…#6106
adityaupasani2 wants to merge 1 commit into
fluid-cloudnative:masterfrom
adityaupasani2:fix/vineyard-check-runtime-ready

Conversation

@adityaupasani2

Copy link
Copy Markdown
Contributor

Ⅰ. Describe what this PR does

VineyardEngine.CheckRuntimeReady() in pkg/ddc/vineyard/runtime_info.go was an unimplemented stub that unconditionally returned true:

func (e *VineyardEngine) CheckRuntimeReady() (ready bool) {
    //TODO implement me
    return true
}

This caused data operations (DataLoad, DataMigrate, DataProcess) to be dispatched against a VineyardRuntime even when workers were not actually ready.

Implements it using CheckWorkersReady() — the same helper already used by CheckRuntimeHealthy(). Fuse readiness is intentionally excluded because fluid treats fuse as always-ready by design (pkg/ctrl/fuse.go: "fluid assumes fuse components are always ready") — checkFuseHealthy() delegates to CheckAndSyncFuseStatus which unconditionally returns ready = true. This matches the approach taken for ThinEngine in #6062.

Ⅱ. Does this pull request fix one issue?

Fixes #6105

Ⅲ. List the added test cases

Added TestVineyardEngineCheckRuntimeReady in runtime_info_test.go with two cases:

  • Workers ready → returns true
  • Workers not ready → returns false

Ⅳ. Describe how to verify it

go test ./pkg/ddc/vineyard/... -run TestVineyardEngineCheckRuntimeReady -v

Ⅴ. Special notes for reviews

Same pattern and rationale as #6062 (ThinEngine fix). The only difference is VineyardEngine uses VineyardRuntime instead of ThinRuntime.

…iness

CheckRuntimeReady() was an unimplemented stub that unconditionally
returned true, causing data operations to be dispatched against a
VineyardRuntime even when workers were not ready.

Implement it using CheckWorkersReady() — the same helper used by
CheckRuntimeHealthy(). Fuse readiness is intentionally excluded because
fluid treats fuse as always-ready by design (see pkg/ctrl/fuse.go).

Also adds tests covering workers ready (returns true) and workers not
ready (returns false).

Fixes fluid-cloudnative#6105

Signed-off-by: Aditya Upasani <adityaupasani29@gmail.com>
@fluid-e2e-bot

fluid-e2e-bot Bot commented Jul 8, 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 trafalgarzzz for approval by writing /assign @trafalgarzzz 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

fluid-e2e-bot Bot commented Jul 8, 2026

Copy link
Copy Markdown

Hi @adityaupasani2. 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 implements the CheckRuntimeReady method for the VineyardEngine in pkg/ddc/vineyard/runtime_info.go, which now checks if the vineyard workers are ready instead of always returning true. It also adds corresponding unit tests in pkg/ddc/vineyard/runtime_info_test.go to verify this behavior under different worker readiness states. There are no review comments, and I have no feedback to provide.

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.

@sonarqubecloud

sonarqubecloud Bot commented Jul 8, 2026

Copy link
Copy Markdown

@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 40.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.76%. Comparing base (afca615) to head (ac717f0).

Files with missing lines Patch % Lines
pkg/ddc/vineyard/runtime_info.go 40.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6106   +/-   ##
=======================================
  Coverage   64.76%   64.76%           
=======================================
  Files         485      485           
  Lines       33895    33898    +3     
=======================================
+ Hits        21952    21955    +3     
+ Misses      10220    10219    -1     
- Partials     1723     1724    +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.

@cheyang

cheyang commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

/copilot review

func (e *VineyardEngine) CheckRuntimeReady() (ready bool) {
//TODO implement me
return true
workerReady, err := e.CheckWorkersReady()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Delegating to CheckWorkersReady means every call to CheckRuntimeReady now goes through Helper.CheckAndSyncWorkerStatus, which patches the VineyardRuntime status (worker phase, conditions, counters) whenever it changes. Every peer engine's CheckRuntimeReady is side-effect-free today: Alluxio/Jindo use fileUtils.Ready() (read-only exec), JuiceFS uses GetRunningPodsOfStatefulSet (pure list), EFC combines both without touching status. This method is called from SetDataOperationInTargetDataset before every DataLoad/DataMigrate/etc., so under load it turns a preflight check into a write path with retry-on-conflict. Is that intentional? If the goal is only readiness, consider a read-only variant (e.g. GetRunningPodsOfStatefulSet like JuiceFS) so the data-op preflight stays cheap and side-effect-free.

if err != nil {
return false
}
return workerReady

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Worth calling out: CheckWorkersReady returns true for both RuntimePhaseReady and RuntimePhasePartialReady (see pkg/ctrl/worker.go:143-151). So CheckRuntimeReady will report ready even when only a subset of Vineyard workers are up. That is consistent with how JuiceFS and CheckRuntimeHealthy treat worker readiness, but it means the docstring above is slightly optimistic ('worker availability' -> 'at least one worker replica available'). Consider tightening the comment so future readers do not assume all workers are up.

// CheckRuntimeReady checks if the VineyardRuntime is ready to serve data operations.
// Readiness is determined by worker availability. Fuse components are intentionally
// excluded because fluid treats fuse as always-ready by design (see pkg/ctrl/fuse.go).
func (e *VineyardEngine) CheckRuntimeReady() (ready bool) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Vineyard's runtime has a real master component (etcd, see master.go/CheckMasterReady) that stores object metadata, and CheckRuntimeHealthy in this same package explicitly checks master + worker + fuse in that order. Peer engines diverge on this: EFC checks master and worker; JuiceFS checks worker only; Alluxio/Jindo check master only. What's the reasoning for worker-only here? If the invariant 'workers cannot become ready until master is ready' holds in the setup path, please note that in the docstring; otherwise consider following EFC's pattern (master first, then workers) to avoid data operations racing an unhealthy master.

},
expectedReady: false,
},
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The two test cases cover ready=true and ready=false, but the if err != nil { return false } branch on line 27 of runtime_info.go is untested. A simple third case where the worker StatefulSet is absent from the fake client (or where BuildRuntimeInfo yields a helper that surfaces an error) would close the coverage gap and lock in the intended fail-closed behavior.

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] VineyardEngine.CheckRuntimeReady() always returns true without checking actual runtime state

2 participants