Skip to content

Commit f342381

Browse files
author
Stanislav Idolov
committed
Merge remote-tracking branch 'origin/indexers' into stock_indexer_batching
2 parents 3c69210 + 107882d commit f342381

File tree

16 files changed

+69
-44
lines changed

16 files changed

+69
-44
lines changed

app/code/Magento/Bundle/Model/ResourceModel/Indexer/Price.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
class Price extends \Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\DefaultPrice
1616
{
1717
/**
18-
* {@inheritdoc}
19-
* @param null|array $entityIds
18+
* @inheritdoc
2019
*/
2120
protected function reindex($entityIds = null)
2221
{

app/code/Magento/CacheInvalidate/Model/PurgeCache.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public function sendPurgeRequest($tagsPattern)
6767
'1.1',
6868
$headers
6969
);
70+
$socketAdapter->read();
7071
$socketAdapter->close();
7172
} catch (\Exception $e) {
7273
$this->logger->critical($e->getMessage(), compact('server', 'tagsPattern'));

app/code/Magento/CacheInvalidate/Test/Unit/Model/PurgeCacheTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ public function testSendPurgeRequest($hosts)
7171
$this->socketAdapterMock->expects($this->at($i++))
7272
->method('write')
7373
->with('PURGE', $uri, '1.1', ['X-Magento-Tags-Pattern' => 'tags', 'Host' => $uri->getHost()]);
74+
$this->socketAdapterMock->expects($this->at($i++))
75+
->method('read');
7476
$i++;
7577
}
7678
$this->socketAdapterMock->expects($this->exactly(count($uris)))

app/code/Magento/Catalog/Model/Indexer/Product/Price/AbstractAction.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ protected function _syncData(array $processIds = [])
135135
{
136136
// delete invalid rows
137137
$select = $this->_connection->select()->from(
138-
['index_price' => $this->getIndexerDefaultTable()],
138+
['index_price' => $this->getIndexTargetTable()],
139139
null
140140
)->joinLeft(
141141
['ip_tmp' => $this->_defaultIndexerResource->getIdxTable()],
@@ -152,7 +152,7 @@ protected function _syncData(array $processIds = [])
152152

153153
$this->_insertFromTable(
154154
$this->_defaultIndexerResource->getIdxTable(),
155-
$this->getIndexerDefaultTable()
155+
$this->getIndexTargetTable()
156156
);
157157
return $this;
158158
}
@@ -471,7 +471,7 @@ protected function _copyRelationIndexData($parentIds, $excludeIds = null)
471471

472472
if ($children) {
473473
$select = $this->_connection->select()->from(
474-
$this->getIndexerDefaultTable()
474+
$this->getIndexTargetTable()
475475
)->where(
476476
'entity_id IN(?)',
477477
$children
@@ -484,14 +484,13 @@ protected function _copyRelationIndexData($parentIds, $excludeIds = null)
484484
}
485485

486486
/**
487-
* Returns default table name for writing
487+
* Retrieve index table that will be used for write operations.
488488
*
489-
* Method support writing to frontend table in case with partial reindex
490-
* and case with writing to replica table during full reindex
489+
* This method is used to during both partial and full reindex to identify the the table.
491490
*
492491
* @return string
493492
*/
494-
protected function getIndexerDefaultTable()
493+
protected function getIndexTargetTable()
495494
{
496495
return $this->indexerFrontendResource->getMainTable();
497496
}

app/code/Magento/Catalog/Model/Indexer/Product/Price/Action/Full.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,6 @@ public function __construct(
5757
\Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\BatchSizeCalculator $batchSizeCalculator = null,
5858
\Magento\Framework\Indexer\BatchProviderInterface $batchProvider = null
5959
) {
60-
$this->metadataPool = $metadataPool ?: ObjectManager::getInstance()->get(
61-
\Magento\Framework\EntityManager\MetadataPool::class
62-
);
63-
$this->batchSizeCalculator = $batchSizeCalculator ?: ObjectManager::getInstance()->get(
64-
\Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\BatchSizeCalculator::class
65-
);
66-
$this->batchProvider = $batchProvider ?: ObjectManager::getInstance()->get(
67-
\Magento\Framework\Indexer\BatchProviderInterface::class
68-
);
6960
parent::__construct(
7061
$config,
7162
$storeManager,
@@ -77,6 +68,15 @@ public function __construct(
7768
$defaultIndexerResource,
7869
$indexerFrontendResource
7970
);
71+
$this->metadataPool = $metadataPool ?: ObjectManager::getInstance()->get(
72+
\Magento\Framework\EntityManager\MetadataPool::class
73+
);
74+
$this->batchSizeCalculator = $batchSizeCalculator ?: ObjectManager::getInstance()->get(
75+
\Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\BatchSizeCalculator::class
76+
);
77+
$this->batchProvider = $batchProvider ?: ObjectManager::getInstance()->get(
78+
\Magento\Framework\Indexer\BatchProviderInterface::class
79+
);
8080
}
8181

8282
/**
@@ -140,9 +140,8 @@ public function execute($ids = null)
140140

141141
/**
142142
* @inheritdoc
143-
* @return string
144143
*/
145-
protected function getIndexerDefaultTable()
144+
protected function getIndexTargetTable()
146145
{
147146
return $this->_defaultIndexerResource->getMainTable();
148147
}

app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/BatchSizeCalculator.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ public function __construct(array $batchRowsCount, array $estimators)
3333
}
3434

3535
/**
36-
* Composite object for batch size calculators
36+
* Retrieve batch size for the given indexer.
37+
*
38+
* Ensure that the database will be able to handle provided batch size correctly.
3739
*
3840
* @param \Magento\Framework\DB\Adapter\AdapterInterface $connection
3941
* @param string $indexerTypeId

app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/CompositeProductRowSizeEstimator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function __construct(
3838
/**
3939
* Calculate memory size for largest composite product in database.
4040
*
41-
* @inheritdoc
41+
* {@inheritdoc}
4242
*/
4343
public function estimateRowSize()
4444
{

app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -709,10 +709,9 @@ protected function hasEntity()
709709
}
710710

711711
/**
712-
* @inheritdoc
713712
* Returns main table name based on the suffix stored in the 'indexer_state' table
714713
*
715-
* @return string
714+
* {@inheritdoc}
716715
*/
717716
public function getMainTable()
718717
{

app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
<argument name="at_call" xsi:type="string">getShortDescription</argument>
9595
<argument name="at_code" xsi:type="string">short_description</argument>
9696
<argument name="css_class" xsi:type="string">overview</argument>
97-
<argument name="at_label" translate="true" xsi:type="string">none</argument>
97+
<argument name="at_label" xsi:type="string">none</argument>
9898
<argument name="title" translate="true" xsi:type="string">Overview</argument>
9999
<argument name="add_attribute" xsi:type="string">itemprop="description"</argument>
100100
</arguments>

app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/Price.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,15 @@ public function getFinalPrice($qty, $product)
3939
*/
4040
public function getPrice($product)
4141
{
42-
if ($product->getCustomOption('simple_product')) {
43-
return $product->getCustomOption('simple_product')->getProduct()->getPrice();
44-
} else {
45-
return 0;
42+
if (!empty($product)) {
43+
$simpleProductOption = $product->getCustomOption('simple_product');
44+
if (!empty($simpleProductOption)) {
45+
$simpleProduct = $simpleProductOption->getProduct();
46+
if (!empty($simpleProduct)) {
47+
return $simpleProduct->getPrice();
48+
}
49+
}
4650
}
51+
return 0;
4752
}
4853
}

0 commit comments

Comments
 (0)