Draft: Re-define workflows when using replicas
What does this MR do?
This replaces other load balancing code with a set of clearly defined workflows:
-
isolated_session
: opens a new session with a new context -
read_only
: we intent to only read data, disallowing writes -
isolated_write
: we intent to perform isolated write
This removes all prior methods:
without_sticky_writes
use_replicas_for_read_queries
fallback_to_replicas_for_ambiguous_queries
This ensures that operations are executed in a transactional way.
We continue to be able to use the .use_primary!
to work as it was.
Related:
Conformity
-
I have included a changelog entry, or it's not needed. (Does this MR need a changelog?) -
I have added/updated documentation, or it's not needed. (Is documentation required?) -
I have properly separated EE content from FOSS, or this MR is FOSS only. (Where should EE code go?) -
I have added information for database reviewers in the MR description, or it's not needed. (Does this MR have database related changes?) -
I have self-reviewed this MR per code review guidelines. -
This MR does not harm performance, or I have asked a reviewer to help assess the performance impact. (Merge request performance guidelines) -
I have followed the style guides.
Edited by Kamil Trzciński (Back 2025-01-01)