Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not pass connection name to PrimaryReadReplicaConnection::connect() #1156

Merged

Conversation

frankverhoeven
Copy link
Contributor

Q A
Type bug
BC Break no
Fixed issues #1154 #1155

Summary

Passing a connection name to PrimaryReadReplicaConnection::connect() will result in an exception being thrown.
This change will remove the master name from TableMetadataStorage::isInitialized() to prevent that exception.

@frankverhoeven frankverhoeven force-pushed the primary-read-replica-connection-connect branch from 6c9aebc to b4892f6 Compare April 28, 2021 12:11
@@ -198,7 +198,7 @@ private function isInitialized(): bool
}

if ($this->connection instanceof PrimaryReadReplicaConnection) {
$this->connection->connect('master');
$this->connection->connect();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The equivalent of the old ->connect('master') API of MasterSlaveConnection is ->ensureConnectedToPrimary(), not ->connect()

@greg0ire
Copy link
Member

Should this target 2.3.x, or does the fix not apply there?

@stof
Copy link
Member

stof commented Apr 30, 2021

@greg0ire no. 2.3.x is not affected. It properly uses the new API for the new version of DBAL already (but TableMetadataStorage does not exist at all in 2.3.x so a merge up did not fix it for 3.x)

@greg0ire greg0ire merged commit c925cd5 into doctrine:3.1.x Apr 30, 2021
@greg0ire
Copy link
Member

Let's merge this then! Thanks @frankverhoeven !

@greg0ire greg0ire added this to the 3.1.3 milestone Apr 30, 2021
@greg0ire greg0ire added the Bug label Apr 30, 2021
@jlekowski jlekowski mentioned this pull request Jun 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants