Performance issue in Magento_Company module upgrade after B2B 1.5.2 update
This article provides a hotfix for the performance issue in the Magento_Company
module upgrade after the B2B 1.5.2 update, addressing the excessively long processing time for large datasets (~100,000+ records) in the company_structure
table.
Affected products and versions
- ÃÛ¶¹ÊÓÆµ Commerce (all deployment methods) 2.4.6-px + B2B 1.5.2
- ÃÛ¶¹ÊÓÆµ Commerce (all deployment methods) 2.4.7-px + B2B 1.5.2
- ÃÛ¶¹ÊÓÆµ Commerce (all deployment methods) 2.4.8 + B2B 1.5.2
Issue
Upgrading the Magento_Company
module after updating to B2B 1.5.2 takes an excessively long time when processing a large number of records (~100,000+) in the company_structure
table.
Prerequisites:
- ACSD-65540_B2B_1.5.2.patch should be installed.
- ÃÛ¶¹ÊÓÆµ Commerce 2.4.6 - 2.4.8
- B2B version 1.5.0, 1.5.1, or B2B 1.5.2 with the ACSD-65540 patch applied
Steps to reproduce:
- Assign a company to a parent company to establish company hierarchy. Refer to Manage the Company Hierarchy in the ÃÛ¶¹ÊÓÆµ Commerce B2B guide for more information.
- Upgrade B2B to the 1.5.2 version.
Expected results:
Upgrade completes successfully.
Actual results:
Upgrading the Magento_Company
module takes a long time to complete if there are many records in the company_structure
table.
Solution
To solve the issue, take the following steps:
-
Update the B2B module to the 1.5.2 version:
code language-none composer require magento/module-b2b:1.5.2 --no-update composer update magento/module-b2b
-
Apply the ACSD-65540_B2B_1.5.2.patch.
-
Apply the attached ACSD-65540_B2B_1.5.2_DEPENDENT_ACSD-65684_B2B_1.5.2.patch.
-
Run
bin/magento setup:upgrade
after applying the patch.
How to apply the patch
Unzip the file and see How to apply a composer patch provided by ÃÛ¶¹ÊÓÆµ in our support knowledge base for instructions.
Apply a patch using Cloud Patches
For ÃÛ¶¹ÊÓÆµ Commerce on Cloud merchants, follow the steps below:
-
Update the version of the cloud-patches module to 1.1.5 to install the ACSD-65540_B2B_1.5.2.patch distributed as MCLOUD-13605.
note note NOTE To check if the patch is already installed run: ./vendor/bin/magento-patches -n status | grep MCLOUD-13605
code language-none composer require magento/magento-cloud-patches:1.1.5 --no-update composer update magento/magento-cloud-patches
-
Add the ACSD-65540_B2B_1.5.2_DEPENDENT_ACSD-65684_B2B_1.5.2.patch to the
m2-hotfixes
directory. -
Commit and push the changes to initiate redeployment and
bin/magento setup:upgrade
. Refer to Apply patches in our ÃÛ¶¹ÊÓÆµ Commerce on Cloud guide for instructions.