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

Fix #1230 - Console commands do not respect driverOptions when master/slave configuration is used #1240

Merged
merged 1 commit into from
Oct 28, 2020

Conversation

ostrolucky
Copy link
Member

@ostrolucky ostrolucky commented Oct 25, 2020

@stof could you please check this, you were the one adding driverOptions to this blacklist, so there is a tiny chance you would know if that was on purpose

@ostrolucky ostrolucky changed the title Fix #1230 - Console commands do not respect driverOptions when master… Fix #1230 - Console commands do not respect driverOptions when master/slave configuration is used Oct 25, 2020
@ostrolucky ostrolucky closed this Oct 25, 2020
@ostrolucky ostrolucky reopened this Oct 25, 2020
@ostrolucky ostrolucky added this to the 1.12.11 milestone Oct 25, 2020
@ostrolucky ostrolucky requested review from greg0ire and stof October 26, 2020 19:06
@@ -126,6 +126,7 @@ public function testDbalLoadSingleMasterSlaveConnection()
'dbname' => 'mysql_db',
'host' => 'localhost',
'unix_socket' => '/path/to/mysqld.sock',
'driverOptions' => [],
Copy link
Member

Choose a reason for hiding this comment

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

Should the file on line 114 be modified to add options in both the master and the slave, to make things more interesting? Without your change, what happens? Are the master's options copied to the slave?

Copy link
Member Author

Choose a reason for hiding this comment

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

There is actually no such option as "master" configuration key/option. What's defined one level above slaves is what's master. And yes that's how this patch works. It copies everything from master to slaves except the things in the list.

Copy link
Member

Choose a reason for hiding this comment

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

Indeed, I read the issue backwards. What if there is already an option at the slave level? Will it be overwritten? Should the configuration at

dbal:
dbname: mysql_db
user: mysql_user
password: mysql_s3cr3t
unix_socket: /path/to/mysqld.sock
keep_slave: true
default_table_options:
engine: InnoDB
slaves:
slave1:
user: slave_user
dbname: slave_db
password: slave_s3cr3t
unix_socket: /path/to/mysqld_slave.sock
be modified to test what happens when there are options in both levels? I'd expect some kind of merge to happen, but I'm not sure which level should get the priority. Maybe the slave one, because otherwise, there would be a BC-break?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think that's necessary. I didn't change merging logic. Whatever slave specifies is kept for that slave.

@ostrolucky ostrolucky merged commit 6b16203 into 1.12.x Oct 28, 2020
petewalker added a commit to petewalker/DoctrineBundle that referenced this pull request Nov 10, 2020
…verOptions

Reverts the changes made in doctrine#1240, and applies the passing down of `driverOptions` manually in `CreateDatabaseDoctrineCommand` and `DropDatabaseDoctrineCommand`

Resolves doctrine#1252
@ostrolucky ostrolucky deleted the feature-1230 branch May 26, 2021 22:01
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.

Console Commands: Possible bug - Using MasterSlaveConnection does not respect driverOptions
2 participants