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

A crash after dropDatabase leaves the server unable to restart

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 3.0.5
    • Component/s: MMAPv1
    • None
    • Storage Execution
    • ALL
    • Hide
      • Start a mongod using MMAPv1
      • create a database and drop it:
        > db.getSiblingDB('victim')['dummy'].insert( {i:0}

        )
        WriteResult(

        { "nInserted" : 1 }

        )
        > db.getSiblingDB('victim').dropDatabase()

        { "dropped" : "victim", "ok" : 1 }
      • `kill -9` the `mongod` process to simulate a crash
      • restart `mongod` on the same dbpath. You will observe:

      2015-07-31T22:40:06.247+0000 W - [initandlisten] Detected unclean shutdown - /tmp/mongo3/mongod.lock is not empty.
      2015-07-31T22:40:06.252+0000 I STORAGE [initandlisten] **************
      old lock file: /tmp/mongo3/mongod.lock. probably means unclean shutdown,
      but there are no journal files to recover.
      this is likely human error or filesystem corruption.
      please make sure that your journal directory is mounted.
      found 2 dbs.
      see: http://dochub.mongodb.org/core/repair for more information
      *************

      Show
      Start a mongod using MMAPv1 create a database and drop it: > db.getSiblingDB('victim') ['dummy'] .insert( {i:0} ) WriteResult( { "nInserted" : 1 } ) > db.getSiblingDB('victim').dropDatabase() { "dropped" : "victim", "ok" : 1 } `kill -9` the `mongod` process to simulate a crash restart `mongod` on the same dbpath. You will observe: 2015-07-31T22:40:06.247+0000 W - [initandlisten] Detected unclean shutdown - /tmp/mongo3/mongod.lock is not empty. 2015-07-31T22:40:06.252+0000 I STORAGE [initandlisten] ************** old lock file: /tmp/mongo3/mongod.lock. probably means unclean shutdown, but there are no journal files to recover. this is likely human error or filesystem corruption. please make sure that your journal directory is mounted. found 2 dbs. see: http://dochub.mongodb.org/core/repair for more information *************

      dropDatabase syncs and truncates the journal, which can result in there being no journal files on disk.

      If the database crashes after dropDatabase and before any subsequent write operations (which would re-create the journal), on following startup, `mongod` will observe a `mongod.lock`, and no journal files, and assume that a non-journalled `mongod` crashed, and that the dbpath needs repair, even though it is in a completely consistent state thanks to the `sync`.

      We encounter this periodically on developer machines, since our application test suite drops databases after it runs, and it's not uncommon for a developer's mongod to see no other write traffic outside of tests.

            Assignee:
            backlog-server-execution [DO NOT USE] Backlog - Storage Execution Team
            Reporter:
            nelhage Nelson Elhage
            Votes:
            0 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: