Skip to content

keepReplica doesn’t seem to do anything #7384

Description

@MatTheCat

Bug Report

Q A
Version 4.4.3
Previous Version if the bug is a regression N/A

Summary

The only documentation I could find regarding keepReplica is from https://symfony.com/doc/current/doctrine/dbal.html#using-primary-replica-connections-read-replicas:

Set the keep_replica option to true to keep using the replica for read queries even after a write operation.

Current behavior

Setting keep_replica to true, the connection still uses the primary for a read query after writes.

Expected behavior

Given the documentation, I was expecting the replica to be used instead.

How to reproduce

  1. Configure a connection with replicas and keep_replica to true.
  2. Run some write queries to connect to the primary
  3. Run a read query

Is calling PrimaryReadReplicaConnection::ensureConnectedToReplica() mandatory for this feature to work? If yes that would be a documentation issue.

Or should PrimaryReadReplicaConnection override executeQuery to call it itself?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions