Skip to content

Commit

Permalink
Merge pull request #95 from magento-commerce/MCLOUD-9142
Browse files Browse the repository at this point in the history
MCLOUD-9142: Enable synchronous replication if slave connections is enabled
  • Loading branch information
BaDos authored Aug 24, 2022
2 parents 658164e + c1de944 commit 43fbc12
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Config/Database/DbConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class DbConfig implements ConfigInterface
const KEY_ENGINE = 'engine';
const KEY_INIT_STATEMENTS = 'initStatements';
const KEY_ACTIVE = 'active';
const KEY_SYNCHRONOUS_REPLICATION = 'synchronous_replication';

/**
* Names of connections
Expand Down Expand Up @@ -195,6 +196,7 @@ private function collectEnvConfig(array $customDbConfig): array
}
$mageConnectionConfig = $this->convertToMageFormat($slaveConnectionData, true);
$config[self::KEY_SLAVE_CONNECTION][$mageConnectionName] = $mageConnectionConfig;
$config[self::KEY_SLAVE_CONNECTION][$mageConnectionName][self::KEY_SYNCHRONOUS_REPLICATION] = true;
}
return $config;
}
Expand Down
9 changes: 9 additions & 0 deletions src/Test/Unit/Config/Database/DbConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ public function getDataProvider()
'engine' => 'innodb',
'initStatements' => 'SET NAMES utf8;',
'active' => '1',
'synchronous_replication' => true,
],
],
],
Expand All @@ -342,6 +343,7 @@ public function getDataProvider()
'engine' => 'innodb',
'initStatements' => 'SET NAMES utf8;',
'active' => '1',
'synchronous_replication' => true,
],
],
],
Expand Down Expand Up @@ -495,6 +497,7 @@ public function getDataProvider()
'engine' => 'innodb',
'initStatements' => 'SET NAMES utf8;',
'active' => '1',
'synchronous_replication' => true,
],
],
],
Expand Down Expand Up @@ -616,6 +619,7 @@ public function getDataProvider()
'engine' => 'innodb',
'initStatements' => 'SET NAMES utf8;',
'active' => '1',
'synchronous_replication' => true,
],
],
],
Expand Down Expand Up @@ -759,6 +763,7 @@ public function getDataProvider()
'engine' => 'innodb',
'initStatements' => 'SET NAMES utf8;',
'active' => '1',
'synchronous_replication' => true,
],
'checkout' => [
'host' => 'some_host_quote_slave:3310',
Expand All @@ -769,6 +774,7 @@ public function getDataProvider()
'engine' => 'innodb',
'initStatements' => 'SET NAMES utf8;',
'active' => '1',
'synchronous_replication' => true,
],
'sales' => [
'host' => 'some_host_sales_slave:3311',
Expand All @@ -779,6 +785,7 @@ public function getDataProvider()
'engine' => 'innodb',
'initStatements' => 'SET NAMES utf8;',
'active' => '1',
'synchronous_replication' => true,
],
],
],
Expand Down Expand Up @@ -977,6 +984,7 @@ public function getDataProvider()
'engine' => 'innodb',
'initStatements' => 'SET NAMES utf8;',
'active' => '1',
'synchronous_replication' => true,
],
'sales' => ['host' => 'some_host_sales_slave:3311',
'username' => 'some_username_sales_slave',
Expand All @@ -986,6 +994,7 @@ public function getDataProvider()
'engine' => 'innodb',
'initStatements' => 'SET NAMES utf8;',
'active' => '1',
'synchronous_replication' => true,
],
],
],
Expand Down

0 comments on commit 43fbc12

Please sign in to comment.