-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Unable to create case insensitive email index #6465
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
Comments
I'm also using WT 3.6. According to the manual, for versions < 4.2 there is a limit of 1024 bytes for an index entry. Presumably, index entries for case insensitive indexes are larger than for case sensitive. For MongoDB versions greater than 4.2, there is no limit. My assumption is that you have at least one extraordinarily large entry. The error message indicates that the entry is 1157 char. The max size for an email address is supposed to be between 250 - 360 char depending on who you ask, so I tried this:
|
@acinader You were right! I removed some extra-long strings and was able to create the indices manually, without upgrading Parse Server to 4.x:
Did I read the code correctly, that these indices are not parse-server/src/Controllers/DatabaseController.js Lines 1816 to 1824 in 5c79189
|
Whew! glad to hear it. We just made your data a little better ;). Yes, you are correct. The case sensitive unique index remains and is important. The case
Q. So why add the case insensitive index at all? A. In order to prevent duplicate case insensitive username clashes (for example Manuel and manuel), we need to validate each new username (or email). We don't need an index to do this, but without an index, the check would require a full table scan and that would be expensive on large user tables. |
Makes sense! And yes, thanks, this did indeed lead to a data clean-up on our side 👍 |
Issue Description
Upgrading to parse server 3.10.0 to 4.1.0 fails with this error message:
warn: Unable to create case insensitive email index: WiredTigerIndex::insert: key too large to index, failing 1157 { ... }
The indices on
username
andemail
both fail to create with the same error message.Steps to reproduce
Expected Results
Indices should create.
Actual Outcome
Indices fail to create.
Environment Setup
Server
Database
Logs/Trace
mongoDB log:
2020-03-05T01:03:07.605+0000 I COMMAND [conn356038] command my-database.$cmd command: createIndexes { createIndexes: "_User", indexes: [ { name: "case_insensitive_username", key: { username: 1 }, background: true, sparse: true, collation: { locale: "en_US", strength: 2 } } ], writeConcern: { w: "majority" }, lsid: { id: UUID("xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx") }, $clusterTime: { clusterTime: Timestamp(1583370186, 29), signature: { hash: BinData(0, 123456789), keyId: 123456789 } }, $db: "my-database" } exception: WiredTigerIndex::insert: key too large to index, failing 1157 { : "..." } code:KeyTooLong numYields:574 reslen:419 locks:{ Global: { acquireCount: { r: 576, w: 576 } }, Database: { acquireCount: { w: 577, W: 2 }, acquireWaitCount: { W: 2 }, timeAcquiringMicros: { W: 16745 } }, Collection: { acquireCount: { w: 576 } } } protocol:op_msg 1475ms
The text was updated successfully, but these errors were encountered: