Inconsistent error messages when database name is too long

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Cannot Reproduce
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Usability
    • Fully Compatible
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      When trying to access a database with a name longer than allowed, error messages are inconsistent depending on the exact length of the database name.

      A database name that is shorter than 64 characters is handled correctly.
      A database name that is exactly 64 characters will return a 10032 message: db name too long
      A database name that is longer than 64 characters will return a 13280 message: invalid db name

      > use AVeryLongDatabaseNameThatIsAVeryLongDatabaseNameWithExact64Chars
      switched to db AVeryLongDatabaseNameThatIsAVeryLongDatabaseNameWithExact64Chars
      > show collections
      Wed Aug 22 14:30:25 uncaught exception: error:

      { "$err" : "db name too long", "code" : 10032 }

      > use AVeryLongDatabaseNameThatIsAVeryLongDatabaseNameWithEven1MoreChar
      switched to db AVeryLongDatabaseNameThatIsAVeryLongDatabaseNameWithEven1MoreChar
      > show collections
      Wed Aug 22 14:31:59 uncaught exception: error: {
      "$err" : "invalid db name: AVeryLongDatabaseNameThatIsAVeryLongDatabaseNameWithEven1MoreChar.system.namespaces",
      "code" : 13280

      Looking at the source code, it seems that the checks at /src/mongo/db/database.cpp:71 and /src/mongo/db/namespacestring.h:99 are inconsistent in handling database names of exactly 64 characters. I'd say the preferred message in both error cases is the 10032 (db name too long) message, since it's more descriptive.

            Assignee:
            Samantha Ritter (Inactive)
            Reporter:
            Mark van Cuijk
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: