Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-12980

Investigate changes in SERVER-33272: The DatabaseHolder::close() function no longer requires a global write lock and neither does the dropDatabase command.

      Description

      Downstream Change Summary

      In addition to the work done above, the `dropDatabase` command no longer requires a global exclusive lock but instead only needs a database exclusive lock to drop a database.

      Old Description of Linked Ticket (SERVER ticket split and the old description is for SERVER-43925 and will be doc'ed separately)

      Currently, the kv engine does not check to see if a database is empty after a collection drop. Thus, empty databases can persist until mongod restarts (or the catalog is reloaded via replication rollback to stable timestamp). This situation is usually benign, but a database entry's presence does do one thing: it enforces that no other databases that are spelled the same but differ in capitalization can be created.
      Because recover-to-timestamp exists, it can result in some replica set nodes having a catalog entry for an empty database while other nodes do not have such an entry. This can result in the ability to crash secondary nodes that have an empty database entry that a primary node does not have – by attempting to create a database with a different case than the existing empty database entry.

      To fix this, we can check to see if a database is empty (i.e., no collection entries remain in the catalog) after a collection drop. If it is indeed empty, we can attempt to close the database by locking it in X mode and calling DatabaseHolder::close().

      Scope of changes

      Impact to Other Docs

      MVP (Work and Date)

      Resources (Scope or Design Docs, Invision, etc.)

            Assignee:
            kay.kim@mongodb.com Kay Kim (Inactive)
            Reporter:
            backlog-server-pm Backlog - Core Eng Program Management Team
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              4 years, 19 weeks ago