'show collections' creates datafiles for empty databases when profile=1

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: 2.0.6
    • Component/s: Storage
    • None
    • ALL
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      If you have profile=1 set, an unexpected side effect in 2.0.6 is that `show collections` will cause the datafiles to be created.

      Minimal test case to reproduce:

      mongod --profile=1
      

      Then in MongoDB shell:

      > use phantom
      > show collections
      

      Verbose logging from mongod when `show collections` command is run:

      Tue Jul 31 12:46:16 [conn1] runQuery called phantom.system.namespaces {}
      Tue Jul 31 12:46:16 [conn1] Accessing: phantom for the first time
      Tue Jul 31 12:46:16 [FileAllocator] allocating new datafile ./phantom.ns, filling with zeroes...
      Tue Jul 31 12:46:16 [FileAllocator] done allocating datafile ./phantom.ns, size: 16MB,  took 0.019 secs
      Tue Jul 31 12:46:16 [conn1]    used cursor: 0x101619610
      Tue Jul 31 12:46:16 [conn1] query phantom.system.namespaces reslen:20 0ms
      Tue Jul 31 12:46:16 [conn1] runQuery called admin.$cmd { serverStatus: 1.0 }
      Tue Jul 31 12:46:16 [conn1] run command admin.$cmd { serverStatus: 1.0 }
      Tue Jul 31 12:46:16 [conn1] command admin.$cmd command: { serverStatus: 1.0 } ntoreturn:1 reslen:1287 0ms
      Tue Jul 31 12:46:16 [conn1] runQuery called admin.$cmd { serverStatus: 1.0 }
      Tue Jul 31 12:46:16 [conn1] run command admin.$cmd { serverStatus: 1.0 }
      Tue Jul 31 12:46:16 [conn1] command admin.$cmd command: { serverStatus: 1.0 } ntoreturn:1 reslen:1287 0ms
      Tue Jul 31 12:46:16 [conn1] runQuery called phantom.$cmd { isMaster: 1.0 }
      Tue Jul 31 12:46:16 [conn1] run command phantom.$cmd { isMaster: 1.0 }
      Tue Jul 31 12:46:16 [conn1] command phantom.$cmd command: { isMaster: 1.0 } ntoreturn:1 reslen:71 0ms
      

      NB: I was unable to reproduce this in 2.2.0rc0.

            Assignee:
            Unassigned
            Reporter:
            Stennie Steneker (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: