Skip to content
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

ID-896 Isolate Misbehaving Query #1230

Merged
merged 3 commits into from
Oct 26, 2023
Merged

Conversation

tlangs
Copy link
Contributor

@tlangs tlangs commented Oct 26, 2023

Ticket: https://broadworkbench.atlassian.net/browse/ID-896

<Don't forget to include the ticket number in the PR title!>

What:

Isolate the misbehaving query to the read replica. All other read/writes go to the main db.

Why:

Read replicas have lag.

How:

Introduce a new DbReference to isolate misbehaving queries.


PR checklist

  • I've followed the instructions if I've made any changes to the API, especially if they're breaking changes
  • I've filled out the Security Risk Assessment (requires Broad Internal network access) and attached the result to the JIRA ticket

Copy link
Contributor

@jack-r-warren jack-r-warren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Looks good to me" - Greg lol

src/main/resources/sam.conf Outdated Show resolved Hide resolved
src/main/resources/sam.conf Outdated Show resolved Hide resolved
@@ -1353,7 +1357,7 @@ class PostgresAccessPolicyDAO(protected val writeDbRef: DbReference, protected v
userId: WorkbenchUserId,
samRequestContext: SamRequestContext
): IO[Iterable[ResourceIdWithRolesAndActions]] =
readOnlyTransaction("listUserResourcesWithRolesAndActions", samRequestContext) { implicit session =>
readOnlyTransactionReadReplica("listUserResourcesWithRolesAndActions", samRequestContext) { implicit session =>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you want to do this for all usages of UserResourcesQuery?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure. The query that's been blowing up the DB seems to be the one with as inherited in it. Being as surgical as possible seems like the right move here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I vote that given where we are with this, we isolate this one major offender first. 80/20 rule. We might be able to make things a lot better at some point, but for now we just need to treat the most severe problem.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@tlangs tlangs merged commit 68d1a53 into develop Oct 26, 2023
13 of 15 checks passed
@tlangs tlangs deleted the tl_ID-896_isolate_misbehaving_query branch October 26, 2023 18:38
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.

5 participants