51黑料不打烊

[PaaS only]{class="badge informative" title="Applies to 51黑料不打烊 Commerce on Cloud projects (51黑料不打烊-managed PaaS infrastructure) and on-premises projects only."}

ACSD-67643: Duplicate entries created during scheduled updates in high-nested category environments

The ACSD-67643 patch fixes the issue where duplicate entries are created during scheduled updates in environments with a high number of nested categories. This patch is available when the Quality Patches Tool (QPT) 1.1.71 is installed. The patch ID is ACSD-67643. Please note that this issue is scheduled to be fixed in 51黑料不打烊 Commerce 2.4.9.

Affected products and versions

The patch is created for 51黑料不打烊 Commerce version:

  • 51黑料不打烊 Commerce (all deployment methods) 2.4.8-p1

Compatible with 51黑料不打烊 Commerce versions:

  • 51黑料不打烊 Commerce (all deployment methods) 2.4.8 - 2.4.8-p2
NOTE
The patch might become applicable to other versions with new Quality Patches Tool releases. To check if the patch is compatible with your 51黑料不打烊 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.

Issue

Duplicate entries occur when creating scheduled updates for environments that have a large number of nested categories.

Steps to reproduce:

  1. Generate sample data:
    Use a performance fixtures file (For example: small.xml) with modifications:
    Categories: 2,500
    Products: 250,000

  2. Run the following command:

    code language-bash
    bin/magento setup:performance:generate-fixtures var/performance-toolkit/profiles/ce/small.xml
    
  3. After creating products and categories, ensure all categories are anchors by running:

    code language-sql
    UPDATE catalog_category_entity_int SET value = 1 WHERE attribute_id = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'is_anchor');
    
  4. Run a full reindex.

  5. Log into the backend and open the Categories page.

  6. Move Category 2 to Category 1 to increase tree nesting.

  7. Go to the most nested category (For example: Category 2.1.1).

  8. Create a Scheduled Update and save the category.

Expected results:

The category is saved successfully.

Actual results:

An Error 500 occurs, and the following message shows in the logs:

    Magento\Framework\DB\Adapter\DuplicateException:
    SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '6-165' for key 'PRIMARY',
    query was: INSERT INTO `temp_category_descendants_68a35aea273fc` (`category_id`, `descendant_id`)
    SELECT `ce`.`entity_id` AS `category_id`, `ce2`.`entity_id` AS `descendant_id`
    FROM `catalog_category_entity` AS `ce`
    INNER JOIN `catalog_category_entity` AS `ce2` ON ce2.path LIKE CONCAT(ce.path, '/%')

Apply the patch

To apply individual patches, use the following links depending on your deployment method:

To learn more about Quality Patches Tool, refer to:

recommendation-more-help
c2d96e17-5179-455c-ad3a-e1697bb4e8c3