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

Can't drop a database in sharded environment

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.6.8
    • Component/s: Sharding, Storage
    • None
    • Environment:
      EC2 hosts. Ubuntu
    • Linux
    • Hide

      ubuntu@ReportingService-use1b-01:~$ mongo
      MongoDB shell version: 2.6.8
      connecting to: test

      mongos> show dbs
      admin (empty)
      config 0.234GB
      ...
      reportsCore 367.407GB
      reportsGeo 15.946GB
      reportsOps 193.492GB
      reportsRaw 309.711GB
      reportsSites 2200.512GB
      test 0.203GB
      ...

      mongos> use reportsRaw
      switched to db reportsRaw

      mongos> db.dropDatabase()

      { "dropped" : "reportsRaw", "ok" : 1 }

      mongos> show dbs
      admin (empty)
      config 0.234GB
      ...
      reportsCore 367.407GB
      reportsGeo 15.946GB
      reportsOps 193.492GB
      reportsRaw 309.711GB
      reportsSites 2200.512GB
      test 0.203GB
      ...

      mongos> use reportsRaw
      switched to db reportsRaw

      mongos> show collections
      mongos>

      The 1st shard PRIMARY host file system (reportsRaw files disappeared):

      ubuntu@ReportingDB-use1b-01:~$ ls -l /data/mongo/SH01/reportsRaw*
      ls: cannot access /data/mongo/SH01/reportsRaw*: No such file or directory
      ubuntu@ReportingDB-use1b-01:~$

      The 4th shard PRIMARY host file system (reportsRaw files are still here):

      ubuntu@ReportingDB-use1b-04:~$ ls -l /data/mongo/SH04/reportsRaw*
      rw------ 1 mongodb mongodb 67108864 Jul 16 2014 /data/mongo/SH04/reportsRaw.0
      rw------ 1 mongodb mongodb 134217728 Jul 16 2014 /data/mongo/SH04/reportsRaw.1
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.10
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.11
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.12
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.13
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.14
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.15
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.16
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.17
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.18
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.19
      rw------ 1 mongodb mongodb 268435456 Jul 16 2014 /data/mongo/SH04/reportsRaw.2
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.20
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.21
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.22
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.23
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.24
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.25
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.26
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.27
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.28
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.29
      rw------ 1 mongodb mongodb 536870912 Jul 16 2014 /data/mongo/SH04/reportsRaw.3
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.30
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.31
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.32
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.33
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.34
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.35
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.36
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.37
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.38
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.39
      rw------ 1 mongodb mongodb 1073741824 Jul 16 2014 /data/mongo/SH04/reportsRaw.4
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.40
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.41
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.42
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.43
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.44
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.5
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.6
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.7
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.8
      rw------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.9
      rw------ 1 mongodb mongodb 16777216 Jul 16 2014 /data/mongo/SH04/reportsRaw.ns
      ubuntu@ReportingDB-use1b-04:~$

      Show
      ubuntu@ReportingService-use1b-01:~$ mongo MongoDB shell version: 2.6.8 connecting to: test mongos> show dbs admin (empty) config 0.234GB ... reportsCore 367.407GB reportsGeo 15.946GB reportsOps 193.492GB reportsRaw 309.711GB reportsSites 2200.512GB test 0.203GB ... mongos> use reportsRaw switched to db reportsRaw mongos> db.dropDatabase() { "dropped" : "reportsRaw", "ok" : 1 } mongos> show dbs admin (empty) config 0.234GB ... reportsCore 367.407GB reportsGeo 15.946GB reportsOps 193.492GB reportsRaw 309.711GB reportsSites 2200.512GB test 0.203GB ... mongos> use reportsRaw switched to db reportsRaw mongos> show collections mongos> The 1st shard PRIMARY host file system (reportsRaw files disappeared): ubuntu@ReportingDB-use1b-01:~$ ls -l /data/mongo/SH01/reportsRaw* ls: cannot access /data/mongo/SH01/reportsRaw*: No such file or directory ubuntu@ReportingDB-use1b-01:~$ The 4th shard PRIMARY host file system (reportsRaw files are still here): ubuntu@ReportingDB-use1b-04:~$ ls -l /data/mongo/SH04/reportsRaw* rw ------ 1 mongodb mongodb 67108864 Jul 16 2014 /data/mongo/SH04/reportsRaw.0 rw ------ 1 mongodb mongodb 134217728 Jul 16 2014 /data/mongo/SH04/reportsRaw.1 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.10 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.11 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.12 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.13 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.14 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.15 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.16 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.17 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.18 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.19 rw ------ 1 mongodb mongodb 268435456 Jul 16 2014 /data/mongo/SH04/reportsRaw.2 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.20 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.21 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.22 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.23 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.24 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.25 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.26 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.27 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.28 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.29 rw ------ 1 mongodb mongodb 536870912 Jul 16 2014 /data/mongo/SH04/reportsRaw.3 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.30 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.31 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.32 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.33 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.34 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.35 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.36 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.37 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.38 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.39 rw ------ 1 mongodb mongodb 1073741824 Jul 16 2014 /data/mongo/SH04/reportsRaw.4 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.40 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.41 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.42 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.43 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.44 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.5 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.6 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.7 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.8 rw ------ 1 mongodb mongodb 2146435072 Jul 16 2014 /data/mongo/SH04/reportsRaw.9 rw ------ 1 mongodb mongodb 16777216 Jul 16 2014 /data/mongo/SH04/reportsRaw.ns ubuntu@ReportingDB-use1b-04:~$

      We have production DB - 9 shards x 3 hosts in each.
      I tried to drop a database that we don't need anymore. After the db.dropDatabase() command I'm still seeing the database in show dbs command output with no collections in it. Also the database files were removed only from few DB hosts but not from all of them.

            Assignee:
            Unassigned Unassigned
            Reporter:
            vladimir.poluyaktov Vladimir Poluyaktov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: