-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Description
Preconditions
- Latest Magento2 pull from github as of 1/2/17
- PHP 7, NGINX, mariadb
Steps to reproduce
- run indexer:reindex catalog_category_product
Expected result
- index is rebuilt past 500 products per category resulting in products missing from site.
Actual result
- products are not included in the catalog_category_product_index resulting in products not appearing on site.
Query in error:
INSERT INTO catalog_category_product_index (category_id, product_id, position, is_parent, store_id, visibility) SELECT cc.entity_id AS category_id, ccp.product_id, ccp.position, 1 AS is_parent, 1 AS store_id, IFNULL(cpvs.value, cpvd.value) AS visibility FROM catalog_category_entity AS cc
INNER JOIN catalog_category_product AS ccp ON ccp.category_id = cc.entity_id
INNER JOIN catalog_product_website AS cpw ON cpw.product_id = ccp.product_id
INNER JOIN catalog_product_entity AS cpe ON ccp.product_id = cpe.entity_id
INNER JOIN catalog_product_entity_int AS cpsd ON cpsd.entity_id = cpe.entity_id AND cpsd.store_id = 0 AND cpsd.attribute_id = 94
LEFT JOIN catalog_product_entity_int AS cpss ON cpss.entity_id = cpe.entity_id AND cpss.attribute_id = cpsd.attribute_id AND cpss.store_id = 1
INNER JOIN catalog_product_entity_int AS cpvd ON cpvd.entity_id = cpe.entity_id AND cpvd.store_id = 0 AND cpvd.attribute_id = 96
LEFT JOIN catalog_product_entity_int AS cpvs ON cpvs.entity_id = cpe.entity_id AND cpvs.attribute_id = cpvd.attribute_id AND cpvs.store_id = 1 WHERE (cc.path LIKE '1/2/%') AND (cpw.website_id = '1') AND (IFNULL(cpss.value, cpsd.value) = 1) AND (IFNULL(cpvs.value, cpvd.value) IN (2, 3, 4)) AND (cc.entity_id > '1051') ORDER BY cc.entity_id ASC
LIMIT 500 ON DUPLICATE KEY UPDATE category_id = VALUES(category_id), product_id = VALUES(product_id), position = VALUES(position), is_parent = VALUES(is_parent), store_id = VALUES(store_id), visibility = VALUES(visibility)
Query that successfully rebuilds full index (dropped limit and changed cc.entity_id > 0):
INSERT INTO catalog_category_product_index (category_id, product_id, position, is_parent, store_id, visibility) SELECT cc.entity_id AS category_id, ccp.product_id, ccp.position, 1 AS is_parent, 1 AS store_id, IFNULL(cpvs.value, cpvd.value) AS visibility FROM catalog_category_entity AS cc
INNER JOIN catalog_category_product AS ccp ON ccp.category_id = cc.entity_id
INNER JOIN catalog_product_website AS cpw ON cpw.product_id = ccp.product_id
INNER JOIN catalog_product_entity AS cpe ON ccp.product_id = cpe.entity_id
INNER JOIN catalog_product_entity_int AS cpsd ON cpsd.entity_id = cpe.entity_id AND cpsd.store_id = 0 AND cpsd.attribute_id = 94
LEFT JOIN catalog_product_entity_int AS cpss ON cpss.entity_id = cpe.entity_id AND cpss.attribute_id = cpsd.attribute_id AND cpss.store_id = 1
INNER JOIN catalog_product_entity_int AS cpvd ON cpvd.entity_id = cpe.entity_id AND cpvd.store_id = 0 AND cpvd.attribute_id = 96
LEFT JOIN catalog_product_entity_int AS cpvs ON cpvs.entity_id = cpe.entity_id AND cpvs.attribute_id = cpvd.attribute_id AND cpvs.store_id = 1 WHERE (cc.path LIKE '1/2/%') AND (cpw.website_id = '1') AND (IFNULL(cpss.value, cpsd.value) = 1) AND (IFNULL(cpvs.value, cpvd.value) IN (2, 3, 4)) AND (cc.entity_id > '0') ORDER BY cc.entity_id ASC
ON DUPLICATE KEY UPDATE category_id = VALUES(category_id), product_id = VALUES(product_id), position = VALUES(position), is_parent = VALUES(is_parent), store_id = VALUES(store_id), visibility = VALUES(visibility)