Magento2: Open a category while reindexing results in no product in this category

Created on 19 Aug 2017  路  10Comments  路  Source: magento/magento2

All magento versions including 2.1.7

Not related to any Server configuration --> It is a major bug

This is another of the reindexing bugs never solved in magento2 - it is not fixed till 2.1.7 which we run.

Run reindex via command line and enter a category while reindexing at the frontend.

RESULT:

The category page has NO! products.
Even worse:
Resindexing does not clean cache so the category stays empty till the cache for the category is not valid any more or a reindex happens where the category is not accessed while reindexing.

@magento-team i have no idea why you not solve the reindexing problems. This is one of the bugs - another 20-30 are reported since month but the problems still continue in 2.1.8 - are you not able to fix your own system or what is the reason for this?

Clear Description Confirmed Format is not valid Ready for Work Reproduced on 2.1.x bug report

Most helpful comment

I can confirm that this is happening on 2.1.8 also

All 10 comments

@andidhouse Thank you for your report.
Please use the issue reporting guidelines to report an issue. Include the steps required to reproduce, the actual result, and the expected result.

I've experienced this issue as well. It also happens to product searches while the search index table is being recreated, though that isn't as bad of an issue due to search results pages never being cached.

This is personally not a big problem for us because whenever we trigger a full reindex, we always flush all caches right after.

I've also seen the implementation of these reindex operations, and the problem is due to the table being destroyed and recreated. It holds no data while it is being constructed, so users see empty categories. There doesn't seem to be a simple solution to this problem, and it may require a sort of double buffer system to have 2 versions of each table. While one table is being constructed, the other is "live". Once the reindex is finished, it switches the live version to the new table. This would add a decent amount of complexity, so it may not even be worth it IMHO.

@vherasymenko shure - i thought it was clear:

  • reindex via command line commend in magento2
    -while the reindex is running open some categories with products in it

Expected Result:

  • The cetegories do have all products in it like advised in the backend

Actual Result:

  • The categories opened while reindexing have no products in them - they show empty products!

Clear now?
Could you pls confirm this is also happening on your system?

Thanks!

I can confirm that this is happening on 2.1.8 also

I can confirm that issue for 2.1.8 too

@andidhouse, thank you for your report.
We've created internal ticket(s) MAGETWO-80323 to track progress on the issue.

Magento does not use the temporary table (catalog_category_product_index_tmp) while reindexing catalog_category_product.

The result is that the main index table (catalog_category_product_index) is cleared before reindex is done and cause this issue.

To use the temporary table just tell Magento to use it in app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Full.php.
Set $useTempTable to true using your favortite override method.

Here's a patch:

--- a/vendor/magento/module-catalog/Model/Indexer/Category/Product/Action/Full.php  2017-09-28 14:11:25.000000000 -0400
+++ b/vendor/magento/module-catalog/Model/Indexer/Category/Product/Action/Full.php  2017-09-28 14:11:59.000000000 -0400
@@ -12,7 +12,7 @@
      *
      * @var bool
      */
-    protected $useTempTable = false;
+    protected $useTempTable = true;

     /**
      * Refresh entities index

Issue already fixed in 2.2.X.

I am still seeing this bug on 2.2.3. The index in question is catalog_category_product, rather than catalogsearch_fulltext, so the reference above (#6754) is not the correct solution. I am investigating the use of the useTempTable = true flag, but for at least \Magento\Catalog\Model\Indexer\Category\Product\Action\Row, it does not look like that will be an acceptable answer, as there is no other segmentation code defined in that class, especially the "removeEntities" method

Also this bug on 2.2.6. Any Solution?

Was this page helpful?
0 / 5 - 0 ratings