Skip to content
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

Fixed table difference insert during price reindex #36370

Conversation

ilnytskyi
Copy link
Contributor

@ilnytskyi ilnytskyi commented Oct 26, 2022

Description (*)

Problem appears when dimensions are not used.
catalog_product_index_price is now incompatible with catalog_product_index_price_tmp as new ID columnt added
https://devdocs.magento.com/guides/v2.4/release-notes/backward-incompatible-changes/reference.html
so method works incorrectly as final query contains additional column

\Magento\Catalog\Model\Indexer\Product\Price\AbstractAction::_syncData

We faced this issue while running graphql tests when indexers is set - update on save
The issue might be skipped in fixtures but when tests are placing the order - it triggers reindex that blocks order placing.

In query logs we may see how temp table is created

## 140 ## QUERY
SQL: CREATE TEMPORARY TABLE IF NOT EXISTS `catalog_product_index_price_temp` LIKE `catalog_product_index_price_tmp`
AFF: 0
TIME: 0.0008

Related Pull Requests

Fixed Issues (if relevant)

cannot reindex price

Magento\Framework\Exception\LocalizedException: SQLSTATE[21S01]: Insert value list does not match column list: 1136 Column count doesn't match value count at row 1, query was: INSERT INTO `catalog_product_index_price` SELECT `ip_tmp`.* FROM `catalog_product_index_price_temp` AS `ip_tmp` ON DUPLICATE KEY UPDATE `tax_class_id` = VALUES(`tax_class_id`), `price` = VALUES(`price`), `final_price` = VALUES(`final_price`), `min_price` = VALUES(`min_price`), `max_price` = VALUES(`max_price`), `tier_price` = VALUES(`tier_price`) in /home/www/magento/vendor/magento/module-catalog/Model/Indexer/Product/Price/Action/Row.php on line 32
  1. Fixes magento/magento2#<issue_number>

Manual testing scenarios (*)

  1. Set indexer update on save
  2. Create product on 2.4.5 installation
  3. Create custom script to reindex
  4. RUN Magento\Catalog\Model\Indexer\Product\Price::executeRow
  5. See error.
  6. Apply patch from this PR
  7. retry reindex - no error

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)

Resolved issues:

  1. resolves catalog_product_price index getting stuck #36471: Fixed table difference insert during price reindex

@m2-assistant
Copy link

m2-assistant bot commented Oct 26, 2022

Hi @ilnytskyi. Thank you for your contribution
Here are some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names. Allowed build names are:

  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE,
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests
  13. Semantic Version Checker

You can find more information about the builds here

ℹ️ Run only required test builds during development. Run all test builds before sending your pull request for review.

For more details, review the Magento Contributor Guide documentation.

⚠️ According to the Magento Contribution requirements, all Pull Requests must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of Pull Requests 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.

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

@ilnytskyi
Copy link
Contributor Author

Selection_132
@kandy could you take a look?
As I see in logs incompatibility beetween catalog_product_index_price_tmp and catalog_product_index_price was introduced in your commit.

@ihor-sviziev ihor-sviziev added the Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. label Oct 26, 2022
@m2-community-project m2-community-project bot removed this from Pending Review in Pull Requests Dashboard Oct 26, 2022
@Den4ik
Copy link
Contributor

Den4ik commented Oct 27, 2022

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@Den4ik
Copy link
Contributor

Den4ik commented Nov 2, 2022

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@Den4ik
Copy link
Contributor

Den4ik commented Nov 5, 2022

@magento run Functional Tests EE, Functional Tests B2B

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@Den4ik
Copy link
Contributor

Den4ik commented Nov 7, 2022

@magento run Functional Tests B2B

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@Den4ik
Copy link
Contributor

Den4ik commented Nov 7, 2022

@magento run Functional Tests B2B

Copy link
Contributor

@Den4ik Den4ik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Approved
Failed B2B test is not related to PR

@engcom-Delta
Copy link
Contributor

@magento create issue

@m2-community-project m2-community-project bot moved this from Testing in Progress to Ready for Testing in High Priority Pull Requests Dashboard Nov 16, 2022
@engcom-Lima engcom-Lima moved this from Review in Progress to Testing in Progress in Pull Requests Dashboard Dec 21, 2022
@engcom-Lima engcom-Lima added the Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it label Dec 21, 2022
@engcom-Lima engcom-Lima moved this from Testing in Progress to Ready for Testing in Pull Requests Dashboard Dec 21, 2022
@m2-community-project m2-community-project bot moved this from Ready for Testing to Review in Progress in Pull Requests Dashboard Dec 21, 2022
@m2-community-project m2-community-project bot moved this from Review in Progress to Ready for Testing in Pull Requests Dashboard Dec 21, 2022
@engcom-Echo engcom-Echo self-assigned this Dec 22, 2022
@m2-community-project m2-community-project bot moved this from Ready for Testing to Review in Progress in Pull Requests Dashboard Dec 22, 2022
@engcom-Echo engcom-Echo moved this from Review in Progress to Testing in Progress in Pull Requests Dashboard Dec 22, 2022
@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@engcom-Echo
Copy link
Contributor

@ilnytskyi @Den4ik @kandy @michaellehmkuhl
Thanks for the collaboration & contribution!

✔️ QA Passed
Fixed table difference insert during price reindex

Manual Scenario Steps

  1. Put the module in app\code folder.
  2. Run bin/magento setup:upgrade command
  3. Create a new product of the new Product type created by the above module.
  4. Indexer should be on "Update by Schedule"
  5. Run the below command to trigger the error:
  6. n98-magerun2 sys:cron:run indexer_update_all_views

Before: ✖️
image

After: ✔️
image

@engcom-Echo
Copy link
Contributor

Functional Test B2B failures are different on last two run
Run1
image

Run2
image

Hence moving to Merge In Progress.

@engcom-Echo engcom-Echo moved this from Testing in Progress to Merge in Progress in Pull Requests Dashboard Dec 22, 2022
@engcom-Echo
Copy link
Contributor

@magento run Functional Tests B2B

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@magento-devops-reposync-svc magento-devops-reposync-svc merged commit b7f562b into magento:2.4-develop Jan 20, 2023
@engcom-Echo engcom-Echo moved this from Merge in Progress to Recently Merged in Pull Requests Dashboard Feb 23, 2023
@maaarghk
Copy link

why did this not make it into 2.4.6 : (

@EclipseEternal
Copy link

Hi, do we have an idea when will this be available or in which version?

@TuVanDev
Copy link
Member

@EclipseEternal This pull request has been merged into Magento 2.4.7-beta1 and 2.4.7-beta2. As a result, when Magento 2.4.7 is released next April, it will include version 2.4.7.
To identify the branches where the commits from this pull request were merged, you can refer to the git commit. For example, d53d0f9
For more details on future release information, refer to the release schedule https://experienceleague.adobe.com/docs/commerce-operations/release/planning/schedule.html?lang=en

@EclipseEternal
Copy link

Hi, thank you for your tips, we will patch then waiting for the 2.4.7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: accept Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it
Projects
Pull Requests Dashboard
  
Recently Merged
Development

Successfully merging this pull request may close these issues.

catalog_product_price index getting stuck