magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.56k stars 9.32k forks source link

Unable to apply data patch Magento\Catalog\Setup\Patch\Data\UpdateMultiselectAttributesBackendTypes #36412

Closed seo-master closed 1 year ago

seo-master commented 2 years ago

Preconditions and environment

Steps to reproduce

  1. Composer upgrade from 2.4.3 to 2.4.5
  2. php bin/magento setup:upgrade

Expected result

  1. Successful upgrade

Actual result

Module 'Magento_EavGraphQl': Module 'Magento_Search': Module 'Magento_CatalogImportExport': Module 'Magento_Catalog': Enabling caches: Current status: layout: 1 block_html: 1 full_page: 1 Unable to apply data patch Magento\Catalog\Setup\Patch\Data\UpdateMultiselectAttributesBackendTypes for module Magento_Catalog. Original exception message: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '510-142-0' for key 'catalog_product_entity_text.CATALOG_PRODUCT_ENTITY_TEXT_ENTITY_ID_ATTRIBUTE_ID_STORE_ID', query was: INSERT INTO catalog_product_entity_text (value_id,attribute_id,store_id,entity_id,value) VALUES (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?, ?), (?, ?, ?, ?,

Additional information

I have removed all multiselect attributes from all attribute sets, after that magento has upgraded successfully.

Release note

No response

Triage and priority

m2-assistant[bot] commented 2 years ago

Hi @seo-master. Thank you for your report. To speed up processing of this issue, make sure that you provided the following information:

Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, review the Magento Contributor Assistant documentation.

Add a comment to assign the issue: @magento I am working on this

To learn more about issue processing workflow, refer to the Code Contributions.


:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

m2-assistant[bot] commented 2 years ago

Hi @engcom-Lima. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

jsdupuis commented 2 years ago

Getting the same error when upgrading from Magento 2.4.2 -> 2.4.4 (Open Source)

jsdupuis commented 2 years ago

I managed to fix the problem by manually deleting rows in catalog_product_entity_text.

All the rows that are fully identical between catalog_product_entity_varchar and catalog_product_entity_text need to be deleted in the later one. Then run setup:upgrade and all the multiselect attributes will be copied from varchar to text.

The pain is to compare the data of both tables. Not an SQL expert so had to use concatenate and vlookups in Excel.

m2-assistant[bot] commented 1 year ago

Hi @engcom-November. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

engcom-November commented 1 year ago

Hi @seo-master , Thank you for reporting and collaboration. Verified the issue by upgrading from 2.4.3 to 2.4.5 with below steps but could not reproduce the issue. Steps performed:

  1. Installed Magento 2.4.3 Project-community-edition using composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition=2.4.3
  2. Created categories and few products with attributes.
  3. Upgraded to Magento 2.4.5 Project-community-edition as per Upgrade guide 4.php bin/magento setup:upgrade No issue: Upgrade successful. Both Admin login and frontend are working fine Kindly check Magento system requirements and if any 3rd party modules / extensions enabled. Elaborate steps if the issue is still reproducible. Thank you.
jsdupuis commented 1 year ago

If I may add a theory: our Magento installation was migrated from Magento 1 to Magento 2 all the way to 2.4.4. I believe that multiselect attributes used to be stored as text, then they were migrated to be varchar on a subsequent version, then finally back to be stored as text in 2.4.4. Which explains duplicate entries in CATALOG_PRODUCT_ENTITY_TEXT and CATALOG_PRODUCT_ENTITY_VARCHAR. This issue might not affect brand new installations, only ones that have gone through multiple upgrades.

engcom-November commented 1 year ago

Hi @jsdupuis , Verified the issue again with below steps performed but unable to reproduce the issue. Unable to install Magento 1.x version. Installed Magento 2.3.7 Project-community-edition and upgraded to Magento 2.4.2. Upgraded Magento instance again to 2.4.3 and then to Magento 2.4.5. Upgraded completed successfully.

engcom-November commented 1 year ago

Hi @jsdupuis , We are closing this issue as there has been no latest update on the same. Kindly reopen / create new issue if you are still facing any issues. Thank you.