-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Magento 2.4 Upgrade issue Unable to apply data patch Magento\CatalogUrlRewrite\Setup\Patch\Data\UpdateUrlKeyForProducts #29365
Comments
Hi @sunel. Thank you for your report.
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
For more details, please, review the Magento Contributor Assistant documentation. Please, add a comment to assign the issue:
🕙 You can find the schedule on the Magento Community Calendar page. 📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket. 🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel ✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel |
Wonder if this should be update on duplicate instead of insert on duplicate. |
I can confirm we are experiencing the same issue when trying to upgrade from CE 2.3.5-p2 to 2.4.0 |
I tried this with no success unfortunately. Unrecognised class error or something similar |
Can confirm issue. Upgrading from 2.3.5 to 2.4. |
Any solution, we are stuck here |
@moni921 for now you can disable and re-enable foreign key constrain ...php |
Can confirm issue. Upgrading from 2.3.5-p1 to 2.4. |
For the update to succeed all keys should be included in the query.
|
Can you provide more details? Which file are you changing? |
Hi @dharake It worked for me!! |
Thanks @vanvasten, glad it worked for you. Will try it out |
Tagging @engcom-Echo in here, since he wrote that patch, maybe he has some more useful insights and can push for a quick fix to be added to Magento 2.4.1 or a hotfix to be released if it is deemed necessary 🙂 |
Please note that this patch is not working for commerce installations. |
I reported the same problem in ticket 29805, closed due to being duplicated to this one. I am posting my solution to the issue below whilst Magento is taking time to push another update: -> Further into the problem details, I debugged the installation and can see the following in your upgrade code: Under vendor/magento/module-catalog-url-rewrite/Setup/Patch/Data/UpdateUrlKeyForProducts.php You have: Line-67 says: $result = $this->moduleDataSetup->getConnection()->fetchAll($select); This reads all details from the catalog_product_entity_varchar table, on my installation it loads over 8000 records. Then you have a foreach look that is updating the values within the array: $result[$key]['value'] = $this->urlProduct->formatUrlKey($item['value']); So far so good,... But then after the array is finished above, you are then re-inserting the same IDs into the database with the
This means that the upgrade will NEVER succeed whenever there is data in an existing version. I wonder,... have you guys tested this before launching v2.4 ? The solution is to: Please don't re-insert/update all values into the database from the array you just loaded as it causes performance problems, or upgrade too slow etc), rather, have a logic that says: $OLD = $item['value']; if ($OLD !== $NEW) I hope this helps, I posted the following: A) Exact issue In other words, the existing logic of: Read database values, The solution is to change (3) into (Update if the value change)... please remove the Insert function at the end of the Apply() function. If you require any further information, then please let me know. Kind Regards |
why "entity_id" ?? that must be "row_id". e.g.: |
Hi @engcom-Alfa @engcom-Bravo @engcom-Charlie ,
|
We had the same issue when upgrading from 2.3.4 to 2.4.1. |
I can confirm I'm also having this issue trying to upgrade from magento community 2.3.4 to 2.4.1:
|
I can also confirm that applying the patch from @ravi-chandra3197 allowed the upgrade to proceed. https://github.com/magento/magento2/pull/29804/files |
@christianbookpwood any ideas how to reproduce this issue on clean magento installation? |
The only thing that comes to mind is that, back when we upgraded to Magento 2.3.3, we had an issue with URL keys, as did a number of other people, described in this issue: #26499 -- it was still an issue when we upgraded to 2.3.4, which is the version we're currently on. We're now trying to upgrade from 2.3.4 to 2.4.1. We had applied the fix specified by that issue reporter to our version of vendor/magento/module-catalog-url-rewrite/Model/ProductUrlPathGenerator.php, and thereafter our url keys were properly updated. We had to reapply this fix when we upgraded from 2.3.3 to 2.3.4. These modules both seem to deal with Url keys, so I'm wondering if our previous fix to the ProductUrlPathGenerator.php file put our system into a state that is causing the issue with UpdateUrlKeyForProducts.php. |
I got that issue too, trying to upgrade 2.2 to 2.4.1.
|
this seems to fix it |
✅ Confirmed by @engcom-Alfa Issue Available: @engcom-Alfa, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself. |
Upgrading from 2.3.6-p1 to 2.4.2. Still got the same issue. I have created the patch using the commit here : https://github.com/ravi-chandra3197/magento2/tree/patch-29365 ` diff --git a/vendor/magento/module-catalog-url-rewrite/Setup/Patch/Data/UpdateUrlKeyForProducts.php b/vendor/magento/module-catalog-url-rewrite/Setup/Patch/Data/UpdateUrlKeyForProducts.php
|
I just noticed this fix is in the main branch but wasn't released in 2.4.2-p1 which is dissapointing |
@barbazul 2.4.2-p1 is a security-only release. That's why this change wasn't added |
For anyone who needs a ready-to-use patch file for composer patches:
|
Preconditions (*)
Steps to reproduce (*)
Expected result (*)
Actual result (*)
Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.
The text was updated successfully, but these errors were encountered: