diff --git a/.all-contributorsrc b/.all-contributorsrc
index 259815fa56c..882017d2b45 100644
--- a/.all-contributorsrc
+++ b/.all-contributorsrc
@@ -1418,6 +1418,15 @@
"contributions": [
"code"
]
+ },
+ {
+ "login": "leissbua",
+ "name": "Michael Leiss",
+ "avatar_url": "https://avatars.githubusercontent.com/u/68073221?v=4",
+ "profile": "https://github.com/leissbua",
+ "contributions": [
+ "code"
+ ]
}
],
"contributorsPerLine": 7
diff --git a/README.md b/README.md
index 6b62fff0695..e40dcdfdf16 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
-
+
@@ -590,6 +590,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Juho Hölsä |
Kane |
Kevin Jakob |
+ leissbua |
diff --git a/app/code/core/Mage/ImportExport/Model/Resource/Helper/Mysql4.php b/app/code/core/Mage/ImportExport/Model/Resource/Helper/Mysql4.php
index c79acbe0518..b0be1fcf692 100644
--- a/app/code/core/Mage/ImportExport/Model/Resource/Helper/Mysql4.php
+++ b/app/code/core/Mage/ImportExport/Model/Resource/Helper/Mysql4.php
@@ -27,6 +27,13 @@ class Mage_ImportExport_Model_Resource_Helper_Mysql4 extends Mage_Core_Model_Res
public const DB_MAX_PACKET_SIZE = 1048576; // Maximal packet length by default in MySQL
public const DB_MAX_PACKET_COEFFICIENT = 0.85; // The coefficient of useful data from maximum packet length
+ /**
+ * Semaphore to disable schema stats only once
+ *
+ * @var bool
+ */
+ private static $instantInformationSchemaStatsExpiry = false;
+
/**
* Returns maximum size of packet, that we can send to DB
*
@@ -49,11 +56,25 @@ public function getMaxDataSize()
public function getNextAutoincrement($tableName)
{
$adapter = $this->_getReadAdapter();
+ $this->setInformationSchemaStatsExpiry();
$entityStatus = $adapter->showTableStatus($tableName);
-
if (empty($entityStatus['Auto_increment'])) {
Mage::throwException(Mage::helper('importexport')->__('Cannot get autoincrement value'));
}
return $entityStatus['Auto_increment'];
}
+
+ /**
+ * Set information_schema_stats_expiry to 0 if not already set.
+ */
+ public function setInformationSchemaStatsExpiry(): void
+ {
+ if (!self::$instantInformationSchemaStatsExpiry) {
+ try {
+ $this->_getReadAdapter()->query('SET information_schema_stats_expiry = 0;');
+ } catch (Exception $e) {
+ }
+ self::$instantInformationSchemaStatsExpiry = true;
+ }
+ }
}