Ray's Knowledge Base

The query cache lives beside the index in .dftindex-cache, not inside .dftindex

DecisionVerified 27 Sep 2026Holds project: dftracer-utils
Decision. The context, the choice, why, and the options that were turned down.

Context#

Stage 10b (query-cache, 2026-09-27) moved rollups and materialized views out of the index. Rollups went to their own RocksDB at .dftindex-cache/rollups, and views to .dftindex-cache/views/<slug>, both in the folder that holds the index. rollup_root and views_root override the places. Each store is capped by DFTRACER_CACHE_MAX_BYTES (default 2G, read on every call) and drops its least recently used entries.

Decision#

Keep the cache next to the index folder, never inside it. The directory scanner skips every folder whose name starts with .dftindex, so it skips the cache too.

Why#

The first design put the cache in <index_root>/cache/. Then a view materialize on a trace with no index failed with ENOENT: metadata_collector found a .dftindex folder that held only cache/, took it for a broken index, and ran remove_all on it while the view was being written. An index rebuild or an outdated-format reset deletes the whole index root, so anything inside it dies with it.

Rejected options#

  • <index_root>/cache/: see Why.

Evidence#

  • Commit e8bc6ad on feat/extensible-index.
  • tests/trace/views/test_query_cache.cpp checks the place, that deleting .dftindex-cache changes no result, and the LRU order.