Skip to content

Commit 43fbc12

Browse files
authored
Merge pull request #95 from magento-commerce/MCLOUD-9142
MCLOUD-9142: Enable synchronous replication if slave connections is enabled
2 parents 658164e + c1de944 commit 43fbc12

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/Config/Database/DbConfig.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class DbConfig implements ConfigInterface
3535
const KEY_ENGINE = 'engine';
3636
const KEY_INIT_STATEMENTS = 'initStatements';
3737
const KEY_ACTIVE = 'active';
38+
const KEY_SYNCHRONOUS_REPLICATION = 'synchronous_replication';
3839

3940
/**
4041
* Names of connections
@@ -195,6 +196,7 @@ private function collectEnvConfig(array $customDbConfig): array
195196
}
196197
$mageConnectionConfig = $this->convertToMageFormat($slaveConnectionData, true);
197198
$config[self::KEY_SLAVE_CONNECTION][$mageConnectionName] = $mageConnectionConfig;
199+
$config[self::KEY_SLAVE_CONNECTION][$mageConnectionName][self::KEY_SYNCHRONOUS_REPLICATION] = true;
198200
}
199201
return $config;
200202
}

src/Test/Unit/Config/Database/DbConfigTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ public function getDataProvider()
317317
'engine' => 'innodb',
318318
'initStatements' => 'SET NAMES utf8;',
319319
'active' => '1',
320+
'synchronous_replication' => true,
320321
],
321322
],
322323
],
@@ -342,6 +343,7 @@ public function getDataProvider()
342343
'engine' => 'innodb',
343344
'initStatements' => 'SET NAMES utf8;',
344345
'active' => '1',
346+
'synchronous_replication' => true,
345347
],
346348
],
347349
],
@@ -495,6 +497,7 @@ public function getDataProvider()
495497
'engine' => 'innodb',
496498
'initStatements' => 'SET NAMES utf8;',
497499
'active' => '1',
500+
'synchronous_replication' => true,
498501
],
499502
],
500503
],
@@ -616,6 +619,7 @@ public function getDataProvider()
616619
'engine' => 'innodb',
617620
'initStatements' => 'SET NAMES utf8;',
618621
'active' => '1',
622+
'synchronous_replication' => true,
619623
],
620624
],
621625
],
@@ -759,6 +763,7 @@ public function getDataProvider()
759763
'engine' => 'innodb',
760764
'initStatements' => 'SET NAMES utf8;',
761765
'active' => '1',
766+
'synchronous_replication' => true,
762767
],
763768
'checkout' => [
764769
'host' => 'some_host_quote_slave:3310',
@@ -769,6 +774,7 @@ public function getDataProvider()
769774
'engine' => 'innodb',
770775
'initStatements' => 'SET NAMES utf8;',
771776
'active' => '1',
777+
'synchronous_replication' => true,
772778
],
773779
'sales' => [
774780
'host' => 'some_host_sales_slave:3311',
@@ -779,6 +785,7 @@ public function getDataProvider()
779785
'engine' => 'innodb',
780786
'initStatements' => 'SET NAMES utf8;',
781787
'active' => '1',
788+
'synchronous_replication' => true,
782789
],
783790
],
784791
],
@@ -977,6 +984,7 @@ public function getDataProvider()
977984
'engine' => 'innodb',
978985
'initStatements' => 'SET NAMES utf8;',
979986
'active' => '1',
987+
'synchronous_replication' => true,
980988
],
981989
'sales' => ['host' => 'some_host_sales_slave:3311',
982990
'username' => 'some_username_sales_slave',
@@ -986,6 +994,7 @@ public function getDataProvider()
986994
'engine' => 'innodb',
987995
'initStatements' => 'SET NAMES utf8;',
988996
'active' => '1',
997+
'synchronous_replication' => true,
989998
],
990999
],
9911000
],

0 commit comments

Comments
 (0)