Skip to content

Commit 11eb2d9

Browse files
authored
MCLOUD-5701 / MCLOUD-5375: Fix cloud patches (#35)
1 parent 63113a6 commit 11eb2d9

9 files changed

+516
-508
lines changed

patches.json

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -107,19 +107,14 @@
107107
"Unlock locale editing when SCD on demand is enabled": {
108108
"2.2.0 - 2.2.5": "MAGECLOUD-2159__unlock_locale_editing_when_scd_on_demand__2.2.0.patch"
109109
},
110-
"Allow DB dumps done with the support module to complete": {
111-
"2.2.0 - 2.2.5": "MAGECLOUD-2033__prevent_deadlock_during_db_dump__2.2.0.patch"
112-
},
113110
"Write Logs for Failed Process of Generating Factories in Extensions": {
114111
"2.2.0 - 2.2.5": "MAGECLOUD-2209__write_logs_for_failed_process_of_generating_factories_in_extensions__2.2.0.patch"
115112
},
116113
"Fix Problems with Consumer Runners on Cloud Clusters": {
117-
"2.2.0 - 2.2.3": "MAGECLOUD-2464__fix_problems_with_consumer_runners_on_cloud_clusters__2.2.0.patch",
118-
"2.2.4": "MAGECLOUD-2464__fix_problems_with_consumer_runners_on_cloud_clusters__2.2.4.patch",
119-
"2.2.5": "MAGECLOUD-3913__fix_problems_with_consumer_runners_on_cloud_clusters__2.2.5.patch",
120-
"2.2.6": "MAGECLOUD-3913__fix_problems_with_consumer_runners_on_cloud_clusters__2.2.6.patch",
121-
"2.2.7": "MAGECLOUD-3913__fix_problems_with_consumer_runners_on_cloud_clusters__2.2.7.patch",
122-
"2.2.8 - 2.2.9": "MAGECLOUD-3913__fix_problems_with_consumer_runners_on_cloud_clusters__2.2.8.patch",
114+
"2.2.5": "MAGECLOUD-3913__fix_problems_with_consumer_runners_on_cloud_clusters__2.2.5_ce.patch",
115+
"2.2.6": "MAGECLOUD-3913__fix_problems_with_consumer_runners_on_cloud_clusters__2.2.6_ce.patch",
116+
"2.2.7": "MAGECLOUD-3913__fix_problems_with_consumer_runners_on_cloud_clusters__2.2.7_ce.patch",
117+
"2.2.8 - 2.2.9": "MAGECLOUD-3913__fix_problems_with_consumer_runners_on_cloud_clusters__2.2.8_ce.patch",
123118
"2.3.0": "MAGECLOUD-3913__fix_problems_with_consumer_runners_on_cloud_clusters__2.3.0.patch",
124119
">=2.3.1 <2.3.3": "MAGECLOUD-3913__fix_problems_with_consumer_runners_on_cloud_clusters__2.3.1.patch"
125120
},
@@ -186,7 +181,6 @@
186181
">=2.3.0 <2.3.3": "MAGECLOUD-3806__error_code_fix_for_setup_upgrade__2.3.0.patch"
187182
},
188183
"Re-work consumers to terminate as soon as there is nothing left to process": {
189-
"2.2.0 - 2.3.1": "MAGECLOUD-4071__terminate_consumers_if_the_queue_is_empty__2.2.0.patch",
190184
">=2.3.2 <2.3.4": "MAGECLOUD-4071__terminate_consumers_if_the_queue_is_empty__2.3.2.patch"
191185
},
192186
"Backward Compatibility of new Mail Interfaces": {
@@ -302,6 +296,20 @@
302296
"2.3.2": "PB-320__fix_pagebuilder_module__2.3.2.patch",
303297
">=2.3.2-p1 <2.3.3": "PB-322__fix_pagebuilder_module__2.3.2-p1.patch",
304298
"2.3.3": "PB-323__fix_pagebuilder_module__2.3.3.patch"
299+
},
300+
"Allow DB dumps done with the support module to complete": {
301+
"2.2.0 - 2.2.5": "MAGECLOUD-2033__prevent_deadlock_during_db_dump__2.2.0.patch"
302+
},
303+
"Fix Problems with Consumer Runners on Cloud Clusters": {
304+
"2.2.0 - 2.2.3": "MAGECLOUD-2464__fix_problems_with_consumer_runners_on_cloud_clusters__2.2.0.patch",
305+
"2.2.4": "MAGECLOUD-2464__fix_problems_with_consumer_runners_on_cloud_clusters__2.2.4.patch",
306+
"2.2.5": "MAGECLOUD-3913__fix_problems_with_consumer_runners_on_cloud_clusters__2.2.5_ee.patch",
307+
"2.2.6": "MAGECLOUD-3913__fix_problems_with_consumer_runners_on_cloud_clusters__2.2.6_ee.patch",
308+
"2.2.7": "MAGECLOUD-3913__fix_problems_with_consumer_runners_on_cloud_clusters__2.2.7_ee.patch",
309+
"2.2.8 - 2.2.9": "MAGECLOUD-3913__fix_problems_with_consumer_runners_on_cloud_clusters__2.2.8_ee.patch"
310+
},
311+
"Re-work consumers to terminate as soon as there is nothing left to process": {
312+
">=2.2.0 <2.3.2": "MAGECLOUD-4071__terminate_consumers_if_the_queue_is_empty__2.2.0.patch"
305313
}
306314
}
307315
}
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
diff -Nuar a/vendor/magento/framework/Lock/Backend/Database.php b/vendor/magento/framework/Lock/Backend/Database.php
2+
--- a/vendor/magento/framework/Lock/Backend/Database.php
3+
+++ b/vendor/magento/framework/Lock/Backend/Database.php
4+
@@ -3,8 +3,8 @@
5+
* Copyright © Magento, Inc. All rights reserved.
6+
* See COPYING.txt for license details.
7+
*/
8+
-
9+
declare(strict_types=1);
10+
+
11+
namespace Magento\Framework\Lock\Backend;
12+
13+
use Magento\Framework\App\DeploymentConfig;
14+
@@ -14,20 +14,44 @@ use Magento\Framework\Exception\AlreadyExistsException;
15+
use Magento\Framework\Exception\InputException;
16+
use Magento\Framework\Phrase;
17+
18+
+/**
19+
+ * Implementation of the lock manager on the basis of MySQL.
20+
+ */
21+
class Database implements \Magento\Framework\Lock\LockManagerInterface
22+
{
23+
- /** @var ResourceConnection */
24+
+ /**
25+
+ * Max time for lock is 1 week
26+
+ *
27+
+ * MariaDB does not support negative timeout value to get infinite timeout,
28+
+ * so we set 1 week for lock timeout
29+
+ */
30+
+ const MAX_LOCK_TIME = 604800;
31+
+
32+
+ /**
33+
+ * @var ResourceConnection
34+
+ */
35+
private $resource;
36+
37+
- /** @var DeploymentConfig */
38+
+ /**
39+
+ * @var DeploymentConfig
40+
+ */
41+
private $deploymentConfig;
42+
43+
- /** @var string Lock prefix */
44+
+ /**
45+
+ * @var string Lock prefix
46+
+ */
47+
private $prefix;
48+
49+
- /** @var string|false Holds current lock name if set, otherwise false */
50+
+ /**
51+
+ * @var string|false Holds current lock name if set, otherwise false
52+
+ */
53+
private $currentLock = false;
54+
55+
+ /**
56+
+ * @param ResourceConnection $resource
57+
+ * @param DeploymentConfig $deploymentConfig
58+
+ * @param string|null $prefix
59+
+ */
60+
public function __construct(
61+
ResourceConnection $resource,
62+
DeploymentConfig $deploymentConfig,
63+
@@ -46,9 +70,13 @@ class Database implements \Magento\Framework\Lock\LockManagerInterface
64+
* @return bool
65+
* @throws InputException
66+
* @throws AlreadyExistsException
67+
+ * @throws \Zend_Db_Statement_Exception
68+
*/
69+
public function lock(string $name, int $timeout = -1): bool
70+
{
71+
+ if (!$this->deploymentConfig->isDbAvailable()) {
72+
+ return true;
73+
+ };
74+
$name = $this->addPrefix($name);
75+
76+
/**
77+
@@ -59,7 +87,7 @@ class Database implements \Magento\Framework\Lock\LockManagerInterface
78+
if ($this->currentLock) {
79+
throw new AlreadyExistsException(
80+
new Phrase(
81+
- 'Current connection is already holding lock for $1, only single lock allowed',
82+
+ 'Current connection is already holding lock for %1, only single lock allowed',
83+
[$this->currentLock]
84+
)
85+
);
86+
@@ -67,7 +95,7 @@ class Database implements \Magento\Framework\Lock\LockManagerInterface
87+
88+
$result = (bool)$this->resource->getConnection()->query(
89+
"SELECT GET_LOCK(?, ?);",
90+
- [(string)$name, (int)$timeout]
91+
+ [$name, $timeout < 0 ? self::MAX_LOCK_TIME : $timeout]
92+
)->fetchColumn();
93+
94+
if ($result === true) {
95+
@@ -83,9 +111,14 @@ class Database implements \Magento\Framework\Lock\LockManagerInterface
96+
* @param string $name lock name
97+
* @return bool
98+
* @throws InputException
99+
+ * @throws \Zend_Db_Statement_Exception
100+
*/
101+
public function unlock(string $name): bool
102+
{
103+
+ if (!$this->deploymentConfig->isDbAvailable()) {
104+
+ return true;
105+
+ };
106+
+
107+
$name = $this->addPrefix($name);
108+
109+
$result = (bool)$this->resource->getConnection()->query(
110+
@@ -106,14 +139,19 @@ class Database implements \Magento\Framework\Lock\LockManagerInterface
111+
* @param string $name lock name
112+
* @return bool
113+
* @throws InputException
114+
+ * @throws \Zend_Db_Statement_Exception
115+
*/
116+
public function isLocked(string $name): bool
117+
{
118+
+ if (!$this->deploymentConfig->isDbAvailable()) {
119+
+ return false;
120+
+ };
121+
+
122+
$name = $this->addPrefix($name);
123+
124+
return (bool)$this->resource->getConnection()->query(
125+
"SELECT IS_USED_LOCK(?);",
126+
- [(string)$name]
127+
+ [$name]
128+
)->fetchColumn();
129+
}
130+
131+
@@ -123,7 +161,7 @@ class Database implements \Magento\Framework\Lock\LockManagerInterface
132+
* Limited to 64 characters in MySQL.
133+
*
134+
* @param string $name
135+
- * @return string $name
136+
+ * @return string
137+
* @throws InputException
138+
*/
139+
private function addPrefix(string $name): string

patches/MAGECLOUD-3913__fix_problems_with_consumer_runners_on_cloud_clusters__2.2.5.patch renamed to patches/MAGECLOUD-3913__fix_problems_with_consumer_runners_on_cloud_clusters__2.2.5_ee.patch

Lines changed: 0 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -1,142 +1,3 @@
1-
diff -Nuar a/vendor/magento/framework/Lock/Backend/Database.php b/vendor/magento/framework/Lock/Backend/Database.php
2-
--- a/vendor/magento/framework/Lock/Backend/Database.php
3-
+++ b/vendor/magento/framework/Lock/Backend/Database.php
4-
@@ -3,8 +3,8 @@
5-
* Copyright © Magento, Inc. All rights reserved.
6-
* See COPYING.txt for license details.
7-
*/
8-
-
9-
declare(strict_types=1);
10-
+
11-
namespace Magento\Framework\Lock\Backend;
12-
13-
use Magento\Framework\App\DeploymentConfig;
14-
@@ -14,20 +14,44 @@ use Magento\Framework\Exception\AlreadyExistsException;
15-
use Magento\Framework\Exception\InputException;
16-
use Magento\Framework\Phrase;
17-
18-
+/**
19-
+ * Implementation of the lock manager on the basis of MySQL.
20-
+ */
21-
class Database implements \Magento\Framework\Lock\LockManagerInterface
22-
{
23-
- /** @var ResourceConnection */
24-
+ /**
25-
+ * Max time for lock is 1 week
26-
+ *
27-
+ * MariaDB does not support negative timeout value to get infinite timeout,
28-
+ * so we set 1 week for lock timeout
29-
+ */
30-
+ const MAX_LOCK_TIME = 604800;
31-
+
32-
+ /**
33-
+ * @var ResourceConnection
34-
+ */
35-
private $resource;
36-
37-
- /** @var DeploymentConfig */
38-
+ /**
39-
+ * @var DeploymentConfig
40-
+ */
41-
private $deploymentConfig;
42-
43-
- /** @var string Lock prefix */
44-
+ /**
45-
+ * @var string Lock prefix
46-
+ */
47-
private $prefix;
48-
49-
- /** @var string|false Holds current lock name if set, otherwise false */
50-
+ /**
51-
+ * @var string|false Holds current lock name if set, otherwise false
52-
+ */
53-
private $currentLock = false;
54-
55-
+ /**
56-
+ * @param ResourceConnection $resource
57-
+ * @param DeploymentConfig $deploymentConfig
58-
+ * @param string|null $prefix
59-
+ */
60-
public function __construct(
61-
ResourceConnection $resource,
62-
DeploymentConfig $deploymentConfig,
63-
@@ -46,9 +70,13 @@ class Database implements \Magento\Framework\Lock\LockManagerInterface
64-
* @return bool
65-
* @throws InputException
66-
* @throws AlreadyExistsException
67-
+ * @throws \Zend_Db_Statement_Exception
68-
*/
69-
public function lock(string $name, int $timeout = -1): bool
70-
{
71-
+ if (!$this->deploymentConfig->isDbAvailable()) {
72-
+ return true;
73-
+ };
74-
$name = $this->addPrefix($name);
75-
76-
/**
77-
@@ -59,7 +87,7 @@ class Database implements \Magento\Framework\Lock\LockManagerInterface
78-
if ($this->currentLock) {
79-
throw new AlreadyExistsException(
80-
new Phrase(
81-
- 'Current connection is already holding lock for $1, only single lock allowed',
82-
+ 'Current connection is already holding lock for %1, only single lock allowed',
83-
[$this->currentLock]
84-
)
85-
);
86-
@@ -67,7 +95,7 @@ class Database implements \Magento\Framework\Lock\LockManagerInterface
87-
88-
$result = (bool)$this->resource->getConnection()->query(
89-
"SELECT GET_LOCK(?, ?);",
90-
- [(string)$name, (int)$timeout]
91-
+ [$name, $timeout < 0 ? self::MAX_LOCK_TIME : $timeout]
92-
)->fetchColumn();
93-
94-
if ($result === true) {
95-
@@ -83,9 +111,14 @@ class Database implements \Magento\Framework\Lock\LockManagerInterface
96-
* @param string $name lock name
97-
* @return bool
98-
* @throws InputException
99-
+ * @throws \Zend_Db_Statement_Exception
100-
*/
101-
public function unlock(string $name): bool
102-
{
103-
+ if (!$this->deploymentConfig->isDbAvailable()) {
104-
+ return true;
105-
+ };
106-
+
107-
$name = $this->addPrefix($name);
108-
109-
$result = (bool)$this->resource->getConnection()->query(
110-
@@ -106,14 +139,19 @@ class Database implements \Magento\Framework\Lock\LockManagerInterface
111-
* @param string $name lock name
112-
* @return bool
113-
* @throws InputException
114-
+ * @throws \Zend_Db_Statement_Exception
115-
*/
116-
public function isLocked(string $name): bool
117-
{
118-
+ if (!$this->deploymentConfig->isDbAvailable()) {
119-
+ return false;
120-
+ };
121-
+
122-
$name = $this->addPrefix($name);
123-
124-
return (bool)$this->resource->getConnection()->query(
125-
"SELECT IS_USED_LOCK(?);",
126-
- [(string)$name]
127-
+ [$name]
128-
)->fetchColumn();
129-
}
130-
131-
@@ -123,7 +161,7 @@ class Database implements \Magento\Framework\Lock\LockManagerInterface
132-
* Limited to 64 characters in MySQL.
133-
*
134-
* @param string $name
135-
- * @return string $name
136-
+ * @return string
137-
* @throws InputException
138-
*/
139-
private function addPrefix(string $name): string
1401
diff -Nuar a/vendor/magento/module-message-queue/Console/StartConsumerCommand.php b/vendor/magento/module-message-queue/Console/StartConsumerCommand.php
1412
--- a/vendor/magento/module-message-queue/Console/StartConsumerCommand.php
1423
+++ b/vendor/magento/module-message-queue/Console/StartConsumerCommand.php

0 commit comments

Comments
 (0)