-
-
Notifications
You must be signed in to change notification settings - Fork 598
Added an error code for geospatial index failures #1342
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1342 +/- ##
=======================================
Coverage 99.94% 99.94%
=======================================
Files 60 60
Lines 5847 5848 +1
Branches 1311 1311
=======================================
+ Hits 5844 5845 +1
Misses 3 3
Continue to review full report at Codecov.
|
Thanks for this PR! Can you please just add a line above as to what the purpose of this PR is and which error scenarios this new error code should cover? This will make it easier for future investigations. Did you take a look whether there are any existing error codes that could cover this error and if so, which ones would be the closest related? |
I have expanded the PR description with the purpose and the scenarios the error code would cover. Looking at
|
Thanks for the details. In my understanding, the errors can occur in two scenarios:
I guess we can look at this on multiple levels:
Your suggested The errors (b) and (c) are more generic and therefore maybe more likely to be reusable for other scenarios. But if you think a specific error makes more sense, then we may as well go with (a) or (d). The names above are only suggestions of course. What would you choose? |
I agree with the scenarios you have mentioned, but I don't think the second one is relevant to Parse, because index creation is beyond its capabilities (please correct me if I am mistaken). Peeking into the Mongo source, the error they internally use for invalid geometry, as far as I have seen, is BadValue, but this changes into a 16755 before making it to the client. INVALID_VALUE makes sense to me, and seems reusable. We can probably pass-through the error message returned by Mongo. One disadvantage I can think of is that this would make it difficult to programmatically find out which field had an invalid value (and why), but this doesn't sound interesting either. |
That is indeed possible, see docs.
Maybe index (and for that matter schema) setup is something one wouldn't usually do during runtime or if so, most errors would likely require manual resolving, so differentiation may not be that important.
Sounds good! |
The CI tests failed, which is interesting because this patch doesn't really change anything. I can't reproduce the error locally, though I do occasionally get different, seemingly random errors. Any ideas? |
Possibly flaky tests, I restarted the tests. I think @dplewis is more familiar with flakiness in the JS SDK, can you confirm? Maybe we should make a list of flaky tests like we have in Parse Server.
Edit: tests passed now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! To be sure I double checked availability of error code 162, because that is currently not easy to find out.
See parse-community/parse-server#7331
This PR adds a new error code for geospatial index failures. MongoDB returns the error codes 16755/16756 if one tries to create an object on a collection with a geospatial index (such as
2dsphere
) but MongoDB fails to index the object, perhaps because the geojson is invalid or the index does not support the given geometry.