listDatabases may return wrong empty/size fields with concurrent DDL operations

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: 7.0.0, 8.0.0, 8.3.0, 9.0.0
    • Component/s: None
    • None
    • Catalog and Routing
    • ALL
    • 2
    • 馃煢 Shard Catalog
    • None
    • None
    • None
    • None
    • None
    • None

      Since SERVER-90893 the listDatabases command reads the list of databases consistent to an storage snapshot, so databases created by concurrent DDLs are listed.

      However the empty and size response fields聽are computed from in-memory state, which may be inconsistent (stale) compared to the storage snapshot.

      So for example a single atomic TXN may create the database and insert data to it, yet listDatabases may report it as:

      {name: "newdb", sizeOnDisk: 0, empty: true}

      In the worst case if a client filters listDatabases by {empty: false}, it may miss a database like in SERVER-90893.

      listDatabases should acquire a single storage snapshot and compute those fields using the snapshot-aware catalog APIs (e.g. establishConsistentCollections instead of the current CollectionCatalog::range - see SERVER-122240 for information).

            Assignee:
            Unassigned
            Reporter:
            Joan Bruguera Mic贸
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: