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

refactor(model): allow optionally passing indexes to createIndexes and cleanIndexes #12280

Merged
merged 7 commits into from
Sep 7, 2022

Conversation

AbdelrahmanHafez
Copy link
Collaborator

@AbdelrahmanHafez AbdelrahmanHafez commented Aug 15, 2022

This refactors diffIndexes to smaller functions.
Also, refactors cleanIndexes and createIndexes to accept receiving optional parameters for the indexes to drop/create. This reduces the number of listIndexes required for syncIndexes to work.

I'd like to merge this since it's in a functional state, then I'll work on fixing #12250 once I can dedicate more time to it.

@AbdelrahmanHafez AbdelrahmanHafez marked this pull request as draft August 15, 2022 22:41
@AbdelrahmanHafez AbdelrahmanHafez changed the title fix(model): make createIndexes use diffIndexes under the hood refactor(model): make createIndexes use diffIndexes under the hood Aug 23, 2022
@AbdelrahmanHafez AbdelrahmanHafez requested review from vkarpov15, IslandRhythms and Uzlopak and removed request for vkarpov15 August 23, 2022 10:04
@@ -6756,6 +6755,31 @@ describe('Model', function() {
);

});
xit('creates indexes only when they do not exist on the mongodb server (gh-12250)', async() => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is marked as pending because this is not fixed yet, the PR was initially meant to fix the issue, but it's taking longer than anticipated. So for now let's stick to the refactoring, and I'll fix it later

@AbdelrahmanHafez AbdelrahmanHafez marked this pull request as ready for review August 23, 2022 10:07
@AbdelrahmanHafez AbdelrahmanHafez changed the title refactor(model): make createIndexes use diffIndexes under the hood refactor(model): allow optionally passing indexes to createIndexes and cleanIndexes Aug 24, 2022
@AbdelrahmanHafez AbdelrahmanHafez added this to the 6.5.4 milestone Aug 29, 2022
Copy link
Collaborator

@vkarpov15 vkarpov15 left a comment

Choose a reason for hiding this comment

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

This is looking great so far, no concerns. Let me know when you think this is ready 👍

@vkarpov15 vkarpov15 modified the milestones: 6.5.4, 6.5.5 Aug 30, 2022
@AbdelrahmanHafez
Copy link
Collaborator Author

@vkarpov15
I think we can merge this as a refactor/perf improvement for now, and once I can dedicate more time to fix #12250, I'll open a new PR to fix it.

I remember one challenging part was understanding why createIndexes under syncIndexes is using ensureIndexes. I assume that since we already have the indexes toCreate from the previous step, we should utilize that explicitly, without having to rely on ensureIndexes.

What do you think?

@vkarpov15 vkarpov15 merged commit 7ccaa47 into master Sep 7, 2022
@vkarpov15 vkarpov15 deleted the gh-12250 branch September 7, 2022 02:06
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.

None yet

2 participants