-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Update sentry_app queries to use the read replica #93081
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
Codecov ReportAttention: Patch coverage is ✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## master #93081 +/- ##
==========================================
+ Coverage 84.35% 87.97% +3.61%
==========================================
Files 10319 10326 +7
Lines 594698 593516 -1182
Branches 23129 22860 -269
==========================================
+ Hits 501687 522173 +20486
+ Misses 92518 70899 -21619
+ Partials 493 444 -49 |
87373de
to
2ff206f
Compare
hihi I have no context but why are we doing this change? Is this a pattern we are adopting for more models? |
This is to help lessen load on the primary control db. |
I'm confused why are we doing this at business logic level? |
Co-authored-by: Mark Story <[email protected]>
We want to follow this model when possible. We do this at a business logic level (routing) because we want to edit it per query, not for all read queries. Some application logic will follow a read-your-writes pattern, and since all writes must go to the primary, if we point all reads to the replica, it can result in a miss due to replication lag. Thus we only want to point read queries to be reading from the replica when there isn't this constraint. If we wanted to blanket apply all reads to be from the read query though, it would probably look something like this: https://github.com/getsentry/getsentry/pull/17625 |
okay, that makes sense. Please make sure to add us for any similar changes in the integrations/notifications domain since any time sensitive models could have issues with reading from replica. |
This updates some of the queries to point to the control db replica.