Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Next] [Bug] Namespace name generated from index name is too long (127 byte max) #2491

Closed
cristiandean opened this issue Aug 20, 2019 · 3 comments

Comments

@cristiandean
Copy link
Contributor

commented Aug 20, 2019

Depending on the length of mongo's database name we could not initialize the application due to an error creating the indexes. We have the following error:

{
  "name": "coral",
  "clusterNode": "master",
  "hostname": "coral-talk-admin-qa",
  "pid": 327,
  "level": 50,
  "err": {
    "message": "namespace name generated from index name \"coral_talk_mongo_database.users.$tenantID_1_status.suspension.history.from.start_1_status.suspension.history.from.finish_1_createdAt_-1\" is too long (127 byte max)",
    "name": "MongoError",
    "stack": "Connection.<anonymous> (node_modules/mongodb-core/lib/connection/pool.js:443:61)\nConnection.emit (events.js:198:13)\nprocessMessage (node_modules/mongodb-core/lib/connection/connection.js:364:10)\nSocket.<anonymous> (node_modules/mongodb-core/lib/connection/connection.js:533:15)\nSocket.emit (events.js:198:13)\naddChunk (_stream_readable.js:288:12)\nreadableAddChunk (_stream_readable.js:269:11)\nSocket.Readable.push (_stream_readable.js:224:10)\nTCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)\n"
  },
  "msg": "can not start server in master mode",
  "time": "2019-08-20T14:24:03.131Z",
  "src": {
    "file": "/home/application/current/src/index.ts",
    "line": 69,
    "func": "error"
  },
  "v": 0
}

@wyattjoh wyattjoh added the bug label Aug 20, 2019

@wyattjoh

This comment has been minimized.

Copy link
Member

commented Aug 20, 2019

I have confirmed this issue. For the time being @cristiandean, it should be possible to reduce the length of the database name to get it to work for now.

@kgardnr kgardnr added the v5 label Aug 23, 2019

@nick-funk

This comment has been minimized.

Copy link
Contributor

commented Sep 16, 2019

@cristiandean, I've done some more investigating around this issue and have come up with a couple of solutions for you to choose from.

  1. As @wyattjoh suggested, keeping the namespace/database length short will prevent this issue from occurring.

  2. As of Mongo version 4.2, the index name length limit has been removed. Since our current setup targets Mongo 3.6, you might be missing this functionality. If you upgrade, we believe you will no longer see this index name issue.

If you want to read more, you can have a look at the official Mongo docs surrounding index length limits in Mongo 4.2 and greater:

image
(Source: https://docs.mongodb.com/manual/reference/limits/)

@nick-funk nick-funk closed this Sep 16, 2019

@cristiandean

This comment has been minimized.

Copy link
Contributor Author

commented Sep 17, 2019

@nick-funk thanks, In our case, the second option looks better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.