Build each index root separately within a batch
PitfallVerified 30 Sep 2026Holds project: dftracer-utils
Pitfall. The symptom, what causes it, and the fix that was run and seen to work.
Symptom#
A first dftracer_view -d DIR read loses rows or changes counts between runs when files belong to different index roots. Reads become correct after indexes exist.
Cause#
BatchBuilder::process placed every file in a batch into one index database despite differing roots.
Fix#
Group files by index root, build each group in turn, and restore results to input order. Test at BatchBuilder level that files in different folders each land in their own index.
Evidence#
Observer inbox 5f2574cd39 reports the first-touch failure, the grouping fix and its regression test. The note does not provide an exact test command.
Also found by searching
- dftracer_view -d DIR first read loses rows, counts differ between runs until indexes exist
- why does the first indexed read of files from several directories drop data
- BatchBuilder::process puts all files of a batch in one index database despite different index roots
- counts change between runs on a fresh directory with files in different folders, index built for all in one db
- BatchBuilder::process puts every file in one index database regardless of roots
- why do reads become correct only after the indexes already exist, index root grouping