-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Unit of Work calculates unnecessary UPDATE queries for enum properties in cascaded collections #10125
Comments
Could that be related to #10088 ? |
Possibly related, but I patched my repro locally and it's still giving the extra UPDATE queries with it applied. |
Looks to be fixed on current 2.13 dev build. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug Report
Summary
While troubleshooting performance issues in one of our Symfony 6.1 applications, we found a request where a large number of UPDATE queries were being made which were generally unrelated to the actual request, screenshot is from New Relic:
Except for the
time_sold
column (unrelated to this bug report, it's something I still need to debug), all of the changes in the UPDATE statements are touching columns that use backed enums in their mapping.After debugging, I've found that this happens when persisting an entity that includes a "cascade persist" on a collection. When the unit of work calculates the change set with one of these entities loaded, it's computing the following change for one of these enum fields:
Current behavior
Unit of Work calculates incorrect changes, causing unnecessary UPDATE statements during a transaction
How to reproduce
https://github.com/mbabker/enum-uow-bug includes the minimal reproducer I was able to build to represent this issue.
Ensuring you have
sqlite
available on your system, clone the repo and run the following commands:php app.php orm:schema-tool:create php app.php orm:schema-tool:update --force php app.php app:seed-database php app.php app:update-auction-name --auction-id=1 --name="Changed Name"
When the last command runs, it'll dump out the computed change set from the Unit of Work as well as the log records from the middleware:
Expected behavior
Changes aren't detected for unchanged enum properties, the above reproducer should have the following log output:
The text was updated successfully, but these errors were encountered: