Repository navigation
fix(juicefs): parse mount options after the standalone -o argument - #6283
BahaaMattar wants to merge 1 commit into
Conversation
isCommandChanged compared the mount options of the current and the new fuse/worker command by splitting the command on the substring "-o" and reading the second piece. The substring also appears in the mount path (which contains the dataset name, e.g. demo-output) and in option names such as cache-partial-only, so the second piece was not the option list and a changed option (e.g. cache-size) was never detected: the configmap holding the mount script was left stale. Cut the command at the " -o " argument instead and read everything after it as the option list. Signed-off-by: Bahaa Mattar <bahaa.kmattar@gmail.com>
|
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the JuiceFS mount-option change-detection fix.
No open issues 🎉
What changed in this PR
Fixes JuiceFS mount-option change detection for dataset and option names containing -o, addressing #6282 so runtime option edits can update mount scripts and worker templates.
Changes:
- Extracts options after the space-delimited
-oargument instead of splitting on every-osubstring. - Adds three regression cases covering affected dataset names, reordered options, and option names containing
-o. - Preserves the existing option comparison and metrics-ignore behavior.
| File | Description |
|---|---|
pkg/ddc/juicefs/sync_runtime.go |
Locates mount options using the standalone -o delimiter. |
pkg/ddc/juicefs/sync_runtime_test.go |
Adds regression coverage for embedded -o and order-independent comparison. |
Review effort: Balanced
cheyang
left a comment
There was a problem hiding this comment.
Both reviewers independently reproduced issue #6282 on the merge base — with dataset demo-output or option cache-partial-only, a cache-size change yields isCommandChanged=false, so the script ConfigMap and the worker restart annotation are never updated — and both verified the fix through the real genFuseMount/genWorkerMount generators (CE and EE, fuse and worker), not hand-written strings. The " -o " cut is correct for every command the generators can emit: everything before the standalone separator is space-free, so the first occurrence is always the real one; the comparison stays order-insensitive (checked against 20 random map-iteration orders), metrics is still ignored, option removal is detected, and a controller-level test confirms the ConfigMap is rewritten and the restart annotation set. Full ./pkg/ddc/juicefs/... suite is green on the head, and there is no migration concern — the stored command format is unchanged, so the first post-upgrade reconcile compares like with like.
No blockers. The one meaningful disagreement in the debate: Claude's claim that the syncWorkerSpec command-sync lifecycle has zero test coverage was rebutted by Codex with the existing Ginkgo only command changed spec (which pins exactly the ConfigMap rewrite + restart annotation, green on base and head); only a narrow residue survives. Copilot (Reviewer C) reviewed this head and raised no findings — no third-opinion flags either way.
Next round
[MUST] (none — merge is not gated on any finding)
[SHOULD] Consider uplifting a generator round-trip test and a dash--o variant of the syncWorkerSpec lifecycle spec (templates on both verification branches); optionally switch the metrics exclusion to a parsed-key comparison (pre-existing, latent) and confirm source/mountPath-only changes are intentionally handled elsewhere (pre-existing question).
[Filed] none
Non-blocking observations (4) — not part of this round's ask; fix now, follow up, or file an issue as you see fit
- pkg/ddc/juicefs/sync_runtime.go:616 [minor] — pre-existing, not introduced by this PR — metrics exclusion matches by substring, not by option key (pre-existing)
F-metrics-substring-filter (consensus, pre-existing):strings.Contains(option, "metrics")skips any option whose key=value text merely contains the substringmetrics, not just themetricsoption itself — the same failure class this PR fixes. Latent today (no colliding option in use); worth a small follow-up comparing the parsed key (k == "metrics") instead of the raw substring. Not introduced by this PR; does not block it. - pkg/ddc/juicefs/sync_runtime.go:604 [minor] — pre-existing, not introduced by this PR — Comparison covers only the option list; source/mountPath-only changes are not detected (pre-existing question)
F-options-only-comparison (pre-existing question): the comparison covers only the option list, so a changedsourceormountPathalone produces no script update. Since both derive from the runtime's immutable namespace/name identity, realistic exposure is near-nil — could a maintainer confirm source changes are intentionally handled by another sync path? - pkg/ddc/juicefs/sync_runtime_test.go:1269 [minor] — New isCommandChanged tests hardcode command strings; a generator round-trip (and a dash-o lifecycle case) would guard against format drift
F-generator-roundtrip-tests (consensus, PR-introduced, non-blocking): the three new test cases hardcode the command line. IfgenFuseMount/genWorkerMountever change shape (options relocated, a second-oflag, config-file-based options), these tests keep passing while comparison silently breaks again. A round-trip through the real generators for a dash--odataset — plus a dash--ovariant of thesyncWorkerSpeclifecycle spec — would pin the contract end to end; both patterns are demonstrated on the verification branches (verify/pr6283-juicefs-cmd-options-claude,verify/juicefs-iscommandchanged-dash-o-codex). Suggestion only. - pkg/ddc/juicefs/sync_runtime.go:607 [nit] — Token-based -o lookup would tolerate future spacing changes (optional hardening)
F-token-parse-hardening (nit, PR-introduced, optional): splitting the command into whitespace fields and locating the exact-otoken would make the parser immune to a future generator change that varies spacing. Correctly proven unnecessary for anything the current code emits; optional hardening only.
Verified review delta
- F-metrics-substring-filter: open (preexisting)
- F-options-only-comparison: open (preexisting)
- F1-syncworker-lifecycle-coverage: refuted (preexisting)
- F-generator-roundtrip-tests: open (initial-pr)
- F-token-parse-hardening: open (initial-pr)
Code: clear. CI: success; attribution: unknown. Required CI checks still apply.



Ⅰ. Describe what this PR does
JuiceFSEngine.isCommandChangedcompares the mount options of the running fuse/worker command with the freshly generated one, so that an editedJuiceFSRuntime(for example a newcache-size) updates the mount script ConfigMap and the worker StatefulSet template.To get the options it split the command on the bare substring
-oand read the second piece. The generated command isexec /bin/mount.juicefs <source> <mountPath> -o <options>, and<mountPath>contains the dataset name, so a dataset such asdemo-outputsplits the command in the wrong place. Option names such ascache-partial-onlycontain-otoo. In those cases the second piece is not the option list, the old and new options look identical and the change is never detected.This PR cuts the command at the
-oargument (with the surrounding spaces) and reads everything after it as the option list. The rest of the comparison is unchanged.Ⅱ. Does this pull request fix one issue?
Fixes #6282
Ⅲ. List the added test cases (unit test/integration test) if any, please explain if no tests are needed.
Three cases added to
TestJuiceFSEngine_isCommandChangedinpkg/ddc/juicefs/sync_runtime_test.go:test-true-dataset-name-contains-dash-o: datasetdemo-output, onlycache-sizediffers, expects "changed".test-false-dataset-name-contains-dash-o: same dataset, same options in a different order, expects "not changed".test-true-option-name-contains-dash-o: optioncache-partial-only, onlycache-sizediffers, expects "changed".The two "changed" cases fail on master and pass with this change. The "not changed" case passes on both and guards against over-reporting.
Ⅳ. Describe how to verify it
go test -p 2 -gcflags=all=-l ./pkg/ddc/juicefs/ -run TestJuiceFSEngine_isCommandChanged -v
Ⅴ. Special notes for reviews
Only the way the option string is located changes; how each option is split into key and value, and the ignoring of the
metricsoption, are untouched. A command that has no-ostill yields an empty option set, as before.