diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2024-01-18 12:44:14 +0100 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2024-01-30 12:17:39 +0100 |
commit | 97152de9bf496e2cb797dfc7ee694616ecac53db (patch) | |
tree | 8c6f25d540f4444e38252c222e51deda85e82263 /lib/private/DB | |
parent | e0053e1c061041b1ffa0fc81d72b0a6d39b8cb50 (diff) | |
download | nextcloud-server-97152de9bf496e2cb797dfc7ee694616ecac53db.tar.gz nextcloud-server-97152de9bf496e2cb797dfc7ee694616ecac53db.zip |
fix(db): Execute dirty reads on the primary node
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/private/DB')
-rw-r--r-- | lib/private/DB/Connection.php | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/private/DB/Connection.php b/lib/private/DB/Connection.php index 5affa2c3d48..ed322bc90f0 100644 --- a/lib/private/DB/Connection.php +++ b/lib/private/DB/Connection.php @@ -285,6 +285,10 @@ class Connection extends PrimaryReadReplicaConnection { 'exception' => new \Exception(), ], ); + // To prevent a dirty read on a replica that is slightly out of sync, we + // switch back to the primary. This is detrimental for performance but + // safer for consistency. + $this->ensureConnectedToPrimary(); } $sql = $this->replaceTablePrefix($sql); |