From 1b62514321851c78f72520450f7a4a18e2189518 Mon Sep 17 00:00:00 2001 From: wine93 Date: Fri, 14 Aug 2026 16:29:05 +0800 Subject: [PATCH] [fix][fs] Fix warmup query hanging after warmup has finished The query loop only stopped when the client reported total == 0. The client keeps a finished task's status readable for kFinishedStatusTtl (10 minutes) and reports the completed snapshot for that whole window, so total only drops to 0 long after the warmup itself is done. This stalled the progress bar at 100% for a full 10 minutes on every `dingo fs warmup add` without --daemon. Break once every block is accounted for (finished + errors >= total), which is the real completion signal, and keep the total == 0 case for when the client has already dropped the status. Update the progress bar before breaking so it ends at 100%. Also correct the result format in a comment and an error message: the client emits [total/finished/errors], not [finished/total/errors] (the parsing was already using the correct order). --- cli/command/fs/warmup/query.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/cli/command/fs/warmup/query.go b/cli/command/fs/warmup/query.go index f218f8a..d6d4f1a 100644 --- a/cli/command/fs/warmup/query.go +++ b/cli/command/fs/warmup/query.go @@ -114,12 +114,22 @@ func runQuery(cmd *cobra.Command, dingocli *cli.DingoCli, options queryOptions) } logger.Infof("warmup result: total[%d], finished[%d], errors[%d]", total, finished, warmErrors) - if total == 0 { //finished + + // The client keeps a finished task's status readable for several + // minutes, so total only drops to 0 long after the warmup itself is + // done. Waiting for that would stall the progress bar at 100% until + // the status expires; every block being accounted for is the real + // completion signal. + if total == 0 { // status already dropped by the client break } bar.Set64(finished + warmErrors) + if finished+warmErrors >= total { // all blocks accounted for + break + } + time.Sleep(200 * time.Millisecond) } @@ -133,7 +143,7 @@ func runQuery(cmd *cobra.Command, dingocli *cli.DingoCli, options queryOptions) } func getWarmupProgress(path string) (int64, int64, int64, error) { - // result data format [finished/total/errors] + // result data format [total/finished/errors] logger.Infof("get warmup xattr") result, err := xattr.Get(path, DINGOFS_WARMUP_OP_XATTR) if err != nil { @@ -144,7 +154,7 @@ func getWarmupProgress(path string) (int64, int64, int64, error) { logger.Infof("warmup xattr: [%s],[total/finished/errors]", resultStr) strs := strings.Split(resultStr, "/") if len(strs) != 3 { - return 0, 0, 0, fmt.Errorf("response data format error, should be [finished/total/errors]") + return 0, 0, 0, fmt.Errorf("response data format error, should be [total/finished/errors]") } total, err := strconv.ParseInt(strs[0], 10, 64) if err != nil {