cubelet: add diagnostic context to newExt4RawByReflinkCopy errors#237
cubelet: add diagnostic context to newExt4RawByReflinkCopy errors#237WaylandYang wants to merge 1 commit into
Conversation
|
/cubebot review |
|
Claude finished @fslongjin's task in 3m 23s —— View job Code Review
Overall: This is a clean, well-structured change that adds valuable diagnostic context to an otherwise opaque error path. The design choices (suffix approach, single-line format, best-effort stats) are all sound. Below are my findings. Positive
Issues1. No unit tests for the new helpers (should fix) The three new unexported helpers ( 2. Deferred error path missing diagnostics (minor, consider) At err = fmt.Errorf("newExt4RawByReflinkCopy failed:%s", err)If all commands succeed but the post-validation check fails, the error is still opaque. This is a different failure mode (not a command failure), so it may warrant different diagnostics, but as-is it's inconsistent with the new command-failure path. Consider appending at least target file stats here too, or adding a comment explaining why it's omitted. 3. The PR description notes the format is "single line" so log pipelines don't split it. However, 4. In SummaryThe change is well-designed and ready to ship with one recommended addition: unit tests for the new helpers (issue #1). The other items are minor observations for potential follow-up. |
Implements proposal (2) from TencentCloud#235. On failure the error now appends step index, the failing argv, elapsed time, target/base file stats, and free space: newExt4RawByReflinkCopy failed:<stderr> [step=3/4 cmd="e2fsck -fy ..." elapsed=812ms target=size=... base=size=... free=...B] Diagnostic is a suffix on the existing prefix so any string-matching caller is unaffected. Stat/statfs errors are reported inline rather than failing the diagnostic. Adds unit tests for describeStorageFailure / describeFile / describeFreeBytes covering the missing-file, empty-path, valid-stat, statfs-error, and full-format-output cases. Signed-off-by: Wayland Yang <wayland0916@gmail.com>
f5c4c69 to
0fd59e9
Compare
Implements proposal (2) from #235.
What it does
When
newExt4RawByReflinkCopyfails, the returned error now appends a single-line diagnostic suffix:Fields: command index (1-of-N), the failing argv, elapsed time, target/base file stats (size or "missing"), and free bytes on the target's volume.
Format choices
"newExt4RawByReflinkCopy failed:<stderr>"prefix.\ndon't separate the diagnostic from the underlying error.stat/statfserrors are reported inline ("stat err=<msg>") instead of failing the diagnostic itself; the caller already has a real error to return.Out of scope (deliberately)
newExt4BaseRawandnewExt4RawByCopyhave the same opaque-error shape and would benefit from the samedescribeStorageFailurehelper, but the issue namednewExt4RawByReflinkCopyspecifically. Happy to extend to the other two in a follow-up if you'd like.Tested
go vet ./storage/...— cleango build ./storage/...— cleangofmt -l— cleanRelated
newExt4RawByReflinkCopyfails with "bad magic number in superblock" under N=100 concurrent spawn #235cmdTimeout): storage: make cmdTimeout configurable via plugin config #236