-
- What this PR does
Widens the error tolerance in the `MetricsFilteringInBackground` hook's helpers
(`src/mongo/db/modules/atlas/jstests/disagg_storage/libs/metrics_filtering_background_helpers.js`).
`isExpectedCollStatsAggregationError` becomes `isStaleNamespaceError` and now accepts
`CommandNotSupportedOnView` alongside `NamespaceNotFound`, and it is wired into
`validateCollStatsCmd` as well as `validateCollStatsAgg`.
-
- Motivation
`getRandomCollection()` picks a namespace with `listCollections(
{type: "collection"})`, then runs a
metrics command against it. Under `create_collection_and_view.js`, which deliberately recycles one
namespace between a collection and a view, the namespace can flip inside that window and the metrics
command fails with `CommandNotSupportedOnView`.
Confirmed in the BF-45672 log: the workload flipped
`test43_fsmdb0.create_collection_and_view_fsmcoll0` roughly every 3 ms, and the hook's `$collStats`
aggregate landed on it ~3 ms after the pick. The server behavior is intended — `$collStats` runs
against a view without expansion, so its `storageStats`/`count`/`queryExecStats` options hit the
`kMustBeCollection` acquisition check in `shard_role.cpp:406`;
`jstests/core/catalog/collstats/views_coll_stats.js` asserts exactly this.