[12.0] Port base_exception fixes (locks, memory) - #1648
Merged
OCA-git-bot merged 2 commits intoOct 16, 2019
Merged
Conversation
guewen
force-pushed
the
12.0-base_exception-concurrent-errors
branch
from
August 14, 2019 13:45
382a792 to
8dc7b7f
Compare
florian-dacosta
approved these changes
Aug 14, 2019
florian-dacosta
suggested changes
Aug 21, 2019
florian-dacosta
left a comment
Contributor
There was a problem hiding this comment.
I actually approved too fast.
iteritems does not exist anymore in python 3
yvaucher
reviewed
Sep 5, 2019
guewen
commented
Sep 6, 2019
This recently added feature is counter intuitive, error prone and is already causing bugs in sale_workflow.
The goal of the modified method is to create or remove the relationship (in the M2m relation tabel) between the tested model (such as sale_order) and the exception rules. When the ORM writes on ExceptionRule.sale_ids (using the example of sale_exception), it will first proceeds with these updates: * an UPDATE on exception_rule to set the write_date * INSERT or DELETE on the relation table * but then, as "write" is called on the exception rule, the ORM will trigger the api.depends to recompute all the "main_exception_ids" of the records (sales, ...) related to it, leading to an UPDATE for each sale order We end up with RowExclusiveLock on such records: * All the records of the relation table added / deleted for the current sale order * All the records of exception_rule matching the current sale order * All the records of sale_order related to the exception rules matching the current sale order The first one is expected, the next 2 are not. We can remove the lock on the exception_rule table by removing `_log_access`, however in any case, the main_exception_ids computed field will continue to lock many sale orders, effectively preventing 2 sales orders with the same exception to be confirmed at the same time. Reversing the write by writing on SaleOrder instead of ExceptionRule fixes the 2 unexpected locks. It should not result in more queries: the "to remove" part generates a DELETE on the relation table for the rule to remove and the "to add" part generates an INSERT for the rule to add, both will be exactly the same in both cases. Related to OCA#1642 Replaces OCA#1638
guewen
force-pushed
the
12.0-base_exception-concurrent-errors
branch
from
October 14, 2019 12:52
3c372a2 to
43def64
Compare
Member
Author
|
Squashed and rebased |
yvaucher
approved these changes
Oct 16, 2019
Member
|
/ocabot merge patch |
Contributor
|
On my way to merge this fine PR! |
OCA-git-bot
added a commit
that referenced
this pull request
Oct 16, 2019
Contributor
|
Congratulations, your PR was merged at 62eec9e. Thanks a lot for contributing to OCA. ❤️ |
SiesslPhillip
pushed a commit
to grueneerde/OCA-server-tools
that referenced
this pull request
Nov 20, 2024
Syncing from upstream OCA/server-tools (18.0)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Port of:
Description on #1642
The commit messages and links above explain the issues.