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

[Forward Port] magento/magento2#12205: Stock inventory reindex bug. #25306

Merged

Conversation

hostep
Copy link
Contributor

@hostep hostep commented Oct 27, 2019

(cherry picked from commit 20d7afb)

Description (*)

This is a forward port of https://github.com/magento-engcom/magento2ce/pull/1134 to Magento 2.3-develop (since this is a non-public PR, I can't see the discussion in there unfortunately)
It looks like this fix got included in Magento 2.2.5, but was forgotten to be forward ported to Magento 2.3

Fixed Issues (if relevant)

  1. Stock inventory reindex bug #12205: Stock inventory reindex bug
  2. Random products show out of stock until manual reindex #15984: Random products show out of stock until manual reindex

Manual testing scenarios (*)

  1. Setup vanilla 2.3-develop installation including sample data
  2. Run bin/magento indexer:set-mode schedule
  3. In the frontend of the shop, go to Gear > Bags. Notice there are 14 products visible here => good
  4. Execute the following SQL query which will simulate that 1891 products stock data was updated and schedules them for reindexing: INSERT INTO cataloginventory_stock_cl(entity_id) SELECT a.entity_id FROM catalog_product_entity a INNER JOIN cataloginventory_stock_status b ON a.entity_id=b.product_id AND b.website_id=0 WHERE a.type_id='simple'
  5. Run bin/magento indexer:status to verify this
  6. If you have magerun2 installed, run: php n98-magerun2.phar sys:cron:run indexer_update_all_views, otherwise run bin/magento cron:run
  7. Run bin/magento indexer:status to verify that all scheduled updates were processed
  8. In the frontend of the shop, go to Gear > Bags. Notice there are 0 products visible here => not good
  9. Notice the amount of entries in the cataloginventory_stock_status database table, there are 1046 in here
  10. Now perform a manual full reindex of the stock: bin/magento indexer:reindex cataloginventory_stock
  11. In the frontend of the shop, go to Gear > Bags. Notice there are 14 products visible here => good
  12. Notice the amount of entries in the cataloginventory_stock_status database table, there are 2046 in here

Now repeat the same but with this PR applied, and you'll notice that in step 8 and 9 the correct thing happens and further steps are no longer needed

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)
  • All automated tests passed successfully (all builds are green)

@m2-assistant
Copy link

m2-assistant bot commented Oct 27, 2019

Hi @hostep. Thank you for your contribution
Here is 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.3-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Guide documentation.

@kalpmehta
Copy link
Contributor

Thanks @hostep for the contribution!
FYI I see the patch here https://raw.githubusercontent.com/ConvertGroupsAS/magento2-patches/master/Patch-Magento_CatalogInventory-M2.2.0-2.2.4-stock-index.patch

@ghost ghost assigned kalpmehta Oct 28, 2019
@kalpmehta kalpmehta added Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests Award: bug fix labels Oct 28, 2019
@magento-engcom-team
Copy link
Contributor

Hi @kalpmehta, thank you for the review.
ENGCOM-6188 has been created to process this Pull Request
✳️ @kalpmehta, could you please add one of the following labels to the Pull Request?

Label Description
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests
Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests
Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests

@engcom-Alfa
Copy link
Contributor

✔️ QA Passed

@m2-assistant
Copy link

m2-assistant bot commented Nov 14, 2019

Hi @hostep, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@magento-engcom-team magento-engcom-team added this to the Release: 2.3.5 milestone Nov 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants