Forbid reIndex command on viewless timeseries collections

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Catalog and Routing
    • ALL
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      In MongoDB 8.0, timeseries collections are implemented as views over system.buckets collections. The reIndex command handler rejects calls on a timeseries namespace with CommandNotSupportedOnView — "can't re-index a view" — via the view check in CmdReIndex::run. This is the correct behavior.

      In MongoDB 9.0, timeseries collections are no longer views (viewless). As a result, the view check no longer fires, and reIndex silently succeeds on a standalone instance targeting a timeseries namespace. This is unintended: reIndex has no meaningful semantics on timeseries collections and should be explicitly forbidden.

      Root cause

      CmdReIndex::run guards against views via a CommandNotSupportedOnView uassert. With viewless timeseries (FCV >= 9.0), the collection is no longer a view, so the guard is silently bypassed.

      Proposed fix

      Add an explicit check in CmdReIndex::run that returns CommandNotSupported when the target namespace is a timeseries collection, regardless of FCV.

      Testing

      There are currently no jstests covering reIndex behavior on timeseries collections. A new test should verify:

      • Standalone, FCV >= 9.0: reIndex on a timeseries namespace fails with CommandNotSupported
      • Standalone, FCV < 9.0: reIndex on a timeseries namespace fails with CommandNotSupportedOnView (existing behavior, unchanged)
      • Replica set: fails with IllegalOperation (unchanged)
      • Sharded cluster: CommandNotFound from mongos (unchanged)

            Assignee:
            Tommaso Tocci
            Reporter:
            Tommaso Tocci
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: