Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-90714

$_internalAllCollectionStats can fail when a collection is concurrently dropped

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 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
    • 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

      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@mongodb.com Jordi Serra Torrens
            Reporter:
            jordi.serra-torrens@mongodb.com Jordi Serra Torrens
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: