Skip to content

Commit d35fcab

Browse files
committed
MC-31920: Let Magento\Framework\Lock\Backend\Database have 2 locks in single connection
1 parent f442fa9 commit d35fcab

File tree

3 files changed

+2
-16
lines changed

3 files changed

+2
-16
lines changed

app/code/Magento/Config/etc/di.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696

9797
<virtualType name="systemConfigQueryLocker" type="Magento\Framework\Cache\LockGuardedCacheLoader">
9898
<arguments>
99-
<argument name="locker" xsi:type="object">Magento\Framework\Lock\Backend\Cache</argument>
99+
<argument name="locker" xsi:type="object">Magento\Framework\Lock\Backend\Database</argument>
100100
</arguments>
101101
</virtualType>
102102

app/etc/di.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1786,7 +1786,7 @@
17861786
</type>
17871787
<type name="Magento\Framework\Cache\LockGuardedCacheLoader">
17881788
<arguments>
1789-
<argument name="locker" xsi:type="object">Magento\Framework\Lock\Backend\Cache</argument>
1789+
<argument name="locker" xsi:type="object">Magento\Framework\Lock\Backend\Database</argument>
17901790
</arguments>
17911791
</type>
17921792
<preference for="Magento\Framework\HTTP\AsyncClientInterface" type="Magento\Framework\HTTP\AsyncClient\GuzzleAsyncClient" />

lib/internal/Magento/Framework/Lock/Backend/Database.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -78,20 +78,6 @@ public function lock(string $name, int $timeout = -1): bool
7878
}
7979
$name = $this->addPrefix($name);
8080

81-
/**
82-
* Before MySQL 5.7.5, only a single simultaneous lock per connection can be acquired.
83-
* This limitation can be removed once MySQL minimum requirement has been raised,
84-
* currently we support MySQL 5.6 way only.
85-
*/
86-
if ($this->currentLock) {
87-
throw new AlreadyExistsException(
88-
new Phrase(
89-
'Current connection is already holding lock for %1, only single lock allowed',
90-
[$this->currentLock]
91-
)
92-
);
93-
}
94-
9581
$result = (bool)$this->resource->getConnection()->query(
9682
"SELECT GET_LOCK(?, ?);",
9783
[$name, $timeout < 0 ? self::MAX_LOCK_TIME : $timeout]

0 commit comments

Comments
 (0)