-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
MONGOID-5274 / MONGOID-5142 - Rework #touch with embedded documents #5045
MONGOID-5274 / MONGOID-5142 - Rework #touch with embedded documents #5045
Conversation
@p-mongo if you can help with the specs here would be greatly appreciated. |
Hi @johnnyshields , can you please update the title and description of this PR to reflect what it contains? MONGOID-5136 is already fixed. Can you also clarify whether this PR is ready for review? If it isn't it can be marked [wip] or draft. |
I've raised #5202 to point out some strange/incorrect behavior re: |
604686f
to
e5e809c
Compare
@Neilshweky please review this. |
Can you add a test for touching with grandchildren? I would like to see how this works with multiple generations of descendants. |
If I understand this correctly, your PR makes the following changes:
Would you say this is a good summary of the effective changes in this PR? I think the only backwards breaking change here would be the fact that touches are persisted immediately. Personally this doesn't bother me as a change, although release notes would have to be written about it. @p-mongo is that change okay in your opinion? |
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.
Please review my comments above.
@Neilshweky thanks for the review. Let me first respond to your summary of changes so we're on same page:
AFAIK the old code was the same. The old code has
No.
Yes. This is the primary intention of the PR.
In the new code, calling the |
Neither https://jira.mongodb.org/browse/MONGOID-5142 nor https://jira.mongodb.org/browse/MONGOID-5142 specify making touch perform an immediate write, so I would say this shouldn't be done. If you believe it is a desired behavior, @johnnyshields please feel free to create a ticket for it describing your use case for it. My thinking is that perhaps |
https://jira.mongodb.org/browse/MONGOID-5274 was the other ticket. |
@p-mongo as mentioned in comment above to Neil, I believe the existing code also performs an immediate write. See I agree that an immediate write is not desirable, however, here I intentionally tried to keep the behavior consistent. I think we should defer the write in a follow-up ticket. |
@Neilshweky I've responded to all your comments here. Please kindly resolve the comments or give further response. |
I can confirm that the current functionality on master is to persist touch operations immediately. |
@johnnyshields can you take care of this and then I'll give this another look? |
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.
Please make the testing changes mentioned above:
- multi-generational test
- third model with touch not set
Co-authored-by: Neil Shweky <[email protected]>
@Neilshweky all comments addressed. |
@Neilshweky I appreciate if you can take over this PR from here, if there are further changes needed. I have a busy few weeks ahead of me and won't be able to devote further attention for awhile. |
@comandeo I am pretty much done with my review, if you wouldn't mind taking a look here. |
Good job @johnnyshields, this really cleans up this part of the code. |
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.
Great job! 👏
Open questions/todos:
Let's do 9.0 since the repairing of
Does this PR change the default touch behavior for embedded associations?
|
@Neilshweky agreed it should be 9.0. I'm happy to help with release notes, BUT: Are we also going to change the default value to
However, if |
I would love to change the default of touch to true for embedded associations, and I will write up a proposal for it in a ticket (MONGOID-5016?)... Assume that we will be changing the default to true, so that (2) will not change... Are there any backwards breaking changes in this PR? Anything that we would need to put in the release notes? |
There are no backwards breaking changes. The release notes for the touch: true could have a line like:
Important note - There's also some ticket to remove |
@johnnyshields take a look at the last commit I made here. Turns out in one of the tests that used a |
Ah yep, great catch! Last commit is good. |
In the interest of keeping my head on straight, here are the TODOs and followup work:
|
I think this might be a good idea but we can do this as part of MONGOID-5016
This is MONGOID-5016 which I repurposed for switching the default
|
@johnnyshields even though there are no backwards breaking changes, the |
@Neilshweky your spec change adding |
I will fix it and merge when its done |
@johnnyshields specs should be green now. |
Fixes MONGOID-5142
Fixes MONGOID-5274
Correct fix for MONGOID-5136 (the previous one was non-optimal)
Replaces PR #5039 (includes specs from it, which are passing here)
Changes