{"record":{"id":"58349a0ac0585016","repo":"dgraph-io/badger","slug":"errfilltables","errorCode":"errFillTables","errorMessage":"Unable to fill tables","messagePattern":"Unable to fill tables","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"info","filePath":"levels.go","lineNumber":1601,"sourceCode":"\tif cd.thisLevel.level != 0 && len(newTables) > 2*s.kv.opt.LevelSizeMultiplier {\n\t\ts.kv.opt.Infof(\"This Range (numTables: %d)\\nLeft:\\n%s\\nRight:\\n%s\\n\",\n\t\t\tlen(cd.top), hex.Dump(cd.thisRange.left), hex.Dump(cd.thisRange.right))\n\t\ts.kv.opt.Infof(\"Next Range (numTables: %d)\\nLeft:\\n%s\\nRight:\\n%s\\n\",\n\t\t\tlen(cd.bot), hex.Dump(cd.nextRange.left), hex.Dump(cd.nextRange.right))\n\t}\n\treturn nil\n}\n\nfunc tablesToString(tables []*table.Table) []string {\n\tvar res []string\n\tfor _, t := range tables {\n\t\tres = append(res, fmt.Sprintf(\"%05d\", t.ID()))\n\t}\n\tres = append(res, \".\")\n\treturn res\n}\n\nvar errFillTables = errors.New(\"Unable to fill tables\")\n\n// doCompact picks some table on level l and compacts it away to the next level.\nfunc (s *levelsController) doCompact(id int, p compactionPriority) error {\n\tl := p.level\n\ty.AssertTrue(l < s.kv.opt.MaxLevels) // Sanity check.\n\tif p.t.baseLevel == 0 {\n\t\tp.t = s.levelTargets()\n\t}\n\n\t_, span := otel.Tracer(\"\").Start(context.TODO(), \"Badger.Compaction\")\n\tdefer span.End()\n\n\tcd := compactDef{\n\t\tcompactorId:  id,\n\t\tp:            p,\n\t\tt:            p.t,\n\t\tthisLevel:    s.levels[l],\n\t\tdropPrefixes: p.dropPrefixes,","sourceCodeStart":1583,"sourceCodeEnd":1619,"githubUrl":"https://github.com/dgraph-io/badger/blob/2a001d466f6b71a917319a1db41f99860e16e269/levels.go#L1583-L1619","documentation":"errFillTables is a sentinel error returned by doCompact when it cannot pick tables for a compaction — meaning there may be enough tables queued but a def could not be built (e.g. target level busy or no candidates). Badger treats it as benign: callers explicitly ignore it and do not report it to end users.","triggerScenarios":"doCompact runs (automatically or induced, e.g. db.go:635's level:0/score:1.73 trigger) and runCompactDef/fillTables returns without building a compaction def; also observed via close() path per the declaration.","commonSituations":"Normal operation when compaction candidates are transiently unavailable; heavy write load delaying compaction; induced test compactions that find nothing to do.","solutions":["Nothing needed — this is expected flow control; do not log it as an error","If compactions never progress, check level sizes/badger info output and options (NumLevelZeroTables, baseLevelSize)","Match on the sentinel with errors.Is if you drive compaction manually"],"exampleFix":"// before\nif err := db.lc.doCompact(173, p); err != nil {\n    return err // wrongly surfaces benign errFillTables\n}\n// after\nif err := db.lc.doCompact(173, p); err != nil {\n    if errors.Is(err, errFillTables) {\n        return nil // benign: nothing to compact right now\n    }\n    return err\n}","handlingStrategy":"try-catch","validationCode":"// Go: treat errFillTables as success when driving compactions manually\nif err := db.lc.doCompact(id, p); errors.Is(err, errFillTables) { /* nothing to do */ }","typeGuard":null,"tryCatchPattern":"// Go\nswitch err := db.lc.doCompact(id, p); {\ncase err == nil:\n    // compacted\ncase errors.Is(err, errFillTables):\n    // benign: no tables could be filled; do not report to users\ndefault:\n    log.Printf(\"compaction failed: %v\", err)\n}","preventionTips":["Always special-case errFillTables as benign (mirroring badger's own callers at db.go:635 and levels.go:516)","Do not alert/retry aggressively on this sentinel","If it repeats constantly, inspect level sizes and compaction options","Use errors.Is rather than string comparison for the sentinel"],"tags":["compaction","sentinel-error","benign"],"backgroundTag":"unable-to-fill-tables","analyzedSha":"2a001d466f6b71a917319a1db41f99860e16e269","analyzedAt":"2026-09-05T13:00:02.264Z","contentChangedAt":"2026-09-05T13:00:02.264Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}