The default timeseries index creation may be rolled back on stepdowns

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: 7.0.0, 8.1.0-rc0, 8.0.0, 8.2.0-rc0
    • Component/s: None
    • None
    • Catalog and Routing
    • ALL
    • CAR Team 2025-08-18
    • 0
    • None
    • 3
    • TBD
    • 🟦 Shard Catalog
    • None
    • None
    • None
    • None
    • None
    • None

      For timeseries collections with a metaField, we create an index on {meta: 1, time: 1} by default when creating the collection. On the replica set primary, the creation of the timeseries collection and the default index is done on a single WriteUnitOfWork,  so it is persisted atomically.

       

      However, replication to secondaries is done as two separate create & createIndexes oplog 'c' entries, which are not atomic: If a stepdown happens at the right time during collection creation, it is possible that the create entry is committed, but the createIndexes entry gets rolled back, which ultimately leaves the timeseries collection without the default {meta: 1, time: 1} index.

       

      (Note that even if the createCollection command is retried, the index is still not created, since the collection creation code returns early when it detects that the collection already exists).

              Assignee:
              Joan Bruguera Micó
              Reporter:
              Joan Bruguera Micó
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated: