{"record":{"id":"a81fb3415745524a","repo":"juicedata/juicefs","slug":"scan-global-user-group-usage-v","errorCode":null,"errorMessage":"scan global user group usage: %v","messagePattern":"scan global user group usage: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/meta/quota.go","lineNumber":706,"sourceCode":"\t\treturn wrapErr(st)\n\t}\n\n\t_, err := m.en.doSetQuota(ctx, DirQuotaType, uint64(ino), &Quota{\n\t\tUsedSpace:  int64(sum.Size) - align4K(0),\n\t\tUsedInodes: int64(sum.Dirs+sum.Files) - 1,\n\t\tMaxSpace:   -1,\n\t\tMaxInodes:  -1,\n\t})\n\tif err != nil {\n\t\treturn wrapErr(err)\n\t}\n\treturn nil\n}\n\nfunc (m *baseMeta) ScanUserGroupUsage(ctx Context) error {\n\tuserUsage, groupUsage, err := m.scanGlobalUserGroupUsage(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"scan global user group usage: %v\", err)\n\t}\n\n\tvar userQuotasSnapshot map[uint64]*Quota\n\tvar groupQuotasSnapshot map[uint64]*Quota\n\n\tm.quotaMu.Lock()\n\t// Reset user and group quotas\n\tm.userQuotas = make(map[uint64]*Quota)\n\tm.groupQuotas = make(map[uint64]*Quota)\n\tfor uid, usage := range userUsage {\n\t\tm.userQuotas[uid] = &Quota{\n\t\t\tMaxSpace:   -1,\n\t\t\tMaxInodes:  -1,\n\t\t\tUsedSpace:  int64(usage.Size),\n\t\t\tUsedInodes: int64(usage.Files),\n\t\t}\n\t}\n\tfor gid, usage := range groupUsage {","sourceCodeStart":688,"sourceCodeEnd":724,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/meta/quota.go#L688-L724","documentation":"ScanUserGroupUsage first aggregates global per-user and per-group usage via scanGlobalUserGroupUsage; if that scan fails, the error is wrapped with this prefix. This runs during quota operations that need user/group usage data (e.g. quota set with strict checks, loadDumpedQuotas).","triggerScenarios":"The underlying engine scan over usage keys fails — e.g. Redis/SQL/KV backend errors, timeouts, or connection loss while iterating global user/group usage entries.","commonSituations":"Redis or SQL metadata engine temporarily unreachable or slow during a quota operation on a large volume; network blip between client and metadata backend; backend returning partial/corrupt quota usage records.","solutions":["Retry the operation; transient backend errors often resolve on a second attempt.","Check connectivity and health of the metadata engine (redis-cli ping / database logs).","Inspect the wrapped inner error (%v suffix) for the root cause and address it specifically.","Increase client timeouts or reduce concurrent load if the scan times out on large volumes."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"redis-cli -u \"$META_URL\" ping  # verify metadata engine reachable first","typeGuard":null,"tryCatchPattern":"for i in 1 2 3; do\n  if err=$(juicefs quota set ... 2>&1); then break; fi\n  sleep $((i*5))\ndone","preventionTips":["Monitor metadata engine health and latency before quota operations.","Add retry with backoff for quota operations on large volumes.","Read the wrapped inner error to address the root backend failure."],"tags":["quota","scan","metadata-backend"],"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-14T00:17:10.932Z"}