bin/magento indexer:reindex
:
Category Products indexer process unknown error:
SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘catalog_category_product_index_replica’ doesn’t exist, query was: DESCRIBE catalog_category_product_index_replica
Magento\Catalog\Model\Indexer\Category\Product\AbstractAction::getMainTable()
Magento\Catalog\Model\Indexer\Category\Product\Action\Full::getMainTable()
Magento\Catalog\Setup\UpgradeSchema::upgrade()
if (version_compare($context->getVersion(), '2.2.0', '<')) {
$this->addProductEavIndexReplicaTables($setup);
$this->addPathKeyToCategoryEntityTableIfNotExists($setup);
// By adding 'catalog_product_index_price_replica' we provide separation of tables
// used for indexation write and read operations and affected models.
$this->addReplicaTable(
$setup,
'catalog_product_index_price',
'catalog_product_index_price_replica'
);
// the same for 'catalog_category_product_index'
$this->addReplicaTable(
$setup,
'catalog_category_product_index',
'catalog_category_product_index_replica'
);
}
Magento\Catalog\Setup\UpgradeSchema::addReplicaTable()
/**
* Add the replica table for existing one.
*
* @param SchemaSetupInterface $setup
* @param string $existingTable
* @param string $replicaTable
* @return void
*/
private function addReplicaTable(SchemaSetupInterface $setup, $existingTable, $replicaTable)
{
$setup->getConnection()->createTable(
$setup->getConnection()->createTableByDdl(
$setup->getTable($existingTable),
$setup->getTable($replicaTable)
)
);
}
How to fix
Step 1
UPDATE setup_module
SET schema_version = '2.1.99', data_version = '2.1.99'
WHERE 'Magento_Catalog' = `module` and '2.2.0' = schema_version and '2.2.0' = data_version;
Step 2
bin/magento setup:upgrade && bin/magento indexer:reindex
Rahul
(Rahul)
April 27, 2021, 10:51am
3
will this solution work for 2.3.3 . i have been getting following error when i attempt to run cron job manually.
SQLSTATE[42S02]: Base table or view not found: 1932 Table ‘dbperfixSrmdAuVe.catalog_product_index_price_replica’ doesn’t exist in engine, query was: TRUNCATE TABLE catalog_product_index_price_replica
Thanks