-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Tools
-
None
-
Storage Engines - Foundations
-
38.179
-
None
-
None
Background
The dist/s_stat validation script complains about unused statistics fields. It extracts the field list from the generated struct in src/include/stat.h and searches for literal references to each field in the sources, skipping stat.c (which lists all fields by definition).
Problem
Two gaps let unused statistics fields through unnoticed:
- The extraction pattern ^ int64_t ([a-z_]*);$ does not accept digits, so every histogram bucket field (lt2, lt5, lt10, gt1000, …) is never extracted into the check list at all.
- The histogram increment macros reference fields by token pasting (stat##_lt10), which literal matching cannot see. Fields populated only through those macros have to be excused manually in the UNUSED_STAT_FIELDS exclusion list, and a bucket declared in stat_data.py but never written by a macro (the subject of WT-17991) goes undetected.
Proposed change
- Accept digits in the field-name extraction ([a-z0-9_]).
- Treat a field as used if it ends with one of the ##-pasted suffixes found in stat.h and its base name appears literally in the sources.
- Drop the perf_hist_total entries from the exclusion list — the suffix logic now detects their use on its own merits.
- Add the numeric compress_read_ratio_hist_ / compress_write_ratio_hist_ fields to the exclusion list — they are referenced literally, but only inside stat.h itself, which cannot join the search corpus without matching every struct declaration.
Verification
- Against an unfixed develop tree, the script exits 1 and flags exactly the ten never-populated bucket fields of WT-17991: {{perf_hist_
{bmread,bmwrite,fsread,fswrite}
latency
{lt2,lt5}}} and {{live_restore_hist_source_read_latency_{lt2,lt5}}}.
- With the WT-17991 macro fix applied, the script exits 0.
Definition of done
- dist/s_stat change as described; cd dist && ./s_stat passes on the fixed tree and fails with a useful message on unfixed develop.
- is related to
-
WT-17991 Fix WT millisecond histogram statistics
-
- In Code Review
-