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

Optimized nested collections deletion in DocumentPersister #1880

Merged
merged 8 commits into from
Dec 20, 2018

Conversation

watari
Copy link
Contributor

@watari watari commented Oct 19, 2018

Implemented CollectionPersister::deleteAll method for simultaneous deletion of collections that is belong to one document.

Q A
Type improvement
BC Break no
Fixed issues

Summary

Improved removal of scheduled for removal collections. Now all collections that is belong to one parent is deleted in one query.

…letion of collections that is belong to one document.
…eduled for update - now nested collections for one parent is updated inside one query where it was possible.
@watari
Copy link
Contributor Author

watari commented Oct 24, 2018

@alcaeus , PR was updated by changes from #1882

Copy link
Member

@alcaeus alcaeus left a comment

Choose a reason for hiding this comment

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

Sorry for the delay, but here's a first code review. @malarzm you've previously spent some time working on collection updates when you implemented the atomic strategies, do you think the test cases are sufficient to guard against mishaps or do we want to add some more?

@watari
Copy link
Contributor Author

watari commented Nov 19, 2018

@alcaeus , @malarzm , is there will be any other remarks about PR? All previous remarks is already implemented.

@alcaeus
Copy link
Member

alcaeus commented Nov 25, 2018

Just waiting on Feedback by @malarzm on whether we need additional test cases. Please bear with us - both of us currently don't have a whole lot of free time to dedicate to OSS.

Copy link
Member

@malarzm malarzm left a comment

Choose a reason for hiding this comment

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

About review: I've left few remarks about things that stood out while reading. That most probably won't be all, but methods can be simplified and I'd rather take another look then. Also I think the PR is changing too much comparing to original scope.

About tests: from what I remember from implementing atomic strategies the most problematic things were related with my first hacky implementation so nothing from the top of my head (beside subpaths which are already handled). Although the only added tests here are checking deletions while logic for updating collections also changed and that should be thoroughly tested. Or better yet, those changes should be moved to different PR as it's out of scope of original intentions. Also given you're optimizing flow you should add assertions about number of queries fired to actually update the document, otherwise it'll be easy to lose optimizations. For a hint that take a look at this test here: https://github.com/doctrine/mongodb-odm/blob/master/tests/Doctrine/ODM/MongoDB/Tests/Functional/AtomicSetTest.php

Edit: I crossed out saying about PR is too broad as I've just found out it's two merged into one and that was actually asked by us so we can't change this back and forth :)

@watari
Copy link
Contributor Author

watari commented Nov 27, 2018

At the current moment I implemented remarks, leave comments and ask some questions. Later on this week, I add required tests.

…queries where it is required. Added missing tests for checking simultaneous embed-many collections updates under different storage strategies.
… to update/delete methods of CollectionPersister.
@watari
Copy link
Contributor Author

watari commented Nov 30, 2018

@alcaeus , signatures and logic of update/delete methods was updated as you suggested. This changes is in last commit.
@malarzm , I added missing tests and query count assertions for CollectionPersister.

@alcaeus
Copy link
Member

alcaeus commented Dec 20, 2018

Thanks @watari!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants