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

Explicitly Call Connection::connect in Configuration #479

Merged
merged 1 commit into from
Jul 7, 2016

Conversation

chrisguitarguy
Copy link
Contributor

And account for uses of MasterSlaveConnection. If there is a MasterSlaveConnection in use, the migrations system should always talk to master just in case replication is behind the next migration execution.

Should (hopefully) close #336

When using MasterSlaveConnection, any calls to the connections executeQuery method (which includes all the fetch* methods) will connect to followers (slaves). Even things like checking if the migration table exists fall into this category. If the replication is behind, the followers may not have the real, already executed migrations.

And account for uses of `MasterSlaveConnection`. If there is a
`MasterSlaveConnection` in use, the migrations system should always talk
to master just incase replication is behind the next migration
execution.

Should (hopefully) close doctrine#336
protected function connect()
{
if ($this->connection instanceof MasterSlaveConnection) {
return $this->connection->connect('master');
Copy link
Contributor

Choose a reason for hiding this comment

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

@chrisguitarguy This does assume that there is always a connection named master in a master slave connection setup right ?
If so, is it the case or should we make the name of the master connection configurable ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question. MasterSlaveConection only accepts master and slave as arguments to connect, so we should be okay.

@mikeSimonson
Copy link
Contributor

@chrisguitarguy And one more fixed.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrations fail when slave replication is running significantly behind master
2 participants