Skip to content

Commit b735389

Browse files
Revert "fix(db): Set transaction isolation level for replica connections too"
This reverts commit db0fa54.
1 parent 38aac68 commit b735389

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/private/DB/SetTransactionIsolationLevel.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@ class SetTransactionIsolationLevel implements EventSubscriber {
3939
*/
4040
public function postConnect(ConnectionEventArgs $args) {
4141
$connection = $args->getConnection();
42-
$connection->setTransactionIsolation(TransactionIsolationLevel::READ_COMMITTED);
43-
if ($connection->getDatabasePlatform() instanceof MySQLPlatform) {
44-
$connection->executeStatement('SET SESSION AUTOCOMMIT=1');
42+
if ($connection instanceof PrimaryReadReplicaConnection && $connection->isConnectedToPrimary()) {
43+
$connection->setTransactionIsolation(TransactionIsolationLevel::READ_COMMITTED);
44+
if ($connection->getDatabasePlatform() instanceof MySQLPlatform) {
45+
$connection->executeStatement('SET SESSION AUTOCOMMIT=1');
46+
}
4547
}
4648
}
4749

0 commit comments

Comments
 (0)