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

HPC-9460: Allow for read-only replica DB connection #141

Merged
merged 2 commits into from
Jul 2, 2024
Merged

Conversation

Pl217
Copy link
Contributor

@Pl217 Pl217 commented Mar 14, 2024

Since Knex doesn't support read-only replicas, we need to allow for a second connection to the replica server. This assumes master and replica DB are on separate servers, but if connection to replica isn't passed, the models behave just like before.

The goal is to use master DB for write operations and for transactions and replica DB should be only used for read-only operations. There are lots of changes, but it's mostly passing around of connections, just so that newly introduced replica connection can be used in find() method of raw model.

@Pl217 Pl217 added the ready for review All comments have been addressed, and the Pull Request is ready for review label Mar 14, 2024
@Pl217 Pl217 requested a review from a team as a code owner March 14, 2024 15:23
@Delgee Delgee assigned Pl217 and unassigned Delgee Jun 13, 2024
@Delgee Delgee added ready for merge Review and testing is complete. It is ready for merging as soon as CI has finished. and removed ready for review All comments have been addressed, and the Pull Request is ready for review labels Jun 13, 2024
Since Knex doesn't support read-only replicas,
we need to allow for a second connection to
the replica server. This assumes master and
replica DB are on separate servers, but if
connection to replica isn't passed, the models
behave just like before.

The goal is to use master DB for write operations
and for transactions and replica DB should be
only used for read-only operations. There are
lots of changes, but it's mostly passing around
of connections, just so that newly introduced
replica connection can be used in `find()`
method of raw model.
@Pl217 Pl217 enabled auto-merge July 2, 2024 15:19
@Pl217 Pl217 merged commit 8a2a05f into develop Jul 2, 2024
2 checks passed
@Pl217 Pl217 deleted the HPC-9460 branch July 2, 2024 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for merge Review and testing is complete. It is ready for merging as soon as CI has finished.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants