The ACSD-47027 patch solves the issue where the slow query B2B CompanyRole GraphQL update does not work as expected. This patch is available when the Quality Patches Tool (QPT) 1.1.23 is installed. The patch ID is ACSD-47027. Please note that the issue is scheduled to be fixed in Adobe Commerce 2.4.6.
The patch is created for Adobe Commerce version:
Compatible with Adobe Commerce versions:
The patch might become applicable to other versions with new Quality Patches Tool releases. To check if the patch is compatible with your Adobe Commerce version, update the magento/quality-patches
package to the latest version and check the compatibility on the Quality Patches Tool: Search for patches page. Use the patch ID as a search keyword to locate the patch.
The slow query B2B CompanyRole GraphQL update does not work as expected.
Prerequisites:
Install the B2B module.
Steps to reproduce:
In the Adobe Commerce Admin, go to Stores > Settings > Configurations > B2B Features and set Enable Company to Yes.
Go to the frontend and create a company.
After you log in as a company user, go to My Account > Roles and Permissions and add a new role.
Enable dev query log using bin/magento dev:que:enab
.
Now send the below GraphQL request (id is the base64 encoded role id):
mutation {
updateCompanyRole(
input: {
id: "Mg=="
permissions: [
"Magento_Company::view"
"Magento_Company::view_account"
"Magento_Company::user_management"
"Magento_Company::roles_view"
]
}
) {
role {
id
name
permissions {
id
text
children {
id
text
children {
id
text
}
}
}
}
}
}
Check the query log.
You can see that the above query is executed. This query is executed in app/code/Magento/CompanyGraphQl/Model/Company/Role/ValidateRole.php::validateResources
.
Expected results:
The app/code/Magento/CompanyGraphQl/Model/Company/Role/ValidateRole.php::validateResources
needs to be optimized to avoid loading all the data available in the company_permissions DB table.
Actual results:
Adobe Commerce executes a query without any filter. When there are a large number of records, it takes a lot of time for Adobe Commerce to prepare the data collection.
To apply individual patches, use the following links depending on your deployment method:
To learn more about Quality Patches Tool, refer to:
For info about other patches available in QPT, refer to Quality Patches Tool: Search for patches in the Quality Patches Tool guide.