Question

I have change the Batch size for Magento 2.4

var/www/html/Mag/app/code/Reg/Indexer/etc/adminhtml/di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Catalog\Model\Indexer\Category\Product\Action\Full">
    <arguments>
        <argument name="batchRowsCount" xsi:type="array">
            <item name="configurable" xsi:type="number">500</item>
            <item name="default" xsi:type="number">500</item>
        </argument>
    </arguments>
</type>
</config>

On running the indexer process it gives an error

Category Products index PHP Fatal error: Uncaught Error: Unsupported operand types in /var/www/html/Mag/vendor/magento/framework/Indexer/BatchSizeManagement.php:49 Stack trace: #0 /var/www/html/Mag/vendor/magento/module-catalog/Model/Indexer/Category/Product/Action/Full.php(269): Magento\Framework\Indexer\BatchSizeManagement->ensureBatchSize(Object(Magento\Framework\DB\Adapter\Pdo\Mysql\Interceptor), Array) #1 /var/www/html/Mag/vendor/magento/module-catalog/Model/Indexer/Category/Product/Action/Full.php(227): Magento\Catalog\Model\Indexer\Category\Product\Action\Full->reindexCategoriesBySelect(Object(Magento\Framework\DB\Select), 'cp.entity_id IN...', Object(Magento\Store\Model\Store\Interceptor)) #2 /var/www/html/Mag/vendor/magento/module-catalog/Model/Indexer/Category/Product/Action/Full.php(192): Magento\Catalog\Model\Indexer\Category\Product\Action\Full->reindexRootCategory(Object(Magento\Store\Model\Store\Interceptor)) #3 /var/www/html/Mag/vendor/magento/module-catalog/Model/Indexer/Category/Product/Actio in /var/www/html/Mag/vendor/magento/framework/Indexer/BatchSizeManagement.php on line 49

Any help is appreciated.

Was it helpful?

Solution

Update

Try this

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Catalog\Model\Indexer\Category\Product\Action\Full">
        <arguments>
            <argument name="batchRowsCount" xsi:type="number">500</argument>
        </arguments>
    </type>
    <type name="Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\BatchSizeCalculator">
        <arguments>
            <argument name="batchRowsCount" xsi:type="array">
                <item name="configurable" xsi:type="number">500</item>
            </argument>
        </arguments>
    </type> 
</config>

Also check this

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top