-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: Layered Tables
-
Storage Engines - Foundations
-
355.843
-
None
-
None
Problem
Opening a statistics cursor on a layered table created while the step-down timestamp was set returns ENOENT instead of reporting statistics. Both statistics:layered:<name> and statistics:table:<name> are affected. An application call such as MongoDB reporting collection storage size receives the error directly.
The failure has stayed hidden because the statistics log server discards ENOENT and WT_NOTFOUND from __wt_curstat_open, and no existing test opens a per-table statistics cursor on a table created inside the step-down window.
Root Cause
A leader with the step-down timestamp set skips creating the stable constituent in __create_layered, leaving the table without a file:<name>.wt_stable metadata row until a later step-up creates one. The rest of the layered code accounts for this shape via WT_LAYERED_TABLE_STEP_DOWN_CREATED, routing operations to the ingest constituent.
_curstat_layered_init does not. Its stable branch forks on the leader flag alone. A follower tolerates a missing stable entry by reading size from checkpoint metadata. A leader falls through to wt_session_get_dhandle on the stable URI, where _wt_conn_dhandle_open converts the metadata miss from WT_NOTFOUND to ENOENT.
For statistics:table:<name>, the statistics=(size) fast path also fails: the stable metadata is absent, the fallback to file:<name>.wt finds nothing because the column group source is layered:<name> rather than a plain file, and the slow path then fails with the same ENOENT.