-
Notifications
You must be signed in to change notification settings - Fork 151
Disable ANALYZE on read-only replica #3940
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
Conversation
24db1d4 to
935e508
Compare
MartinquaXD
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a bit of context this logic is only used to make table sizes show up in grafana. Since then we introduced a postgres metrics exporter. Maybe the better solution would be to drop this logic altogether from the services and instead solve the issue in infra. This should clearly only happen if it's very easy to do as these metrics are low prio overall.
|
IIRC, we had this error with the primary DB as well and the devops team fixed it somehow, but it was a long time ago. I would rather do the opposite: switch those queries to the read replica(if connected) and don't touch the primary DB at all. |
That's the current and unsupported behavior |
Ah, true, sorry 😅 |
The read-only replica runs in recovery mode, under which you can't issue the commands stated in the PR description.
|
|
Please make sure to notify the team when the DB_READ_URL env var is removed from the vault. |
Description
We're getting autopilot errors due to running ANALYZE on our read replica, the PR disables it for the read replica only
— https://aws-es.cow.fi/_dashboards/app/discover#/context/86e4a5a0-4e4b-11ef-85c5-3946a99ed1a7/Lhrc15oBNcYyVCDI7-L5?_g=(filters:!())&_a=(columns:!(timestamp,log,log_level,kubernetes.pod_name),filters:!(('$state':(store:appState),meta:(alias:!n,disabled:!t,index:'86e4a5a0-4e4b-11ef-85c5-3946a99ed1a7',key:kubernetes.container_name,negate:!f,params:(query:polygon-autopilot-prod),type:phrase),query:(match_phrase:(kubernetes.container_name:polygon-autopilot-prod))),('$state':(store:appState),meta:(alias:!n,disabled:!t,index:'86e4a5a0-4e4b-11ef-85c5-3946a99ed1a7',key:log_level,negate:!f,params:!(ERROR,FATAL),type:phrases,value:'ERROR,%20FATAL'),query:(bool:(minimum_should_match:1,should:!((match_phrase:(log_level:ERROR)),(match_phrase:(log_level:FATAL))))))))
— https://www.postgresql.org/docs/current/hot-standby.html
Changes
How to test
Tested in staging, change was issued around 10:40, since the task first runs ANALYZE then sleeps, no errors = no command issued