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

dropDatabase may complete without emitting an op entry when the node performing the operation gets restarted mid-request

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 4.4.0, 5.0.0, 6.0.0, 7.0.0, 8.0.0-rc0, 7.3.0, 8.1.0-rc0
    • Component/s: None
    • None
    • Catalog and Routing
    • ALL
    • CAR Team 2024-06-24, CAR Team 2024-07-08, CAR Team 2024-07-22, CAR Team 2024-08-05, CAR Team 2024-08-19, CAR Team 2024-09-02, CAR Team 2024-09-16, CAR Team 2024-09-30
    • 2

      Consider the following sequence:

      1. A client requests a dropDatabase(dbName) to a sharded cluster
      2. The DDL request is served by the primary shard, until the point on which all the collections under dbName get removed from the local catalog; secondary nodes replicate the collection removals;
      3. Before reaching the stage on which the dropDatabase op entry is written onto the oplog, the primary shard receives a shutdown (for restart) signal, so that the DDL is interrupted;
      4. Upon restart, the newly spawned process is elected as the RS primary
      5. As part of the initialisation routine, the newly spawned process fills up its DatabaseHolder (the in-memory cache of existing database names, according to the collection names retrieved from the local catalog): due to step 2, dbName is no longer present;

      When the sharding DDL coordinator resumes the execution of dropDatabase(dbName), the absence of dbName from DatabaseHolder causes the function in charge of executing step 1 to early exit, skipping the instruction to generate the op entry about the completion of the DDL on the local node.

        1. protocol.png
          protocol.png
          125 kB
        2. problem.png
          problem.png
          86 kB
        3. solution 2.png
          solution 2.png
          119 kB
        4. solution 1.png
          solution 1.png
          106 kB

            Assignee:
            antonio.fuschetto@mongodb.com Antonio Fuschetto
            Reporter:
            paolo.polato@mongodb.com Paolo Polato
            Votes:
            0 Vote for this issue
            Watchers:
            14 Start watching this issue

              Created:
              Updated:
              Resolved: