[SERVER-25557] String with length of 64 can be used as a Database name, but we can't do anything with that database Created: 11/Aug/16  Updated: 04/Apr/23  Resolved: 17/Aug/16

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

Type: Bug Priority: Minor - P4
Reporter: Aravind Kumar Assignee: Kyle Suarez
Resolution: Done Votes: 0
Labels: pull-request
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu 64 bit


Attachments: JPEG File Screenshot from 2016-08-11 16-24-16.jpg    
Backwards Compatibility: Fully Compatible
Operating System: Linux
Participants:

 Description   

When creating a database name of length 64, the database gets created.
But I can't able to do any kind operations with that database.



 Comments   
Comment by Kyle Suarez [ 17/Aug/16 ]

Thanks aravindkumarsvg, the fix has been committed to master. And thank you to bjori for the pull request!

Comment by Githook User [ 17/Aug/16 ]

Author:

{u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}

Message: SERVER-25557 Database names must be less than 64 bytes

Closes #1108

Signed-off-by: Kyle Suarez <kyle.suarez@mongodb.com>
Branch: master
https://github.com/mongodb/mongo/commit/0badd5ad405743848c74ca0011cb0bc76613cf77

Comment by Ramon Fernandez Marina [ 17/Aug/16 ]

Thanks for reporting this behavior aravindkumarsvg, we're exploring a fix. Please continue to watch this ticket for updates.

Comment by Aravind Kumar [ 17/Aug/16 ]

WriteResult({
"writeError" :

{ "code" : 28636, "errmsg" : "Database parsed in OP_COMMAND message must be between1 and 63 bytes. Got: asdfhjkgfhaksdjgfkajhsdfgkajhsdfgkashjdfgakshjdfgkasdhjfgasdjhkf" }

})

In the above error message, its clearly shown that the database name should be between 1 to 63. But MongoDB is allowing me to enter 64 length database name with which I cant able to do nothing.

Comment by Hannes Magnusson [ 11/Aug/16 ]

Guess there is an off by one there some where:

> use asdfhjkgfhaksdjgfkajhsdfgkajhsdfgkashjdfgakshjdfgkasdhjfgasdjhkf
switched to db asdfhjkgfhaksdjgfkajhsdfgkajhsdfgkashjdfgakshjdfgkasdhjfgasdjhkf
> show dbs
local  0.000GB
test   0.000GB
> db.foo.insert({})
WriteResult({
        "writeError" : {
                "code" : 28636,
                "errmsg" : "Database parsed in OP_COMMAND message must be between1 and 63 bytes. Got: asdfhjkgfhaksdjgfkajhsdfgkajhsdfgkashjdfgakshjdfgkasdhjfgasdjhkf"
        }
})
> use asdfhjkgfhaksdjgfkajhsdfgkajhsdfgkashjdfgakshjdfgkasdhjfgasdjhkfj
2016-08-11T07:11:44.504-0700 E QUERY    [thread1] Error: [asdfhjkgfhaksdjgfkajhsdfgkajhsdfgkashjdfgakshjdfgkasdhjfgasdjhkfj] is not a valid database name :
Mongo.prototype.getDB@src/mongo/shell/mongo.js:56:12
shellHelper.use@src/mongo/shell/utils.js:620:10
shellHelper@src/mongo/shell/utils.js:607:15
@(shellhelp2):1:1

Generated at Thu Feb 08 04:09:32 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.