[SERVER-6653] 'show collections' creates datafiles for empty databases when profile=1 Created: 31/Jul/12  Updated: 30/Sep/13  Resolved: 30/Sep/13

Status: Closed
Project: Core Server
Component/s: Storage
Affects Version/s: 2.0.6
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Stennie Steneker (Inactive) Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Operating System: ALL
Participants:

 Description   

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.


Generated at Thu Feb 08 03:12:19 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.