-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
There is a special logic in default policy that handles the case when computing the first acceptable replica (i.e. such replica that it satisfies `pick_predicate`) is expensive (i.e. requires allocation). That logic was to make `pick` return None, because then `fallback` would allocate and compute all acceptable replicas. Unfortunately, the logic contained a bug that made `pick` continue execution instead of returning None, leading to a non-necessarily-replica being returned. This would break the LWT optimisation, because in case that the primary replica is filtered out by LB (e.g. it's down, or disabled by HostFilter), the second replica should be targeted instead, deterministically. The fix involves creating an enum to distinguish between three scenarios: 1. No replica exists that could satisfy the pick predicate -> None; 2. The primary replica satisfies the pick predicate -> Some(Computed(primary_replica)); 3. The primary replica does not satisfy the pick predicate, but it's possible that another replica does -> Some(ToBeComputedInFallback). Before the fix, the third scenario would merge with the first, leading to incorrect behaviour of not returning None from `pick`.
- Loading branch information
Showing
1 changed file
with
52 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters