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

Driver options are not passed to the primary\replica configuration #1416

Closed
GDXbsv opened this issue Nov 8, 2021 · 5 comments
Closed

Driver options are not passed to the primary\replica configuration #1416

GDXbsv opened this issue Nov 8, 2021 · 5 comments
Labels
Milestone

Comments

@GDXbsv
Copy link

GDXbsv commented Nov 8, 2021

When we use

  'options'               => [
      \PDO::ATTR_STRINGIFY_FETCHES        => 1,
      \PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => false
  ],

With one connection without replicas, this options passed in the driver configuration. (See \Doctrine\DBAL\Driver\PDO\MySQL\Driver::connect --> $params['driverOptions'])

When we add a replica, then the bundle do not include those driver options in the replica and primary configuration options.

@ostrolucky
Copy link
Member

We don't do that, because doing that causes other issues, like #1253. Can you try if you experience expected behaviour with doctrine-bundle 2.2.0? That's the version where we did pass driverOptions over to replicas.

@GDXbsv
Copy link
Author

GDXbsv commented Nov 15, 2021

I did try 2.2.0 it does not work.

  1. It does not work with dbal3, so I had to test with dbal2
  2. the bundle pass driver options in the new format for dbal3 which is not fit to dbal2, so it can not work at all.
  3. But even in this case according to xdebug options exists only in primary but not in replica. In the last version, they were removed from primary as well.

I mostly need to pass to all the connections \PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => false. Is it a way how I can do it differently?

@ostrolucky
Copy link
Member

I think you just have to pass options explicitly to each replica config instead of relying on them being passed from the primary config. How does your config look like?

@GDXbsv
Copy link
Author

GDXbsv commented Nov 15, 2021

But I can not pass. The bundle does not support it.
And in new version they even do not go in primary, the bundle do not pass them from the main config.

My config:

                    'default' => [
                        'server_version'        => '5.7',
                        'charset'               => 'utf8mb4',
                        'options'               => [
                            \PDO::ATTR_STRINGIFY_FETCHES        => 1,
                            \PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => false
                        ],
                        'default_table_options' => [
                            'charset' => 'utf8mb4',
                            'collate' => 'utf8mb4_unicode_ci',
                        ],
                        'mapping_types'         => ['uuid_binary' => 'binary'],
                        'url'                   => '%env(resolve:DATABASE_URL)%',
                        'keep_replica'          => false,
                         'replicas'              => [
                             'replica' => [
                                 'url'            => '%env(DATABASE_REPLICA_URL)%',
                             ],
                         ],
                    ],

@Alez
Copy link

Alez commented Feb 8, 2022

Can confirm. As of now, there is no way to pass DriverOptions via config .
dbal 3.3.1
bundle 2.5.2

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

No branches or pull requests

3 participants