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

db.dropDatabase() through mongos while a migration is happening can lead to wrong "show dbs" output

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor - P4
    • Resolution: Gone away
    • None
    • None
    • Sharding
    • None
    • repro'd on OS X 64bit and CentOS 64bit
    • ALL
    • Sharding 2019-07-01

    Description

      Steps to reproduce:

      1. Bring up a sharded cluster with at least 2 shards
      2. Insert a lot of data, such that the collection will be split and chunks migrated.
      3. Run "show dbs" (I am using the "blah2" database):

      mongos> show dbs
      admin	(empty)
      blah2	4.9052734375GB
      config	0.1875GB
      test	0.203125GB

      4. Interrupt the data load script, or wait until it completes.
      5. While a migration is happening, attempt "db.dropDatabase()" through a mongos
      5.a. The first time I tried this, I got:

      mongos> db.dropDatabase()
      {
      	"assertion" : "collection's metadata is undergoing changes. Please try again.",
      	"assertionCode" : 13331,
      	"errmsg" : "db assertion failure",
      	"ok" : 0
      }

      5.b. I immediately retried and got:

      mongos> db.dropDatabase()
      {
      	"assertion" : "shard state missing for blah2.foo",
      	"assertionCode" : 10176,
      	"errmsg" : "db assertion failure",
      	"ok" : 0
      }

      5.c. The third try worked:

      mongos> db.dropDatabase()
      { "dropped" : "blah2", "ok" : 1 }

      6. Run "show dbs" again:

      mongos> show dbs
      admin	(empty)
      blah2	5.951171875GB
      config	0.1875GB
      test	0.203125GB

      7. Verify that data files are missing for all shards (in my case they were)
      8. Insert new data with "db.bar.insert(

      {hello: "world"}

      )"
      9. Run "show dbs" again

      mongos> show dbs
      admin	(empty)
      blah2	6.154296875GB
      config	0.1875GB
      test	0.203125GB

      Expected output:

      • In step 6, "blah2" database should not show up
      • In step 9, "blah2" database should not be so large (one would expect it to be 2GB on disk)

      Attachments

        Activity

          People

            kaloian.manassiev@mongodb.com Kaloian Manassiev
            dcrosta Daniel Crosta
            Votes:
            9 Vote for this issue
            Watchers:
            20 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: