Open ilnytskyi opened 1 year ago
Hi @ilnytskyi. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:
@magento give me 2.4-develop instance
- upcoming 2.4.x release@magento I am working on this
Join Magento Community Engineering Slack and ask your questions in #github channel. :warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting. :clock10: You can find the schedule on the Magento Community Calendar page. :telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.
Hi @engcom-November. 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. Hello @ilnytskyi,
Thank you for the report and collaboration!
Can you please elaborate the 3rd step in Steps to reproduce, and it would be great if you could provide code examples and use case for the issue. This will help us to reproduce the issue more effectively.
Thank you.
@engcom-November You can check the message with xdebug
/** @var $storage Database */
$storage = $this->storageFactory->create();
try {
$storage->loadByFilename($relativeFileName);
} catch (\Exception $e) {
//here or just
var_dump($e);
}
On the other hand you can enable DB query logging bin/magento dev:query-log:enable
or directly on DB and see that magento sends selects to media_storage_file_storage
table.
Hello @ilnytskyi,
Thank you for the quick reply!
We were able to reproduce this issue on 2.4-develop.
Please take a look at the screenshot below:
Here we can see a query to the non-existent table media_storage_file_storage
.
Hence confirming the issue.
Thank you.
:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-10586 is successfully created for this GitHub issue.
:white_check_mark: Confirmed by @engcom-November. Thank you for verifying the issue.
Issue Available: @engcom-November, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.
:x: You don't have permission to export this issue.
Is there already a patch available from Adobe commerce?
CC. @engcom-November
`` For now this patch of a collegue seems to resolve it:
diff --git a/Model/ResourceModel/File/Storage/Database.php b/Model/ResourceModel/File/Storage/Database.php
--- a/Model/ResourceModel/File/Storage/Database.php
+++ b/Model/ResourceModel/File/Storage/Database.php
@@ -238,6 +238,7 @@
*/
public function loadByFilename(\Magento\MediaStorage\Model\File\Storage\Database $object, $filename, $path)
{
+ return $this;
$connection = $this->getConnection();
$select = $connection->select()->from(
At the moment we get more than 19.2k requests in a week which generates this error and pollutes our monitoring.
or
diff --git a/Model/ResourceModel/File/Storage/Database.php b/Model/ResourceModel/File/Storage/Database.php
--- a/Model/ResourceModel/File/Storage/Database.php
+++ b/Model/ResourceModel/File/Storage/Database.php
@@ -238,6 +238,8 @@
*/
public function loadByFilename(\Magento\MediaStorage\Model\File\Storage\Database $object, $filename, $path)
{
+ return $this;
+
$connection = $this->getConnection();
$select = $connection->select()->from(
I created a Composer Patch: magento/module-media-storage
diff --git a/Model/File/Storage/Synchronization.php b/Model/File/Storage/Synchronization.php
index 3ee2rd..8349152 111644
--- a/Model/File/Storage/Synchronization.php
+++ b/Model/File/Storage/Synchronization.php
@@ -10,6 +10,7 @@
use Magento\Framework\Exception\FileSystemException;
use Magento\Framework\Filesystem\Directory\WriteInterface as DirectoryWrite;
use Magento\Framework\Filesystem\File\WriteInterface;
+use Magento\MediaStorage\Helper\File\Storage\Database as DatabaseStorageHelper;
/**
* Synchronize files from Db storage to local file system
@@ -31,15 +32,23 @@
protected $mediaDirectory;
/**
+ * @var DatabaseStorageHelper $databaseStorageHelper
+ */
+ protected $databaseStorageHelper;
+
+ /**
* @param DatabaseFactory $storageFactory
* @param DirectoryWrite $directory
+ * @param DatabaseStorageHelper $databaseStorageHelper
*/
public function __construct(
DatabaseFactory $storageFactory,
- DirectoryWrite $directory
+ DirectoryWrite $directory,
+ DatabaseStorageHelper $databaseStorageHelper
) {
$this->storageFactory = $storageFactory;
$this->mediaDirectory = $directory;
+ $this->databaseStorageHelper = $databaseStorageHelper;
}
/**
@@ -51,6 +60,10 @@
*/
public function synchronize($relativeFileName)
{
+ if (!$this->databaseStorageHelper->checkDbUsage()) {
+ return;
+ }
+
/** @var $storage Database */
$storage = $this->storageFactory->create();
try {
Preconditions and environment
Steps to reproduce
media_storage_file_storage
does not existspub/get.php
to resolve imagehttps://magento.local/media/wysiwyg/someImage.jpg
Expected result
media_storage_file_storage
tablemedia_storage_file_storage
tablemedia_storage_file_storage
Magento\MediaStorage\Model\File\Storage\Synchronization::synchronize
Magento\MediaStorage\Model\File\Storage\Synchronization::synchronize
does not use disabled DB media storageActual result
media_storage_file_storage
tablemedia_storage_file_storage
that does not existsMagento\MediaStorage\Model\File\Storage\Synchronization::synchronize
Magento\MediaStorage\Model\File\Storage\Synchronization::synchronize
does not uses disabled DB media storageAdditional information
The execution path according blackfire
https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/MediaStorage/Model/File/Storage/Synchronization.php#L57 The
Magento\MediaStorage\Model\File\Storage\Synchronization::synchronize
executes a this code:The workaround can be to adjust nginx config, but still the code has to be refactored, as no warnings logged, and query is fired to non-existent table.
Release note
During accessing images via
pub/get.php
the select queries tomedia_storage_file_storage
are not fired when DB media storage is disabled.Triage and priority