-
Notifications
You must be signed in to change notification settings - Fork 265
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
[BUG] when is exceeded the index key limit in mongo #1289
Comments
Interesting ... |
service path should also be included |
What if the restriction for 1024 is implemented in the mongoUpdateContext.cpp ? |
Pros:
Cons:
|
Ok, now I check mongoCommonUpdate.cpp in line 2027, the error is captured here in createEntity function. I can use it? |
It seem that the code has "moved" in develop branch (is no longer pointing inside createEntity method)... so I'm not sure of the reference. Hint: to get "inmutable" references, use a commits in the develop branch instead of the develop branch itself (which point to HEAD commit), e.g.
|
I pull the latest commit, compile and test with the case posted by iariasleon and surprise! it works... can anybody confirm this? |
@fortizc |
@iariasleon |
@kzangeli what should be the constant value? |
Actually, the formula should be:
Not sure about "some-constant". I guess that it depends on how much additional space it used in the embedded document identified by _id (i.e. @iariasleon , have your test bring some light about which value "some-constant" could take? |
While we get the right answer, in order not be blocked, I'd suggest to assume a reasonable large value for "some-constant". Maybe 100 is a good heuristic (100 is around 10% of max lenght 1024). |
I think, first is to define the behaviour, see #1283 |
Just to clarify things: #1283 is related with the lengths of the indivitual fields id, type and servicePath. Unfortunatelly, we don't have such information (the decission is a functional requirement and the development team -i.e. us- don't have the ownership to define such requirement). Good news are that we don't need solving #1283 to solve this (#1289) issue. Otherwise, we would be blocked! This (#1289) only needs to define a limit in the sum of the field. The limit should be:
We don't know the value of C (question at http://stackoverflow.com/questions/33377441/mongodb-check-length-when-using-embedded-documents-for-id-index is about trying to find it). In abcense of an answer, we have to do some guessing. I think that C = 100 is a good guessing, but if you have another suggestion, please go ahead. If after reading this explantion is not 100% clear how this (#1289) has to be solved, please contact me at skype. |
According to #1286 "rules" for NGSIv2 errors, I'd say that this case should be:
Don't forget to include a .test to cover the case! ;) |
Pull request sent |
Fixed in PR #1441. @iariasleon please have a look and close it if you find correct. |
LGTM
|
How do I figure out programatically (if possible) that the insertion I'm going to perform will throw this error? |
In postEntities.cpp, the function legalEntityLength determines if the total is too long:
|
Thanks. |
Maybe we should put the rule in the documentation (although I'm not sure in which section...) |
At the end "Known limitations" seems to be a good candidate section in the documentation. Fixed in PR #1899 |
the index key limit in mongo is 1024, see issue #1283
if
type
orid
exceed index key limit ,CB responds 201 and nothing is stored in mongo.Request:
Response
Log
The text was updated successfully, but these errors were encountered: