{"record":{"id":"9ff2d1a36e56eed1","repo":"juicedata/juicefs","slug":"get-dirusedinodeskey-err-w","errorCode":null,"errorMessage":"get dirUsedInodesKey err: %w","messagePattern":"get dirUsedInodesKey err: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/meta/redis_bak.go","lineNumber":440,"sourceCode":"\tif err != nil {\n\t\treturn fmt.Errorf(\"get dirDataLengthKey err: %w\", err)\n\t}\n\tfor k, v := range vals {\n\t\tinode, err := strconv.ParseUint(k, 10, 64)\n\t\tif err != nil {\n\t\t\tlogger.Warnf(\"parse length stat inode: %s: %v\", k, err)\n\t\t\tcontinue\n\t\t}\n\t\tlength, _ := strconv.ParseInt(v, 10, 64)\n\t\tstats[Ino(inode)] = &pb.Stat{\n\t\t\tInode:      inode,\n\t\t\tDataLength: length,\n\t\t}\n\t}\n\n\tvals, err = m.rdb.HGetAll(ctx, m.dirUsedInodesKey()).Result()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"get dirUsedInodesKey err: %w\", err)\n\t}\n\tfor k, v := range vals {\n\t\tinode, err := strconv.ParseUint(k, 10, 64)\n\t\tif err != nil {\n\t\t\tlogger.Warnf(\"parse inodes stat inode: %s: %v\", k, err)\n\t\t\tcontinue\n\t\t}\n\t\tinodes, _ := strconv.ParseInt(v, 10, 64)\n\t\tif q, ok := stats[Ino(inode)]; !ok {\n\t\t\tlogger.Warnf(\"stat for used inodes not found: %d\", inode)\n\t\t} else {\n\t\t\tq.UsedInodes = inodes\n\t\t}\n\t}\n\n\tvals, err = m.rdb.HGetAll(ctx, m.dirUsedSpaceKey()).Result()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"get dirUsedSpaceKey err: %w\", err)","sourceCodeStart":422,"sourceCodeEnd":458,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/meta/redis_bak.go#L422-L458","documentation":"Wrapped by dumpDirStat in redis_bak.go:440 when HGetAll on dirUsedInodesKey() (per-directory used-inode counts) fails during a dump. It follows the data-length step, so it typically indicates a transient Redis failure mid-dump rather than a key that is missing — the error is on the HGetAll call itself, not the hash contents.","triggerScenarios":"Running `juicefs dump` when the second HGetAll (dir used-inodes hash) returns an error after the data-length hash was read fine — failover, connection reset, timeout.","commonSituations":"Redis primary failover between commands; load balancer idly dropping the connection mid-dump; memory/timeout limits on very large dirstat datasets.","solutions":["Check the wrapped Redis error and address connectivity/stability, then re-dump.","Enable TCP keepalives / raise client timeouts so long dumps are not dropped.","Retry the dump and discard the partial output file.","If failovers are frequent, dump from a stable primary or take a Redis backup (SAVE/BGSAVE) and dump the snapshot."],"exampleFix":"// keep connection alive during long dumps\njuicefs dump \"redis://primary:6379/1\" out.json  # run over stable network, retry on failover","handlingStrategy":"retry","validationCode":"redis-cli -h primary -p 6379 ping && redis-cli -h primary -p 6379 hlen <dirUsedInodesKey>","typeGuard":null,"tryCatchPattern":"if err := dumpDirStat(...); err != nil {\n    if strings.Contains(err.Error(), \"dirUsedInodesKey\") {\n        // transient failure between hashes: back off and retry the full dump\n    }\n    return err\n}","preventionTips":["Avoid dumping through idle-timeout load balancers; keep connections alive.","Retry after any failover — this step follows earlier successful reads.","Raise client timeouts when dirstat datasets are large.","Discard partial output files between retries."],"tags":["redis","dump","dirstat","hgetall"],"backgroundTag":"database-query-failed","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}