storage: make cmdTimeout configurable via plugin config#236
Conversation
187928c to
98cab76
Compare
|
/cubebot review |
|
Claude finished @fslongjin's task in 3m 11s —— View job PR Review: storage: make cmdTimeout configurable via plugin config
Overall: The approach is clean and minimal — a Bug:
|
| if l.config.ReconcileInterval == 0 { | ||
| l.config.ReconcileInterval = tomlext.FromStdTime(5 * time.Minute) | ||
| } | ||
| if l.config.CmdTimeout == 0 { |
There was a problem hiding this comment.
I think it would be more appropriate to move this initialization code to the InitFn in plugin.go
There was a problem hiding this comment.
Thanks @hlz260 — good catch, same ordering issue cubebot flagged. Pushed an update that moves cmdTimeout init into InitFn before checkPoolType, plus a non-negative guard and the comment cleanup cubebot also suggested. PTAL.
Implements proposal (1) from TencentCloud#235. Adds an optional `cmd_timeout` field to the storage plugin's TOML config. When unset, the existing 3 s default is preserved — no behavior change. Multi-GiB ext4 ops on the live-create slow path can need longer than 3 s under concurrent load; this knob lets operators raise it without recompiling. Example: [plugins."io.cubelet.internal.v1.storage"] cmd_timeout = "30s" Signed-off-by: Wayland Yang <wayland0916@gmail.com>
98cab76 to
b40deec
Compare
Implements proposal (1) from #235.
Adds a new optional
cmd_timeoutfield to the storage plugin's TOML config. When unset (or zero) the existing 3 s default is preserved exactly — no behavior change for current deployments.Motivation
shell.go'scp / truncate / e2fsck / resize2fs / mkfs.ext4chain shares a single 3 s timeout per command. On the pre-formatted pool fast path the small images comfortably finish inside 3 s. On the live-create slow path (writable_layer_sizethat doesn't matchpool_default_format_size_list), 3 s on multi-GiB images is tight under concurrent load — that's the contention window where the reflink-copy race in #235 surfaces.Letting operators raise the per-command timeout from config is the smallest knob that lets the live-create path survive without recompiling cubelet.
Config example
What's deliberately not changed
cp, slowere2fsck) is doable but expands scope; happy to do as a follow-up PR if you'd like.shell.go'scmdTimeoutis nowvarinstead ofconst, set during(*local).init. Other styles (passing timeout into each function, plumbing through acontext) are also options; this matches the existing package-level state in this package (localStorage,defaultPoolSize, ...).Out-of-scope observations
shell.go's three create-image functions (newExt4BaseRaw,newExt4RawByCopy,newExt4RawByReflinkCopy) all swallow stderr into a short string error without command index / file stat / elapsed time. Proposal (2) from Cubelet/storage:newExt4RawByReflinkCopyfails with "bad magic number in superblock" under N=100 concurrent spawn #235 covers that — separate PR coming, keeping this one focused.Tested
go vet ./storage/...— cleango build ./storage/...— cleangofmt -l— clean