-
Notifications
You must be signed in to change notification settings - Fork 104
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
fix: reindex mongo error when datamodel change #2314
Conversation
Maybe IndexKeySpecsConflict happens when DM is changed and previous index exists with another key. |
maybe related #2291 ? |
It seems the code was already prepared for re-indexing. I understand that it was not working until you have added the IndexKeySpecsConflict exception to the catch clause. Maybe in the past (i.e. old versions of MongoDB or the driver) the exception was IndexOptionsConflict so it was working that time but not now? In this case, I think the strategy of adding the new exception (IndexKeySpecsConflict) is a good idea. |
cygnus-common/src/main/java/com/telefonica/iot/cygnus/backends/mongo/MongoBackendImpl.java
Outdated
Show resolved
Hide resolved
…/mongo/MongoBackendImpl.java Co-authored-by: Fermín Galán Márquez <[email protected]>
IMHO: Anyway, this kind of check is weak, since a change of mongo driver literals would hide these conflicts. It would be nice to relay on generic index conflict by mongo. |
cygnus-common/src/main/java/com/telefonica/iot/cygnus/backends/mongo/MongoBackendImpl.java
Show resolved
Hide resolved
…/mongo/MongoBackendImpl.java Co-authored-by: Fermín Galán Márquez <[email protected]>
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
Related with PR #2211
https://www.mongodb.com/docs/manual/reference/method/db.collection.createIndex/