Skip to content

Commit 0e6cc05

Browse files
author
Michail Slabko
committed
MAGETWO-23764: Category/Product Indexer fails with mysql fatal on large catalog
1 parent 5f92533 commit 0e6cc05

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

app/code/Magento/Catalog/Model/ResourceModel/MaxHeapTableSizeProcessor.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ class MaxHeapTableSizeProcessor
1616
*/
1717
protected $connection;
1818

19+
/**
20+
* @var int
21+
*/
22+
protected $defaultMaxHeapTableSie;
23+
1924
/**
2025
* Current max_heap_table_size value (in Bytes)
2126
*
@@ -29,18 +34,19 @@ class MaxHeapTableSizeProcessor
2934
public function __construct(ResourceConnection $resource)
3035
{
3136
$this->connection = $resource->getConnection();
37+
$this->defaultMaxHeapTableSie = 1024 * 1024 * 64;
3238
}
3339

3440
/**
3541
* Set max_heap_table_size value in Bytes. By default value is 64M
3642
*
37-
* @param int $maxHeapTableSize
43+
* @param int|null $maxHeapTableSize
3844
* @throws \InvalidArgumentException
3945
* @throws \RuntimeException
4046
*/
41-
public function set($maxHeapTableSize = 1024 * 1024 * 64)
47+
public function set($maxHeapTableSize = null)
4248
{
43-
$maxHeapTableSize = (int)$maxHeapTableSize;
49+
$maxHeapTableSize = (int) (null === $maxHeapTableSize ? $this->defaultMaxHeapTableSie : $maxHeapTableSize);
4450
if (!$maxHeapTableSize) {
4551
throw new \InvalidArgumentException('Wrong max_heap_table_size parameter');
4652
}

0 commit comments

Comments
 (0)