Open m2-assistant[bot] opened 1 year ago
@magento give me 2.4-develop instance
Hi @alucardatem. Thank you for your request. I'm working on Magento instance for you.
@magento I am working on this
Hi @alucardatem, here is your Magento Instance: https://243df60ec9a7562e22825d04175ded1f.instances-prod.magento-community.engineering Admin access: https://243df60ec9a7562e22825d04175ded1f.instances-prod.magento-community.engineering/admin_9172 Login: 224c9daf Password: b68897db18ca
Hi @engcom-Bravo. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
Area: XXXXX
label to the ticket, indicating the functional areas it may be related to.2.4-develop
branch@magento give me 2.4-develop instance
to deploy test instance on Magento infrastructure. 2.4-develop
branch, please, add the label Reproduced on 2.4.x
.Issue: Confirmed
once verification is complete. @magento Reproduced Issue on 2.4-develop
Will continue and finalize this on Monday 10th of july
@magento run all tests
Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result). Issue has been verified
Verify that issue has a meaningful description and provides enough information to reproduce the issue. Description is good, alongside images in order to reproduce
Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to. Area: Admin Panel + CLI
Verify that the issue is reproducible on 2.4-develop branch Issue can be reproduced on 2.4-develop
Add label Issue: Confirmed once verification is complete. Confirmed
Make sure that automatic system confirms that report has been added to the backlog.
Hi @alucardatem,
Thanks for your update.
Verified the issue on Magento 2.4-develop instance and the issue is not reproducible.Kindly refer the screenshots.
Steps to reproduce
We have followed the steps and configured as per this comment https://github.com/magento/magento2/issues/37689#issuecomment-1614404873
Indexing has been completed successfully.Please let us know if we are missing anything here.
Thanks.
yes. in the original post there were configs also for the stores -> catalog settings and basically what this fix does is to make sure that there is no cardinality issue on filtering
because we have the following:
\Magento\UrlRewrite\Model\Storage\DbStorage::prepareSelect
has the following definition:
protected function prepareSelect(array $data)
{
$select = $this->connection->select();
$select->from($this->resource->getTableName(self::TABLE_NAME));
foreach ($data as $column => $value) {
$select->where($this->connection->quoteIdentifier($column) . ' IN (?)', $value);
}
return $select;
}
then than is used in the DynamicStorage and DBStorage which state the follwing: DynamicStorage:
/**
* @inheritDoc
*/
protected function prepareSelect(array $data)
{
$metadata = [];
if (isset($data[UrlRewrite::METADATA])) {
$metadata = $data[UrlRewrite::METADATA];
unset($data[UrlRewrite::METADATA]);
}
$select = $this->connection->select();
$select->from(
[
'url_rewrite' => $this->resource->getTableName(self::TABLE_NAME)
]
);
$select->joinLeft(
['relation' => $this->resource->getTableName(Product::TABLE_NAME)],
'url_rewrite.url_rewrite_id = relation.url_rewrite_id'
);
foreach ($data as $column => $value) {
$select->where('url_rewrite.' . $column . ' IN (?)', $value);
}
if (empty($metadata['category_id'])) {
$select->where('relation.category_id IS NULL');
} else {
$select->where(
'relation.category_id = ?',
$metadata['category_id']
);
}
return $select;
}
and for DbStorage:
/**
* @inheritDoc
*/
protected function prepareSelect(array $data)
{
$metadata = [];
if (isset($data[UrlRewrite::METADATA])) {
$metadata = $data[UrlRewrite::METADATA];
unset($data[UrlRewrite::METADATA]);
}
$select = $this->connection->select();
$select->from(
[
'url_rewrite' => $this->resource->getTableName(self::TABLE_NAME)
]
);
$select->joinLeft(
['relation' => $this->resource->getTableName(Product::TABLE_NAME)],
'url_rewrite.url_rewrite_id = relation.url_rewrite_id',
['relation.category_id', 'relation.product_id']
);
foreach ($data as $column => $value) {
$select->where('url_rewrite.' . $column . ' IN (?)', $value);
}
if (empty($metadata['category_id'])) {
$select->where('relation.category_id IS NULL');
} else {
$select->where(
'relation.category_id = ?',
$metadata['category_id']
);
}
return $select;
}
now expading and looking into the DynamicCategoryRewrites:
both
use Magento\CatalogUrlRewrite\Model\Storage\DynamicStorage;
use Magento\CatalogUrlRewrite\Model\Storage\DbStorage;
are being used
and dynamic storage is used in the constructor
/**
* @param ScopeConfigInterface|null $config
* @param DynamicStorage $dynamicStorage
*/
public function __construct(
ScopeConfigInterface $config,
DynamicStorage $dynamicStorage
) {
$this->config = $config;
$this->dynamicStorage = $dynamicStorage;
}
and as you can see:
if the categoryRewrites are enabled it procceeds to execute prody function with the required data, however, when it is not this is the problem where it starts to develop as it ends up with
(relation.category_id = '368', '377', '380', '383', '764', '766', '772', '773', '774', '872', '874', '882', '883', '892', '950')
where those numbers are the categories where that product should reside in in order to be able to create the proper redirects.
This is why i am saying that the current way of testing based of VANILLA type instances is not 100% correct and it can only be reproduced when following the logic of the code and the flow of data.
Also CLI wise --- unable to access that in any way shape or form as a contributer and while I am able to replicate that on magento instances, and another member is not, is most likely because not everything is read or missing images or missing configs or missing out on steps.
so basically this is reproducible as long as you have followed the images as well that were provided as guidance
This issue is automatically created based on existing pull request: magento/magento2#37690: Url Rewrite Cardinality issue
Preconditions and environment
merchandise a product in multiple store views that reindex
Steps to reproduce
Merchandise a product in a multi store view website run a reindex
Expected result
Catalog Search index has been rebuilt successfully in XX:YY:ZZ
Actual result
and in exception.log
list of category ids at this point is irellevant
Additional information
This has caused a store to stop functioning properly.
Release note
Fix on url rewrite cardinality issue when running reindex for
Triage and priority