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

fix: reindex mongo error when datamodel change #2314

Merged
merged 5 commits into from
Oct 17, 2023
Merged

Conversation

AlvaroVega
Copy link
Member

@AlvaroVega
Copy link
Member Author

AlvaroVega commented Oct 16, 2023

Maybe IndexKeySpecsConflict happens when DM is changed and previous index exists with another key.
Make sense @fgalan @Madhu-NEC ?

@AlvaroVega AlvaroVega marked this pull request as ready for review October 16, 2023 08:04
@AlvaroVega AlvaroVega changed the title [WIP] have into account IndexKeySpecsConflict error have into account IndexKeySpecsConflict error Oct 16, 2023
@AlvaroVega AlvaroVega changed the title have into account IndexKeySpecsConflict error fix: reindex mongo error when datamodel change Oct 16, 2023
@AlvaroVega
Copy link
Member Author

maybe related #2291 ?

@fgalan
Copy link
Member

fgalan commented Oct 17, 2023

Maybe IndexKeySpecsConflict happens when DM is changed and previous index exists with another key. Make sense @fgalan @Madhu-NEC ?

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.

…/mongo/MongoBackendImpl.java

Co-authored-by: Fermín Galán Márquez <[email protected]>
@AlvaroVega
Copy link
Member Author

AlvaroVega commented Oct 17, 2023

Maybe IndexKeySpecsConflict happens when DM is changed and previous index exists with another key. Make sense @fgalan @Madhu-NEC ?

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.

IMHO:
IndexOptionsConflict -> when the same index (name and keys) already exits
IndexKeySpecsConflict -> when an index with the same name but different keys (i.e. DM was changed) already exist.

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.

…/mongo/MongoBackendImpl.java

Co-authored-by: Fermín Galán Márquez <[email protected]>
Copy link
Member

@fgalan fgalan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fgalan fgalan merged commit 81df32f into master Oct 17, 2023
5 checks passed
@fgalan fgalan deleted the fix/mongo_index_error branch October 17, 2023 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants