File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
app/code/core/Mage/ImportExport/Model/Resource/Helper Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,11 @@ class Mage_ImportExport_Model_Resource_Helper_Mysql4 extends Mage_Core_Model_Res
27
27
public const DB_MAX_PACKET_SIZE = 1048576 ; // Maximal packet length by default in MySQL
28
28
public const DB_MAX_PACKET_COEFFICIENT = 0.85 ; // The coefficient of useful data from maximum packet length
29
29
30
+ /**
31
+ * Semaphore to disable schema stats only once
32
+ */
33
+ private static boolean $ instantInformationSchemaStatsExpiry = false ;
34
+
30
35
/**
31
36
* Returns maximum size of packet, that we can send to DB
32
37
*
@@ -49,11 +54,23 @@ public function getMaxDataSize()
49
54
public function getNextAutoincrement ($ tableName )
50
55
{
51
56
$ adapter = $ this ->_getReadAdapter ();
52
- $ adapter -> query ( ' SET information_schema_stats_expiry = 0; ' );
57
+ $ this -> setInformationSchemaStatsExpiry ( );
53
58
$ entityStatus = $ adapter ->showTableStatus ($ tableName );
54
59
if (empty ($ entityStatus ['Auto_increment ' ])) {
55
60
Mage::throwException (Mage::helper ('importexport ' )->__ ('Cannot get autoincrement value ' ));
56
61
}
57
62
return $ entityStatus ['Auto_increment ' ];
58
63
}
64
+
65
+ /**
66
+ * Set information_schema_stats_expiry to 0 if not already set.
67
+ */
68
+ public function setInformationSchemaStatsExpiry ()
69
+ {
70
+ if (!self ::$ instantInformationSchemaStatsExpiry ) {
71
+ // Set information_schema_stats_expiry to 0
72
+ $ this ->getReadAdapter ()->query ('SET information_schema_stats_expiry = 0; ' );
73
+ self ::$ instantInformationSchemaStatsExpiry = true ;
74
+ }
75
+ }
59
76
}
You can’t perform that action at this time.
0 commit comments