$_internalAllCollectionStats can fail when a collection is concurrently dropped

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 8.1.0-rc0
    • Affects Version/s: 6.0.3, 7.0.0, 8.0.0-rc0
    • Component/s: None
    • None
    • Catalog and Routing
    • Fully Compatible
    • ALL
    • v8.0, v7.0, v6.0
    • Hide

      db.foo1.insert({});
      db.foo2.insert({});
      db.foo3.insert({});

      const cursor = db.getSiblingDB("admin").aggregate(
      [{
      $_internalAllCollectionStats:
      {stats: {storageStats: {}, queryExecStats: {}, latencyStats: {}}}
      }],
      {cursor: {batchSize: 2}});

      cursor.next();
      db.foo3.drop();
      cursor.itcount();

      Show
      db.foo1.insert({}); db.foo2.insert({}); db.foo3.insert({}); const cursor = db.getSiblingDB("admin").aggregate( [{ $_internalAllCollectionStats: {stats: {storageStats: {}, queryExecStats: {}, latencyStats: {}}} }], {cursor: {batchSize: 2}}); cursor.next(); db.foo3.drop(); cursor.itcount();
    • CAR Team 2024-05-27
    • 0
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      DocumentSourceInternalAllCollectionStats first retrieves a list of existing collections from the catalog and next it iterates over them to get the collection stats for each one. If a collection that gets put in the list is dropped before the stage iterates over it, then the whole aggregation will fail with NamespaceNotFound.

      Instead, this no longer existent collection should just be skipped.

            Assignee:
            Jordi Serra Torrens
            Reporter:
            Jordi Serra Torrens
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: