[SERVER-19416] Executing "dbStats" fails: "exception: need a valid database name" (3.0 Server, 2.13 Java driver) Created: 15/Jul/15 Updated: 15/Jul/15 Resolved: 15/Jul/15 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Diagnostics |
| Affects Version/s: | 3.0.4 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Jan S. | Assignee: | Sam Kleinman (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Operating System: | Windows | |||||||||
| Steps To Reproduce: |
Output:
|
|||||||||
| Participants: |
| Description |
|
The combination mongo-java-driver-2.13.2 & MongoDB server 3.0.2/3.0.4 causes the dbStats command to fail: com.mongodb.CommandFailureException: { "serverUsed" : "127.0.0.1:27017" , "errmsg" : "exception: need a valid database name" , "code" : 28539 , "ok" : 0.0}END The same code works for a MongoDB 2.x server using the same driver. |
| Comments |
| Comment by Jeffrey Yemin [ 15/Jul/15 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Jan, The error message is confusing, but the root of the problem is an incorrectly created dbstats command. It should be:
as documented here. It seems that starting with 3.0 the server is less permissive in this situation. Regards, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jan S. [ 15/Jul/15 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
For non-existing databases I agree. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sam Kleinman (Inactive) [ 15/Jul/15 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Thanks so much for this report, I've looked into this some more and found that the mongod produces this error when it attempts to get a lock on a database that either doesn't exist or does not exist and doesn't have data. I was able to observe the effect reported here saw and reproduce the error you got in 3.0.4 using the shell (including the 2.6.10 shell); however, from looking at the implementation of dbStats for 2.6.10, it looks like previous versions handled requests for dbStats on databases that didn't exist differently. Consider the following: For 3.0.4:
In 2.6.10 I got different results:
The newer behavior seems to make more sense from the perspective of the server, although it might make sense for the client to handle this situation differently. |