mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-10-31 01:10:41 +01:00
Add weed/parquet_pushdown/footer/cache.go: a concurrent LRU keyed by the Identity tuple (Path, SizeBytes, RecordCount, ETag) the design specifies in Index Consistency. Mtime is intentionally absent. Notable behavior: - size <= 0 is rejected at construction so a misconfiguration cannot silently disable caching by sizing the LRU to zero. - Hits / misses are tracked atomically and surfaced via Stats() so the service handler can stamp PushdownStats.footer_cache_hits / footer_cache_misses. - GetOrLoad is a non-singleflight load helper. Concurrent loads for the same identity may both call the loader; that's an acceptable starting point given footer parses are millisecond-scale. Singleflight is deferred until profiling shows it matters. Tests cover: zero-size rejected, hit/miss counters, identity is a composite key (same path, different size = different entry), LRU evicts above cap, GetOrLoad caches the result and dedupes subsequent calls, errors propagate without inserting, and the cache is safe under concurrent readers (-race).