Skip to content

[11.X] Postgres Aurora failover - DetectsLostConnections#53404

Merged
taylorotwell merged 1 commit intolaravel:11.xfrom
vifer:feature/read-only-mode
Nov 5, 2024
Merged

[11.X] Postgres Aurora failover - DetectsLostConnections#53404
taylorotwell merged 1 commit intolaravel:11.xfrom
vifer:feature/read-only-mode

Conversation

@vifer
Copy link
Contributor

@vifer vifer commented Nov 4, 2024

We recently experienced a Postgres Aurora failover on production and noticed that our queue workers didn't restart. We are using read and write endpoints for the database connection in database.php and when Aurora fails over, the writer connection becomes a reader, but Laravel is trying to perform writes on it.

The exception message we are getting:

  • SQLSTATE[25006]: Read only sql transaction: 7

By adding this exception to the list lost connection in DetectsLostConnections.php, Laravel should reconnect to the right connection.

@taylorotwell taylorotwell merged commit 662989f into laravel:11.x Nov 5, 2024
@vifer vifer deleted the feature/read-only-mode branch November 5, 2024 08: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.

2 participants